-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdatescore.php
executable file
·70 lines (68 loc) · 2.27 KB
/
updatescore.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
session_start();
error_reporting(0);
$score=$_POST['score'];
$name=$_SESSION['head'];
$pass=$_SESSION['tail'];
$flag=$_SESSION['sure'];
if ($flag == 1)
{
// echo "<script>
// alert('123');
// </script>";
$conn=mysql_connect(SAE_MYSQL_HOST_M.':'.SAE_MYSQL_PORT,SAE_MYSQL_USER,SAE_MYSQL_PASS);
mysql_select_db(SAE_MYSQL_DB);
$sql="select * from player where id = '$name' and password = '$pass';";
$data=array();
$query=mysql_query($sql);
while($row=mysql_fetch_assoc($query)){
$data[]=$row;
}
$flag1 = 0;
$allscore[]=$score;
$allscore[]=(int)($data[0]['score1']);
$allscore[]=(int)($data[0]['score2']);
$allscore[]=(int)($data[0]['score3']);
$allscore[]=(int)($data[0]['score4']);
$allscore[]=(int)($data[0]['score5']);
rsort($allscore);
$index1='score1';
$index2='score2';
$index3='score3';
$index4='score4';
$index5='score5';
$sql="update player set $index1 = $allscore[0] where id = '$name' and password = '$pass';";
if($query=mysql_query($sql))
{
$sql="update player set $index2 = $allscore[1] where id = '$name' and password = '$pass';";
if ($query=mysql_query($sql))
{
$sql="update player set $index3 = $allscore[2] where id = '$name' and password = '$pass';";
if ($query=mysql_query($sql))
{
$sql="update player set $index4 = $allscore[3] where id = '$name' and password = '$pass';";
if ($query=mysql_query($sql))
{
$sql="update player set $index5 = $allscore[4] where id = '$name' and password = '$pass';";
if ($query=mysql_query($sql))
{
echo json_encode(array('status'=>1,'info'=>'Update Success'));
$flag1 = 1;
}
}
}
}
}
else
{
echo json_encode(array('status'=>0,'info'=>'Update Fail'));
$flag1 = 2;
break;
}
if ($flag1 == 0)
echo json_encode(array('status'=>1,'info'=>'No Update'));
}
else
{
echo json_encode(array('status'=>1,'info'=>'No login'));
}