mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-09-02 16:37:15 +00:00
Refactor all PLUS System
Refactor PLUS System + Fix some bugs
This commit is contained in:
+31
-3
@@ -1,8 +1,36 @@
|
||||
<?php
|
||||
////////////// made by alq0rsan /////////////////////////
|
||||
if($session->gold >= 100 && $session->sit == 0 && $session->goldclub == 0) {
|
||||
mysqli_query($database->dblink,"UPDATE ".TB_PREFIX."users set goldclub = 1, gold = gold - 100 where `id`='".$session->uid."'");
|
||||
// Gold Club activation – 100 gold, atomic
|
||||
$uid = (int)$session->uid;
|
||||
|
||||
if($session->sit != 0) {
|
||||
header("Location: plus.php?id=3"); exit;
|
||||
}
|
||||
|
||||
// un singur query care face tot
|
||||
mysqli_query($database->dblink,
|
||||
"UPDATE ".TB_PREFIX."users
|
||||
SET goldclub = 1, gold = gold - 100
|
||||
WHERE id = $uid AND gold >= 100 AND goldclub = 0"
|
||||
);
|
||||
|
||||
if(mysqli_affected_rows($database->dblink) == 1) {
|
||||
// succes – update sesiunea
|
||||
$session->gold -= 100;
|
||||
$session->goldclub = 1;
|
||||
$_SESSION['gold'] = $session->gold;
|
||||
$_SESSION['goldclub'] = 1;
|
||||
|
||||
if(isset($database->cache)) {
|
||||
$database->cache->delete('user:'.$uid);
|
||||
}
|
||||
|
||||
// log
|
||||
mysqli_query($database->dblink,
|
||||
"INSERT INTO ".TB_PREFIX."gold_fin_log (wid, action, time)
|
||||
VALUES (0, 'Gold Club activated', ".time().")"
|
||||
);
|
||||
}
|
||||
|
||||
header("Location: plus.php?id=3");
|
||||
exit;
|
||||
?>
|
||||
Reference in New Issue
Block a user