View difference between Paste ID: ZiABB42V and MDkweDD0
SHOW: | | - or go back to the newest paste.
1
$spend = array("energy","awake");
2-
if (array_key_exists("spend",$_GET) && in_array($spend,$_GET))
2+
if (array_key_exists("spend",$_GET) && in_array($spend,$_GET["spend"]))
3
{
4
 if($user_class->points >= 10)
5
 {
6
     if($user_class->energy == $user_class->maxenergy) 
7
         echo Message("Your energy is already full up!");
8
    else 
9
    {
10
        $newpoints = $user_class->points - 10;
11
            echo Message("You Refilled Your Energy and Awake.");
12
    }
13
 } 
14
 else 
15
     echo Message("You don't have enough points to do that.");
16
if ($user_class->awakepercent == 100)
17
    echo Message("Your awake is already full up!");
18
 elseif ($user_class->points == 0) 
19
    echo Message("You don't have enough points to do that.");
20
 else 
21
 {
22
     $points_to_use = $user_class->points;
23
     $points_to_use = floor(($points_to_use > (100 - $user_class->awakepercent)) ? (100 -     $user_class->awakepercent) : $points_to_use);
24
     $awake_to_digits = floor($user_class->directmaxawake * ($points_to_use / 100));
25
     $newawake = floor($user_class->directawake + $awake_to_digits);
26
     $newawake = ($newawake > $user_class->directmaxawake) ? $user_class->directmaxawake : $newawake;
27
     $newpoints = $user_class->points - $points_to_use;
28
     $result = mysql_query("UPDATE `grpgusers` SET `energy` = '".$user_class->maxenergy."',`awake` = '".$newawake."',  `points`='".$newpoints."' WHERE `id`='".$_SESSION['id']."'");
29
  
30
    }
31
}