<?php
 
defined('IN_HS') or exit('Access Denied');
sajax_init();
sajax_export("savepass","savepriv","savelock");
sajax_handle_client_request();
function savepass($idx,$idserver,$npass)
{
global $db;
if(!$idx) return "未读取角色ID！";
if(!$idserver) return "未读取到分区ID！";
if(!$npass) 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");
$npass = hsmd5($npass);
$sqldb->query("UPDATE user SET password='$npass' WHERE idx='$idx'");
return "true";
}
switch($action)
{
case 'manage':
$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,$datalog);
if(!$mysqlco) showmessage("连接分区失败，请检查服务器分区设置情况！");
$sqldb = new db_mysql;
$sqldb->connect($serverip.':'.$port,$loginname,$loginpass,$datalog);
$sqldb->query("SET NAMES DEFAULT");
$page = isset($page) ?intval($page) : 1;
$pagesize = $HS['pagesize'] ?$HS['pagesize'] : 30;
$offset = ($page-1)*$pagesize;
$condition = '';
$condition .= $Name ?" and f.Name like '%$Name%'": '';
$condition .= $userID ?" and t.userID= '$userID'": '';
$condition .= $type ?" and t.type= '$type'": '';
$condition .= $starttime ?" and t.LogTime >= '$starttime'": '';
$condition .= $endtime ?" and t.LogTime <= '$endtime'": '';
$r = $sqldb->get_one("SELECT count(*) as num FROM t_log_user_history as t,".$datafso.".user as f WHERE t.userID=f.ID $condition");
$sumnums = $r['num'];
$pages = phppages($r['num'],$page,$pagesize);
$logs = array();
$result = $sqldb->query("SELECT t.*,f.Name,f.AccountID FROM t_log_user_history as t,".$datafso.".user as f WHERE t.userID=f.ID $condition ORDER BY t.OperateID ASC LIMIT $offset,$pagesize");
while($r = $sqldb->fetch_array($result))
{
$r['LogTime'] = date("m.d H:i",strtotime($r['LogTime']));
$logs[] = $r;
}
include admintpl('loglist');
break;
case 'delelog':
$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,$datalog);
if(!$mysqlco) showmessage("连接分区失败，请检查服务器分区设置情况！");
$sqldb = new db_mysql;
$sqldb->connect($serverip.':'.$port,$loginname,$loginpass,$datalog);
$sqldb->query("SET NAMES DEFAULT");
$deletedate=intval($deletedate);
$thatdate = $PHP_TIME -$deletedate*3600*24;
$thatdate = date("Y-m-d H:i:s",$thatdate);
$sqldb->query("DELETE FROM t_log_user_history WHERE LogTime<'$thatdate'");
if($sqldb->affected_rows())
{
showmessage($thatdate."前的日志已被成功清理！");
}else{
showmessage("未清理成功，或者".$thatdate."前无日志！");
}
include admintpl('loglist');
break;
case 'select':
$gamelist = array();
$result = $db->query("SELECT * FROM ".TABLE_GAMESERVER." ORDER BY id");
while($r = $db->fetch_array($result))
{
$gamelist[] = $r;
}
include admintpl('select');
break;
}
function loginfo($str,$str2)
{
if($str == "1")
{
$typeinfo ="玩家交易";
}
elseif($str == "7")
{
$typeinfo ="系统检测";
}
elseif($str == "8")
{
$typeinfo ="G M动作";
}
elseif($str == "10")
{
$typeinfo ="道具解密";
}
elseif($str == "11")
{
$typeinfo ="丢弃道具";
}
elseif($str == "12")
{
$typeinfo ="拾取道具";
}
elseif($str == "13")
{
$typeinfo ="玩家买入";
}
elseif($str == "14")
{
$typeinfo ="玩家卖出";
}
elseif($str == "15")
{
if($str2 == "1")
{
$typeinfo ="玩家登陆";
}
elseif($str2 == "2")
{
$typeinfo ="玩家退出";
}
else
{
$typeinfo ="未知动作";
}
}
elseif($str == "18")
{
$typeinfo ="商店出售";
}
elseif($str == "19")
{
$typeinfo ="锻造道具";
}
elseif($str == "25")
{
$typeinfo ="道具领取";
}
elseif($str == "26")
{
$typeinfo ="创建角色";
}
elseif($str == "36")
{
if($str2 == "1")
{
$typeinfo ="发布拍卖";
}
elseif($str2 == "4")
{
$typeinfo ="兑拍成功";
}
elseif($str2 == "3")
{
$typeinfo ="拍卖卖出";
}
else
{
$typeinfo ="未知";
}
}
else
{
$typeinfo ="未知";
}
return $typeinfo;
}
?>