/
cheatupdate.php
54 lines (39 loc) · 1.16 KB
/
cheatupdate.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
if (isset($_REQUEST["cheater_id"])) {
include 'config.php';
$con = mysqli_connect($host,$username,$password,$database); //host,username,password,database
if (mysqli_connect_errno($con)) {
$result = "conn prob in first db: " . mysqli_connect_error($con);
}
$userid = mysqli_real_escape_string($con, $_REQUEST['cheater_id']);
$userscore = mysqli_real_escape_string($con, $_REQUEST['cheater_score']);
$candies = mysqli_real_escape_string($con, $_REQUEST['cheater_candies']);
//echo $userid."<userid scokre>".$score."< candies>".$candies;
$query = mysqli_query($con,"select maxscore from mastermath.bande where fbid='$userid'");
if($query)
{
while($row = mysqli_fetch_array($query)) {
//$result = $userscore."<>".$row['maxscore'];
if($userscore>$row['maxscore'])
{
//$result=$userscore."<>".$row['maxscore'];
if(mysqli_query($con,"UPDATE mastermath.bande SET maxscore='$userscore',candies='$candies' WHERE fbid='$userid'"))
{
$result=1;
}
else{
$result="query error: ".mysqli_error($con);
}
}// $userscore>$row['maxscore'] if statement ends here
else
{
$result=0;
}
echo $result;
}//end while loop
} //select query
}
else{
echo "isset not defined";
}
?>