-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathend.php
More file actions
59 lines (51 loc) · 1.67 KB
/
end.php
File metadata and controls
59 lines (51 loc) · 1.67 KB
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
<?php
define('CURSCRIPT', 'end');
require './include/common.inc.php';
require './include/game.func.php';
if(!$cuser||!$cpass) { gexit($_ERROR['no_login'],__file__,__line__); }
$result = $db->query("SELECT * FROM {$tablepre}players WHERE name = '$cuser' AND type = 0");
if(!$db->num_rows($result)) { header("Location: index.php");exit(); }
$pdata = $db->fetch_array($result);
if($pdata['pass'] != $cpass) {
$tr = $db->query("SELECT `password` FROM {$gtablepre}users WHERE username='$cuser'");
$tp = $db->fetch_array($tr);
$password = $tp['password'];
if($password == $cpass) {
$db->query("UPDATE {$tablepre}players SET pass='$password' WHERE name='$cuser'");
} else {
gexit($_ERROR['wrong_pw'],__file__,__line__);
}
}
extract($pdata);
init_playerdata();
if($hp<=0 || $state>=10) {
$result = $db->query("SELECT lastword FROM {$gtablepre}users WHERE username='$name'");
$motto = $db->result($result,0);
$dtime = date("Y年m月d日H时i分s秒",$endtime);
if($bid) {
$result = $db->query("SELECT name FROM {$tablepre}players WHERE pid='$bid'");
if($db->num_rows($result)) { $kname = $db->result($result,0); }
}
}
if ($udata['u_templateid'] == 1 && !strstr($_SERVER['HTTP_REFERER'], 'php') && $_SERVER['HTTP_REFERER'] != '') {
echo json_encode(array(
"page" => "end",
"title" => $hp <= 0 ? $stateinfo[$state] : $gwin[$winmode],
"deadInfo" => $hp <= 0 ? array(
"avatar" => $iconImg,
"motto" => $motto,
"info" => $dinfo[$state],
"time" => $dtime,
"killer" => !empty($kname) && $state >= 10 ? $kname : null,
) : null,
"flag" => array(
"number" => $sNo,
"killNum" => $killnum,
"winner" => $winner,
"state" => $state,
)
));
} else {
include template('ending');
}
?>