51ff3226 |
1 | <?php |
2 | function k_wallet() { |
3 | // cheatfix, moznost prelievania user_k a k_walletu. |
4 | |
5 | global $db,$node,$error; |
6 | $user_id=$_SESSION['user_id']; |
7 | $k_request=mysql_real_escape_string($_POST['k_wallet']); |
8 | |
9 | $kset=$db->query("select user_k from users where user_id='$user_id'"); |
10 | $kset->next(); |
11 | $user_k=$kset->getString('user_k'); |
12 | |
13 | $kset=$db->query("select k_wallet from users where user_id='$user_id'"); |
14 | $kset->next(); |
15 | $k_wallet=$kset->getString('k_wallet'); |
16 | |
17 | $k_request = (int) $k_request; //integer only.. |
18 | |
19 | |
20 | |
21 | if (($k_wallet+(-1*$k_request)) < 0 or ($user_k-(-1*$k_request)) < 0 or (!$k_request)) { |
ac3bdc72 |
22 | $error="Chybne zadanie alebo na to proste nemas:-)"; |
23 | return false; |
51ff3226 |
24 | } |
25 | |
26 | $db->query("update users set k_wallet=k_wallet+(-1*$k_request) , user_k=user_k-(-1*$k_request) where user_id='$user_id'"); |
27 | } |
28 | |
29 | ?> |