StevenG89

Untitled

May 16th, 2014
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.57 KB | None | 0 0
  1. function claim_worked() {
  2.     global $db,$ir,$h,$userid;
  3.     $choice = array(
  4.         'choiceone',
  5.         'choicetwo',
  6.         'choicethree'
  7.     );
  8.     $_POST['choice'] = isset($_POST['choice']) && ctype_alpha($_POST['choice']) && in_array($_POST['choice'], $choice) ? $_POST['choice'] : null;
  9.     if(empty($_POST['choice'])) {
  10.         exit('The choice you chose was not valid');
  11.         $h->endpage();
  12.     }
  13.     $res = $db->query("SELECT * FROM `donate_log` WHERE `donate_buyer` = '$userid'");
  14.     $row = $db->fetch_row($res);
  15.    
  16.     if($_POST['choice'] == 'choiceone') {
  17.         if($ir['tier'] == 1 && $row['donate_totalprice'] >= 50) {
  18.             $db->query("UPDATE `users` SET `platinum` = `platinum` + 250 WHERE `id` = '$userid'");
  19.             item_add($userid, 75, 3);
  20.             echo "<span style='color:green'>You have chosen 250 platinum and 3 stat tablets</span>";
  21.         } else {
  22.             exit('Your not eligible for a reward.');
  23.             $h->endpage();
  24.         }
  25.     } else if($_POST['choice'] == 'choicetwo') {
  26.         if($ir['tier'] == 1 && $row['donate_totalprice'] >= 50) {
  27.             $db->query("UPDATE `users` SET `platinum` = `platinum` + 100 WHERE `id` = '$userid'");
  28.             item_add($userid, 52, 3);
  29.             echo "<span style='color:green'>You have chosen 100 platinum and 3 Weapon Upgrade Kit</span>";
  30.         } else {
  31.             exit('Your not eligible for a reward.');
  32.             $h->endpage();
  33.         }
  34.     } else if($_POST['choice'] == 'choicethree') {
  35.         if($ir['tier'] == 1 && $row['donate_totalprice'] >= 50) {
  36.             item_add($userid, 43, 1);
  37.             echo "<span style='color:green'>You have chosen Donator Package One</span>";
  38.         } else {
  39.             exit('Your not eligible for a reward.');
  40.             $h->endpage();
  41.         }
  42.     }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment