📄 wog_act_chara.php
字号:
<?
/*=====================================================
Copyright (C) ETERNAL<cqz78@qq.com>
Modify : 2005/01/01
URL : http://zqkls.uu1001.com/thread.php?fid=49
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
===================================================== */
class wog_act_chara{
var $group_id="";
function chara_make() //创造新增页面
{
global $DB_site,$_POST,$wog_arry,$lang;
$temp_i_id="";
$img=$DB_site->query("select i_id from wog_img order by i_id asc");
while($imgs=$DB_site->fetch_array($img))
{
$temp_i_id.=",".$imgs["i_id"];
}
$DB_site->free_result($img);
unset($imgs);
$temp_i_id=substr($temp_i_id,1,strlen($temp_i_id));
$temp_ch="";
$ch=$DB_site->query("select ch_id,ch_name from wog_character where ch_mlv=1 ");
while($chs=$DB_site->fetch_array($ch))
{
$temp_ch.=";".$chs["ch_id"].",".$chs["ch_name"];
}
$DB_site->free_result($ch);
unset($chs);
$temp_ch=substr($temp_ch,1,strlen($temp_ch));
include("wog_chara_make.php");
echo charset();
echo "<script language=JavaScript >\n";
echo "setup_temp_i_id('$temp_i_id');\n";
echo "setup_temp_ch('$temp_ch');\n";
echo "chara_make_view('$wog_arry[total_point]');\n";
echo "</script>\n";
}
function chara_save($bbs_id) //储存新增角色
{
global $DB_site,$_POST,$wog_arry,$lang,$forum_message;
$errormessage="";
if(!isset($_POST["id"]) || !isset($_POST["pass"]) || !isset($_POST["sex"]) || !isset($_POST["s"]) || !isset($_POST["email"]) || !isset($_POST["birth"]))
{
$errormessage.=$lang['wog_act_chara_errdata'];
}
if(empty($_POST["id"]) || empty($_POST["pass"]) || empty($_POST["sex"]) || empty($_POST["s"]) || empty($_POST["email"]) )
{
$errormessage.=$lang['wog_act_chara_errdata'];
}
if (eregi("[<>'\", ;]", $_POST["id"]) || eregi("[<>'\", ]", $_POST["pass"]) || eregi("[<>'\", ;]", $_POST["sat_name"]))
{
$errormessage.=$lang['wog_act_errword'];
}
if((int)$_POST["str"]<=0 || (int)$_POST["smart"]<=0 || (int)$_POST["agl"]<=0 || (int)$_POST["life"]<=0 )
{
$errormessage.=$lang['wog_act_chara_errpoint'];
}
if( ((int)$_POST["str"]+(int)$_POST["smart"]+(int)$_POST["agl"]+(int)$_POST["life"]) > $wog_arry["total_point"] )
{
$errormessage.=$lang['wog_act_chara_fulpoint'].$wog_arry["total_point"].",";
}
if((int)$_POST["ch"] > 8)
{
$errormessage.=$lang['wog_act_chara_errjob'];
}
if((int)$_POST["birth"] > 3)
{
$errormessage.=$lang['wog_act_chara_errdata'];
}
if($p=$DB_site->query_first("select p_id from wog_player where p_name='".trim($_POST["id"])."'"))
{
$errormessage.=$lang['wog_act_chara_usedid'];
}
if(empty($forum_message))
{
if($p=$DB_site->query_first("select count(p_id) as p_id from wog_player where p_email='".trim($_POST["email"])."'"))
{
if($wog_arry["player_num"] <= $p[0])
{
$errormessage.=$lang['wog_act_chara_fulnum'];
}
}
}
if(!empty($forum_message))
{
if($p=$DB_site->query_first("select count(p_bbsid) as p_bbsid from wog_player where p_bbsid=".$bbs_id.""))
{
if($wog_arry["player_num"] <= $p[0])
{
$errormessage.=$lang['wog_act_chara_fulnum'];
}
}
}
if(empty($errormessage))
{
// srand ((float) microtime() * 10000000); //php 4.2 以上可以不用
$luck=rand(1,10);
$DB_site->query("insert into wog_player(p_name,p_at,p_df,p_mat,p_mdf,p_s
,p_url,p_homename,p_str,p_life,p_vit,p_smart,p_agl,p_au,p_be,p_hp,p_luck,p_sat_name
,p_hpmax,ch_id,p_money,p_lv,p_exp,p_nextexp,p_sex
,p_password,i_img,p_cdate,p_email,p_online_time,p_bbsid,p_birth
)values('".htmlspecialchars(trim($_POST["id"]))."',".($_POST["str"]+8).",".($_POST["life"]+8).
",".($_POST["smart"]+8).",".($_POST["smart"]+8).",".$_POST["s"].",'".$_POST["url"]."','".$_POST["site"]."'
,".($_POST["str"]+8).",".($_POST["life"]+8).",8,".($_POST["smart"]+8).",".($_POST["agl"]+8).",8,8
,45,".$luck.",'".htmlspecialchars(trim($_POST["sat_name"]))."',45,".$_POST["ch"].",2000,1
,0,1000,'".$_POST["sex"]."','".$_POST["pass"]."'
,".$_POST["i_id"].",".time().",'".htmlspecialchars(trim($_POST["email"]))."',".time().",".$bbs_id.",".$_POST["birth"]."
)");
$user_id=$DB_site->insert_id();
$DB_site->query("insert into wog_item(p_id,a_id,d_body_id,d_foot_id,d_hand_id,d_head_id,d_item_id
)values(".$user_id.",'','','','','','')");
$DB_site->query("insert into wog_ch_exp(p_id)values(".$user_id.")");
}else
{
alertWindowMsg($errormessage);
}
unset($errormessage);
setcookie("wog_cookie",$user_id);
setcookie("wog_key",$key);
setcookie("wog_cookie_name",trim($_POST["id"]));
setcookie("wog_bbs_id",$bbs_id);
setcookie("wog_cookie_debug",md5($user_id.$bbs_id.$wog_arry[cookie_debug]));
$this->show_chara($user_id,$bbs_id,1);
showscript("parent.peolist.document.location.reload()");
}
function login($bbs_id,$p_ip)
{
global $DB_site,$_POST,$wog_arry,$lang,$forum_message;
if (eregi("[<>'\", ]", $_POST["id"]) || eregi("[<>'\", ]", $_POST["pass"]))
{
alertWindowMsg($lang['wog_act_errword']);
}
$p=$DB_site->query("select p_id from wog_player where p_online_time < ".(time()-($wog_arry["del_day"]*24*60*60))." and p_st <= 0"); //删除角色
while($ps=$DB_site->fetch_array($p))
{
$this->kill_sub($ps["p_id"]);
}
$p=$DB_site->query_first("select p_id,p_name,p_lock,p_bbsid,p_st,p_lock_time from wog_player where p_name='".$_POST["id"]."' and p_password='".$_POST["pass"]."' ");
if($p)
{
if($p[p_lock]==1)
{
$lock_time=$p[p_lock_time]+($wog_arry["unfreeze"]*60*60);
if($lock_time>time())
{
alertWindowMsg($lang['wog_act_chara_nologin']);
}else
{
$sql="update wog_player set p_key='',p_lock=0,p_attempts=0 where p_id=".$p[p_id];
$DB_site->query($sql);
}
}
if(!empty($forum_message))
{
if($p[p_bbsid]!=$bbs_id)
{
alertWindowMsg($lang['wog_act_chara_error_creatid']);
}
$datecut = time() - $wog_arry["offline_time"];
$check_time=$DB_site->query_first("select p_online_time from wog_player where p_bbsid=".$bbs_id." and p_online_time > $datecut and p_id<>".$p[p_id]."");
if($check_time)
{
alertWindowMsg($lang['wog_act_chara_sameid']);
}
}
if($p[p_st]==0)
{
$datecut = time() - $wog_arry["offline_time"];
$online=$DB_site->query_first("select count(p_name) as num from wog_player where p_online_time > $datecut");
if($online[num]>=$wog_arry["online_limit"])
{
showscript("parent.incd(".$wog_arry["login_time"].")");
}
}
$m_item=$DB_site->query_first("select a.m_id,a.m_area_id from wog_mission_main a,wog_mission_book b where b.p_id=".$p[p_id]." and b.m_status=0 and a.m_id=b.m_id");
setcookie("wog_cookie",$p[p_id]);
setcookie("wog_cookie_name",$p[p_name]);
setcookie("wog_bbs_id",$bbs_id);
setcookie("wog_cookie_debug",md5($p[p_id].$bbs_id.$wog_arry[cookie_debug]));
setcookie("wog_cookie_mission_id",$m_item["m_id"]);
setcookie("wog_cookie_mission_area",$m_item["m_area_id"]);
$this->show_chara($p[p_id],$bbs_id,1);
$sql="update wog_player set p_ipadd='".$p_ip."' where p_id=".$p[p_id];
$DB_site->query($sql);
showscript("parent.peolist.document.location.reload()");
}else
{
alertWindowMsg($lang['wog_act_chara_errlogin']);
}
unset($p);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -