mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-08-31 07:37:13 +00:00
Update log system gold
Update log system gold
This commit is contained in:
+12
-8
@@ -1,21 +1,24 @@
|
||||
<?php
|
||||
// Gold Club activation – 100 gold, atomic
|
||||
$uid = (int)$session->uid;
|
||||
$wid = (int)$village->wid;
|
||||
$now = time();
|
||||
$cost = 100;
|
||||
|
||||
if($session->sit != 0) {
|
||||
header("Location: plus.php?id=3"); exit;
|
||||
}
|
||||
|
||||
// un singur query care face tot
|
||||
// un singur query
|
||||
mysqli_query($database->dblink,
|
||||
"UPDATE ".TB_PREFIX."users
|
||||
SET goldclub = 1, gold = gold - 100
|
||||
WHERE id = $uid AND gold >= 100 AND goldclub = 0"
|
||||
SET goldclub = 1, gold = gold - $cost
|
||||
WHERE id = $uid AND gold >= $cost AND goldclub = 0"
|
||||
);
|
||||
|
||||
if(mysqli_affected_rows($database->dblink) == 1) {
|
||||
// succes – update sesiunea
|
||||
$session->gold -= 100;
|
||||
// update sesiune
|
||||
$session->gold -= $cost;
|
||||
$session->goldclub = 1;
|
||||
$_SESSION['gold'] = $session->gold;
|
||||
$_SESSION['goldclub'] = 1;
|
||||
@@ -24,10 +27,11 @@ if(mysqli_affected_rows($database->dblink) == 1) {
|
||||
$database->cache->delete('user:'.$uid);
|
||||
}
|
||||
|
||||
// log
|
||||
// LOG pentru a2b2.php
|
||||
mysqli_query($database->dblink,
|
||||
"INSERT INTO ".TB_PREFIX."gold_fin_log (wid, action, time)
|
||||
VALUES (0, 'Gold Club activated', ".time().")"
|
||||
"INSERT INTO ".TB_PREFIX."gold_fin_log
|
||||
(uid, wid, action, gold, time, details)
|
||||
VALUES ($uid, $wid, 'Use 100 gold for Gold Club', -$cost, $now, 'Gold Club activated')"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user