Файл: sys/udata.php
Строк: 87
<?
if($_SESSION['offline']){
$offline = 0;
} else {
$offline = 0; //1 если оффлайн
if($offline==1) unset($_SESSION['uid']);
}
if($_SESSION['uid']){
$CONFIG['uid'] = $_SESSION['uid'];
} elseif($_COOKIE['Fc5Pi1'] && $_COOKIE['gZ2tf3']) {
$login = base64_decode($_COOKIE['gZ2tf3']);
$login = mysql_real_escape_string($login);
$q = mysql_query("SELECT `id`,`login`,`password` FROM users WHERE `login` = '$login';");
while ($row = mysql_fetch_array($q,MYSQL_ASSOC)) {
$out = $row;
}
$chash = md5($out['id'].$out['login'].$out['password'].'Fc5Pi1');
if($_COOKIE['Fc5Pi1']==$chash){
$CONFIG['uid'] = $out['id'];
} else {
$CONFIG['uid'] = 0;
}
} else {
$_SESSION['uid'] = 0;
$CONFIG['uid'] = 0;
}
if($CONFIG['uid']!=0){
$query = 'SELECT `login`,`name`,`lastname`,`email`,`bday`,`bmonth`,`byear`,`confirm`,`balance`,`money`,`photo`,`social:vk`
FROM `users` WHERE `id` = '.$CONFIG['uid'];
$query = mysql_query($query);
while ($row = mysql_fetch_array($query, MYSQL_ASSOC)) {
$out[] = $row;
}
$userdata = $out[0];
}
$res = mysql_query('SELECT COUNT(`id`) AS `count` FROM `tasks` WHERE `bal`>0 AND `uid`= '.$CONFIG['uid']);
$data = mysql_fetch_assoc($res);
$tasks_count = $data['count'];
unset($res);
unset($data);
$res = mysql_query("SELECT COUNT(`tid`) AS `count` FROM done WHERE `uid` = '".$CONFIG['uid']."' AND `mode`='done';");
$data = mysql_fetch_assoc($res);
$tasks_done = $data['count'];
unset($res);
unset($data);
$res = mysql_query("SELECT COUNT(`tid`) AS `count` FROM done WHERE `mode`='done';");
$data = mysql_fetch_assoc($res);
$all_tasks_done = $data['count'];
unset($res);
unset($data);
$res = mysql_query("SELECT COUNT(`id`) AS `count` FROM users WHERE `confirm`='1';");
$data = mysql_fetch_assoc($res);
$confirm_users_count = $data['count'];
unset($res);
unset($data);
$res = mysql_query("SELECT COUNT(`id`) AS `count` FROM `users` WHERE `referer`= ".$CONFIG['uid']);
$data = mysql_fetch_assoc($res);
$referers_count = $data['count'];
unset($res);
unset($data);
$res = mysql_query("SELECT COUNT(`id`) AS `count` FROM `orders` WHERE `status`= '1' OR `status`= '2'");
$data = mysql_fetch_assoc($res);
$orders_count = $data['count'];
unset($res);
unset($data);
$CONFIG['Tokens']['vk'] = array(
'e8264df572ef77abb1b46600fcdb1e4e0b2054a7642191048cc9630d424c29ced0373c2d9bc1e164749ef',
'585e87adfcece516aa25b1a6958df9e717c7efa7b2c61778ff62f385599b2c1becc11fa65ff5d7ef84c66',
'ad5d381add7a311339cf7deba4483c80c2e236cd0dd41651833fd1f42049e2baa83a9f55c6247df1de645'
);
$CONFIG['Globals'] = array(
'uid'=>$CONFIG['uid'],
'username'=>$userdata['login'],
'name'=>$userdata['name'],
'lastname'=>$userdata['lastname'],
'email'=>$userdata['email'],
'bday'=>$userdata['bday'],
'bmonth'=>$userdata['bmonth'],
'byear'=>$userdata['byear'],
'confirm'=>$userdata['confirm'],
'balance'=>$userdata['balance'],
'money'=>$userdata['money'],
'photo'=>$userdata['photo'],
'social:vk'=>$userdata['social:vk'],
'social:tw'=>$userdata['social:tw'],
'social:fb'=>$userdata['social:fb'],
'offline'=>$offline,
'tasks:count'=>$tasks_count,
'tasks:done'=>$tasks_done,
'refs'=>$referers_count,
'users_count'=>$confirm_users_count,
'done_count'=>$tasks_done,
'orders_count'=>$orders_count
);