- 精华
- 阅读权限
- 20
- 好友
- 相册
- 分享
- 听众
- 收听
- 注册时间
- 2014-7-20
- 在线时间
- 小时
- 最后登录
- 1970-1-1
|
发表于 2014-7-23 15:14:43
|
显示全部楼层
这个服务器端端网站端口存在问题,注册网页reg.php采用连接数据库端代码是mysql的,实际使用数据库端是sql server2008的,所以注册不了,下面列出修改代码,直接记事本打开reg.php全选覆盖,红字处是数据库的名称,自己架设服务器端话要改,RU001是计算机名。
//register page by Ac777 to RustyHearts
$connectionInfo = array('UID' => 'se', 'PWD' => '123456a', 'Database' => 'RustyHearts_Auth');
$conn = sqlsrv_connect( 'RU001\SQLEXPRESS', $connectionInfo);
$name = $_POST['name'];
$pass = $_POST['password'];
$pass2 = $_POST['password2'];
$br= getenv("REMOTE_ADDR");
$str_len1 = strlen($name);
$str_len2 = strlen($pass);
if ($pass != $pass2){
echo "<center><font color=red>两次密码输入不匹配</font color></center>";
include("index.html");
exit();}
if ($str_len1 <= 0){
echo "<center><font color=red><font size =2>输入你的帐号</font size></font color></center>";
include("index.html");
exit();}
if ($str_len2 <= 0){
echo "<center><font color=red><font size =2>输入你的密码</font size></font color></center>";
include("index.html");
exit();}
if ($str_len1 < 4){
echo "<center><font color=red><font size =2>字符比如大于等于4位</font size></font color></center>";
include("index.html");
exit();}
if ($str_len2 < 4){
echo "<center><font color=red><font size =2>字符比如大于等于4位</font size></font color></center>";
include("index.html");
exit();}
if ($str_len1 > 12){
echo "<center><font color=red><font size =2>字符比如小于等于12位</font size></font color></center>";
include("index.html");
exit();}
if ($str_len2 > 12){
echo "<center><font color=red><font size =2>字符比如小于等于12位</font size></font color></center>";
include("index.html");
exit();}
if (!preg_match("#^[a-z0-9]+$#i", $name)){
echo "<center><font color=red><font size =2>只能输入数字或英文</font size></font color></center>";
include("index.html");
exit();}
if (!preg_match("#^[a-z0-9]+$#i", $pass)){
echo "<center><font color=red><font size =2>只能输入数字或英文</font size></font color></center>";
include("index.html");
exit();}
$checkuser = sqlsrv_query($conn,"SELECT WindyCode FROM AuthTable WHERE WindyCode='$name'");
$name_exist = sqlsrv_num_rows($checkuser);
if($name_exist > 0){
echo "<center><font color=red><font size =2>数据已经存在</font size></font color></center>";
include("index.html");
exit();}
$pass1 = md5($name . "" . $pass) ;
$pass3 = substr($pass1,0,8)."-".substr($pass1,8,4)."-".substr($pass1,12,4)."-".substr($pass1,16,4)."-".substr($pass1,20);
$pass4 = "\{$pass3}" ;
$pass4 = substr($pass4, 1);
$query1 = "INSERT AuthTable( WindyCode ,world_id ,AuthID ,Tcount ,online ,CTime ,BTime ,LTime ,IP ,LCount ,ServerIP ,ServerType ,HostID ,DBCIndex ,InquiryCount ,event_inquiry ,CashMileage)
VALUES('$name' ,0 ,'$pass4' ,0 ,0 ,getdate(),getdate(),getdate(),'$br' ,0 ,0 ,0 ,0 ,0 ,5 ,1 ,0)";
sqlsrv_query($conn,$query1) or die(sqlsrv_errors());
sqlsrv_close($conn);
echo "<center><font color=green><font size =2>注册成功</font size></font color></center>";
?>
|
|