forked from amarillonmc/phpdts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
user_profile.php
53 lines (45 loc) · 1.55 KB
/
user_profile.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
<?php
define('CURSCRIPT', 'user_profile');
require './include/common.inc.php';
require './include/user.func.php';
$_REQUEST = gstrfilter($_REQUEST);
if ($_REQUEST["playerID"]=="")
{
if(!$cuser||!$cpass) { gexit($_ERROR['no_login'],__file__,__line__); }
$result = $db->query("SELECT * FROM {$tablepre}users WHERE username='$cuser'");
if(!$db->num_rows($result)) { gexit($_ERROR['login_check'],__file__,__line__); }
$udata = $db->fetch_array($result);
if($udata['password'] != $cpass) { gexit($_ERROR['wrong_pw'], __file__, __line__); }
if($udata['groupid'] <= 0) { gexit($_ERROR['user_ban'], __file__, __line__); }
extract($udata);
$curuser=true;
}
else
{
$uname=$_REQUEST["playerID"];
$result = $db->query("SELECT * FROM {$tablepre}users WHERE username='$uname'");
if(!$db->num_rows($result)) { gexit($_ERROR['user_not_exists'],__file__,__line__); }
$udata = $db->fetch_array($result);
extract($udata);
$curuser=false;
if ($uname==$cuser) $curuser=true;
}
$iconarray = get_iconlist($icon);
$select_icon = $icon;
$winning_rate=$validgames?round($wingames/$validgames*100)."%":'0%';
include_once GAME_ROOT.'./include/game/achievement.func.php';
$ach=$udata['achievement'];
$n=$udata['username'];
if (!valid_achievement($ach)) {
$ach=init_achievement($ach);
$db->query("UPDATE {$tablepre}users SET achievement='$ach' WHERE username='$n'" );
}
//½âÎö³É¾ÍµÄÍê³ÉÇé¿ö
global $gamecfg;
require config("gamecfg",$gamecfg);
for ($i=0; $i<$achievement_count; $i++)
{
$cpl[$i]=check_achievement($i,$n);
$prc[$i]=fetch_achievement($i,$n);
}
include template('user_profile');