<?php
 
defined('IN_HS') or exit('Access Denied');
sajax_init();
sajax_export("savefsocontents","checkfsoonline","checkacconline","savebancontents");
sajax_handle_client_request();
function savebancontents($iduser,$idserver)
{
global $db;
if(!$idserver) return "未读取到分区ID！";
if(!$iduser) return "未读取到角色信息！";
$Items = $_COOKIE['cookitems'];
if(!$Items) return "你禁用了Cookie或将Items设为了空。这样是不允许的！";
if($Items == '') return "请填写装备数据，不要留空！";
$gamels = cache_read("gamelist_".$idserver.".php");
@extract($gamels,EXTR_OVERWRITE);
$mysqlco = @mysql_connect($serverip.':'.$port,$loginname,$loginpass,$datafso);
if(!$mysqlco) return "连接分区失败，请检查服务器分区设置情况！";
$sqldb = new db_mysql;
$sqldb->connect($serverip.':'.$port,$loginname,$loginpass,$datafso);
$sqldb->query("SET NAMES DEFAULT");
$sqldb->query("UPDATE t_bank SET `Items`='$Items' WHERE AccountID='$iduser'");
if($sqldb->affected_rows())
{
return "true";
}else{
return "更新失败，或者原数据未作任何改变！请刷新页面或重试！";
}
}
function savefsocontents($iduser,$idserver)
{
global $db;
if(!$idserver) return "未读取到分区ID！";
if(!$iduser) return "未读取到角色信息！";
$Items = $_COOKIE['cookitems'];
if(!$Items) return "你禁用了Cookie或将Items设为了空。这样是不允许的！";
if($Items == '') return "请填写装备数据，不要留空！";
$gamels = cache_read("gamelist_".$idserver.".php");
@extract($gamels,EXTR_OVERWRITE);
$mysqlco = @mysql_connect($serverip.':'.$port,$loginname,$loginpass,$datafso);
if(!$mysqlco) return "连接分区失败，请检查服务器分区设置情况！";
$sqldb = new db_mysql;
$sqldb->connect($serverip.':'.$port,$loginname,$loginpass,$datafso);
$sqldb->query("SET NAMES DEFAULT");
$sqldb->query("UPDATE user SET `Items`='$Items' WHERE ID='$iduser'");
if($sqldb->affected_rows())
{
return "true";
}else{
return "更新失败，或者原数据未作任何改变！请刷新页面或重试！";
}
}
function checkfsoonline($idserver,$iduser)
{
global $db;
if(!$idserver) return "未读取到分区ID！";
if(!$iduser) return "未读取到角色信息！";
$gamels = cache_read("gamelist_".$idserver.".php");
@extract($gamels,EXTR_OVERWRITE);
$mysqlco = @mysql_connect($serverip.':'.$port,$loginname,$loginpass,$datalog);
if(!$mysqlco) return "连接分区失败，请检查服务器分区设置情况！";
$sqldb = new db_mysql;
$sqldb->connect($serverip.':'.$port,$loginname,$loginpass,$datalog);
$sqldb->query("SET NAMES DEFAULT");
$rl = $sqldb->get_one("SELECT LogTime FROM t_log_user_history WHERE type='15' AND `longParam1`='1' AND userID='$iduser' ORDER BY OperateID DESC limit 0,1");
$truetime = $rl['LogTime'];
$ro = $sqldb->get_one("SELECT LogTime FROM t_log_user_history WHERE type='15' AND `longParam1`='2' AND userID='$iduser' ORDER BY OperateID DESC limit 0,1");
$outtime = $ro['LogTime'];
$sumdo = strtotime($truetime);
$sumdt = strtotime($outtime);
if ($sumdo >$sumdt)
{
return "yesonline";
}else{
return "unonline";
}
}
function checkacconline($idserver,$AccountID)
{
global $db;
if(!$idserver) return "未读取到分区ID！";
if(!$AccountID) return "未读取到角色信息！";
$gamels = cache_read("gamelist_".$idserver.".php");
@extract($gamels,EXTR_OVERWRITE);
$mysqlco = @mysql_connect($serverip.':'.$port,$loginname,$loginpass,$dataacc);
if(!$mysqlco) return "连接分区失败，请检查服务器分区设置情况！";
$sqldb = new db_mysql;
$sqldb->connect($serverip.':'.$port,$loginname,$loginpass,$dataacc);
$sqldb->query("SET NAMES DEFAULT");
$accinfo = $sqldb->get_one("SELECT latest_login_date FROM user WHERE idx='$AccountID' ORDER BY idx DESC limit 0,1");
$truetime = $accinfo['latest_login_date'];
$leavel = $sqldb->get_one("SELECT leave_time FROM consume WHERE AccountID='$AccountID' ORDER BY idx DESC limit 0,1");
$outtime = $leavel['leave_time'];
$sumdo = strtotime($truetime);
$sumdt = strtotime($outtime);
if ($sumdo >$sumdt)
{
return "yesonline";
}else{
return "unonline";
}
}
switch($action)
{
case 'sfso':
$idserver=intval($idserver);
if(!idserver) showmessage("非法操作！");
$gamels = $db->get_one("SELECT * FROM ".TABLE_GAMESERVER." WHERE id='$idserver'");
@extract($gamels,EXTR_OVERWRITE);
$mysqlco = @mysql_connect($serverip.':'.$port,$loginname,$loginpass,$datafso);
if(!$mysqlco) showmessage("连接分区失败，请检查服务器分区设置情况！");
$sqldb = new db_mysql;
$sqldb->connect($serverip.':'.$port,$loginname,$loginpass,$datafso);
$sqldb->query("SET NAMES DEFAULT");
$page = isset($page) ?intval($page) : 1;
$pagesize = $HS['pagesize'] ?$HS['pagesize'] : 30;
$offset = ($page-1)*$pagesize;
$condition = '';
$condition .= $words ?" and Items like '%$words%'": '';
$r = $sqldb->get_one("SELECT count(*) as num FROM user WHERE 1 $condition");
$sumnums = $r['num'];
$pages = phppages($r['num'],$page,$pagesize);
$members = array();
$result = $sqldb->query("SELECT ID,Name,AccountID,Items FROM user WHERE 1 $condition ORDER BY ID DESC LIMIT $offset,$pagesize");
while($r = $sqldb->fetch_array($result))
{
$members[] = $r;
}
break;
case 'sban':
$idserver=intval($idserver);
if(!idserver) showmessage("非法操作！");
$gamels = $db->get_one("SELECT * FROM ".TABLE_GAMESERVER." WHERE id='$idserver'");
@extract($gamels,EXTR_OVERWRITE);
$mysqlco = @mysql_connect($serverip.':'.$port,$loginname,$loginpass,$datafso);
if(!$mysqlco) showmessage("连接分区失败，请检查服务器分区设置情况！");
$sqldb = new db_mysql;
$sqldb->connect($serverip.':'.$port,$loginname,$loginpass,$datafso);
$sqldb->query("SET NAMES DEFAULT");
$page = isset($page) ?intval($page) : 1;
$pagesize = $HS['pagesize'] ?$HS['pagesize'] : 30;
$offset = ($page-1)*$pagesize;
$condition = '';
$condition .= $words ?" and b.Items like '%$words%'": '';
$r = $sqldb->get_one("SELECT count(*) as num FROM t_bank b,".$dataacc.".user u WHERE b.AccountID=u.idx $condition");
$sumnums = $r['num'];
$pages = phppages($r['num'],$page,$pagesize);
$members = array();
$result = $sqldb->query("SELECT b.AccountID,b.Items,u.username FROM t_bank b,".$dataacc.".user u WHERE b.AccountID=u.idx $condition ORDER BY b.AccountID DESC LIMIT $offset,$pagesize");
while($r = $sqldb->fetch_array($result))
{
$members[] = $r;
}
break;
}
$idserver=intval($idserver);
if(!idserver) showmessage("非法操作！");
$gamels = $db->get_one("SELECT * FROM ".TABLE_GAMESERVER." WHERE id='$idserver'");
@extract($gamels,EXTR_OVERWRITE);
$mysqlco = @mysql_connect($serverip.':'.$port,$loginname,$loginpass,$datafso);
if(!$mysqlco) showmessage("连接分区失败，请检查服务器分区设置情况！");
include admintpl('searchitem');
?>