Reg page issues

08/06/2009 20:04 twiggy345#1
My registration was working until I uploaded it to my webpage. Now Its not connecting to quary analyzer to add the information to the database. I tried my local Ip address and also my himachi ip address but neither of them are working. if someone can point me in the right direction I'd really appreciate it
08/06/2009 20:13 ҉ THT ҉#2
send the script so we can check
08/07/2009 10:12 twiggy345#3
Its the original reg page that Sergcool/Tomik had released. it was working fine until I transfered it with a ftp to my website and put in my himachi server ip it didnt work and tried my local ip address. After filling out the reg page, when I hit submit it just goes to a white screen. Do I have to do some scripting to make it work or how do I learn what IP address will recieve the packet in. I also forwarded my port 80 in my router.

heres the scripts that im using tho.

this is my register.php file:

<?php

require_once "config.inc.php";

if(isset($_SESSION[step2]) && isset($_POST[step2])) {
//提取的最后一步
$errorStr = formStep3();
if($errorStr!=null){
require_once('register.html');
}else{
require_once('success.html');
$suc=$success;
unset($_SESSION[step2], $_SESSION[step1]);
}}
else {
//注册的第二步
require_once('register.html');
$_SESSION[step2] = 1; }


//判断用户提交的表单的数据的 准确性 和 保存提交数据 的函数
function formStep3(){
$errors = array();
$errorStr = null;
//查询用户名是否存在
$strSql="select * from Tbl_user where user_id='$_POST[username]'";
if ($_POST[ZoneGroup]=="zone1") {
$account_odbc = odbc_connect('account','********','*****');
} elseif ($_POST[ZoneGroup]=="zone2") {
$account_odbc = odbc_connect('account2','********','*****');
} else {
die ("<p><b>分区选择错误!</b></p>");
}
$user_result=odbc_do($account_odbc,$strSql);
$result_query=odbc_fetch_row($user_result);
if (odbc_result($user_result,1)!= "") $errors[] = "该名称已�*被占用,请重新输入";
//验证用户名是否规范
if(!preg_match("/^[0-9a-zA-Z]{6,12}$/i", $_POST[username])) $errors[]="只能用英文大小写字母数字的组合作为用户名";
//验证用户名长度
if(strlen($_POST[username])<6) $errors[] = "用户名的长度不能小于6位";
if(strlen($_POST[username])>12) $errors[]= "用户名的长度不能超过12位";
//验证密码是否规范
if(!preg_match("/^[0-9a-zA-Z]{6,12}$/i", $_POST[password1])) $errors[]="只能用英文大小写字母数字的组合作为密码";
if(preg_match("/^[0-9]{6,12}$/i",$_POST[password1])) $errors[]="不可使用纯数字作为密码";
//验证用户名和密码是否相同
if($_POST[username]==$_POST[password1]) $errors[]= "帐号和密码不能相同";
//验证密码长度
if(strlen($_POST[password1])<6) $errors[] = "密码的长度不能小于6位";
if(strlen($_POST[password1])>12) $errors[] = "密码长度不能大于12位";
//验证密码一致性
if($_POST[password2]!=$_POST[password1]) $errors[] = "输入的密码不一致";
//验证找回密码问题答案长度
if(strlen($_POST[question])>20) $errors[] = "找回密码问题大于20位,请返回重新输入";
if(strlen($_POST[question])<10) $errors[] = "找回密码问题小于10位,请返回重新输入";
if(strlen($_POST[answer])>20) $errors[] = "找回密码答案大于20位,请返回重新输入";
if(strlen($_POST[answer])<10) $errors[] = "找回密码答案小于10位,请返回重新输入";
//验证用户email正确性
if(!preg_match("/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/i",$_POST[mail])) $errors[]="Email地址不正确,请重新输入正确的Email地址";


//错误信息输出
if(sizeof($errors)>0){
$errorStr .= "<br><font>";
$errorStr .= "信息输入错误:";
foreach($errors as $error)
$errorStr .= "<li>$error</li>";
$errorStr .= "</font><br><br>";
}else{

//加密密码
$passwd_user=md5($_POST[password1]);
//获取user_no
$dk_time=strftime("%y%m%d%H%M%S");
list($usec1, $sec1) = explode(" ",microtime());
$dk_user_no=$dk_time.substr($usec1,2,2);
//用户注册语句
$dk_account_query="insert into user_profile(user_no,user_id,user_pwd,resident_no, user_type,login_flag,login_tag,ipt_time,login_time ,logout_time,user_ip_addr,server_id) values('$dk_user_no','$_POST[username]','$passwd_user','801011000000','1','0','Y','01/01/2006 00:00:00',null,null,null,'000')";
//用户资料保存
$dk_account_query2="insert into Tbl_user(user_no,user_id,user_pwd,user_mail,user_a nswer,user_question) values('$dk_user_no','$_POST[username]','$_POST[password1]','$_POST[mail]','$_POST[answer]','$_POST[question]')";
//执行用户注册和资料保存语句
$dk_account_result1=odbc_do($account_odbc,$dk_acco unt_query);
$dk_account_result2=odbc_do($account_odbc,$dk_acco unt_query2);
odbc_close($account_odbc);



}
//返回错误消息到页面
return $errorStr;
}

and this is the config.inc.php

<?php

//开始session
session_start();

//设置不进行本地缓存
header('Expires: '.date('D,d M Y H:i:s',mktime(0,0,0,1,1,2000)).' GMT');
header('Last-Modified:'.gmdate('D,d M Y H:i:s').' GMT');
header('Cache-control: private, no-cache,must-revalidate');
header('Pragma: no-cache');

$db_name="account";
$db_host="127.0.0.1";
$db_user="********";
$db_pwd="********";
?>

Then password.php:

<?php

require_once "config.inc.php";

if(isset($_SESSION[step2]) && isset($_POST[step2])) {
//注册的最后一步
$errorStr = formStep3();
if($errorStr!=null){
require_once('password-1.html');
}else{
$success="成功给角色:$_POST[user_name]提升到$_POST[level]级";
require_once('password-2.html');
unset($_SESSION[step2], $_SESSION[step1]);
}}
else {
//注册的第二步
require_once('password-1.html');
$_SESSION[step2] = 1; }

//判断用户提交的表单的数据的 准确性 和 保存提交数据 的函数
function formStep3(){
$errors = array();
$errorStr = null;

//查询用户名是否存在
if (strlen($_POST[username])<1) {
$errors[] = "请输入用户名";
}
else {
$strSql="select * from Tbl_user where user_id='$_POST[username]'";
if ($_POST[ZoneGroup]=="zone1") {
$account_odbc = odbc_connect('account','******r','******');
} elseif ($_POST[ZoneGroup]=="zone2") {
$account_odbc = odbc_connect('account2','******','******');
} else {
die ("<p><b>分区选择错误!</b></p>");
}
$user_result=odbc_do($account_odbc,$strSql);
$result_query=odbc_fetch_row($user_result);
$pwdsql="select user_pwd from account.dbo.user_profile where user_id='$_POST[username]'";
$pwd_result=odbc_do($account_odbc,$pwdsql);
$pwd_result_query=odbc_fetch_row($pwd_result);
if (odbc_result($pwd_result,1)=="lock") {
die ("<p><b>用户账号已被封停!</b></p>");}

if (odbc_result($user_result,2)=="") $errors[] = "用户不存在";
//验证邮箱及找回密码问题答案正确性
if (odbc_result($user_result,4)!= $_POST[mail]) $errors[]="邮箱资料错误";
if (odbc_result($user_result,5)!= $_POST[answer] or odbc_result($user_result,6)!= $_POST[question]) $errors[]="密码提示和答案错误,请重新输入";
//验证密码是否规范
if(!preg_match("/^[0-9a-zA-Z]{6,12}$/i", $_POST[newpwd1])) $errors[]="只能用英文大小写字母数字的组合作为密码";
if(preg_match("/^[0-9]{6,12}$/i",$_POST[password1])) $errors[]="不可使用纯数字作为密码";
//验证用户名和密码是否相同
if($_POST[username]==$_POST[password1]) $errors[]= "帐号和密码不能相同";
//验证密码长度
if(strlen($_POST[newpwd1])<6) $errors[] = "密码的长度不能小于6位";
if(strlen($_POST[newpwd1])>12) $errors[] = "密码长度不能大于12位";
//验证密码一致性
if($_POST[newpwd2]!=$_POST[newpwd1]) $errors[] = "输入的密码不一致";
$password=md5($_POST[newpwd2]);
}
//错误信息输出
if(sizeof($errors)>0){
$errorStr .= "<br><font>";
$errorStr .= "错误信息:";
foreach($errors as $error)
$errorStr .= "<li>$error</li>";
$errorStr .= "</font><br><br>";
}else{
//用户修改密码语句
$repasswd_query="UPDATE user_profile SET user_pwd='$password' WHERE user_id='$_POST[username]'";
//用户资料保存处密码修改
$repasswd_query2="UPDATE Tbl_user SET user_pwd='$_POST[newpwd2]' WHERE user_id='$_POST[username]'";
//执行用户修改密码语句
$dk_account_result=odbc_do($account_odbc,$repasswd _query);
$dk_account_result=odbc_do($account_odbc,$repasswd _query2);
odbc_close($account_odbc);


}
//返回错误消息到页面
return $errorStr;
}

?>

and last is the map.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>用户查询</title>
<style type="text/css">
<!--
.STYLE2 {
font-size: x-large;
font-weight: bold;
color: #FF0000;
}
-->
</style>
</head>

<body>
<div align="center">
<?php if ( empty( $_POST['btnSubmit'] ) ) { ?>
<span class="STYLE2">把卡住的人物拖出来</span></div>
<form id="form1" name="form1" method="post" action="">
<table align="center" id="frmTable">
<tr>
<th colspan="2">填写角色名</th>
</tr>
<tr>
<td>角色名:</td>
<td><input name="Character_name" type="text" id="Character_name" /></td>
</tr>

<tr>
<td valign="top">&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input name="btnSubmit" type="submit" id="btnSubmit" value="提交" />
&nbsp;
<input type="reset" name="Submit2" value="重置" /></td>
</tr>
</table>
</form>
<?php } else {
if ( empty ( $_POST[Character_name] ) ) {
die ( "<p><b>用户名不能为空!</b></p>" );
}
$strSql1="select character_no from character.dbo.user_character where character_name='$_POST[Character_name]'";
$character_odbc = odbc_connect('account','********','******');
$character_result=odbc_do($character_odbc,$strSql1 );
odbc_fetch_row($character_result);
$character_no=odbc_result($character_result,1);
if ( $character_no== null) { die ( "<p><b>无此玩家!</b></p>" );}


$strSql2="update character.dbo.user_character set wPosX=232,wPosY=158,wMapIndex=0 where character_name='$_POST[Character_name]'";
$character_result=odbc_do($character_odbc,$strSql2 );
odbc_close($character_odbc);

?>
<table width="324" border="1" align="center" cellpadding="3" id="showTable">
<tr> <td colspan="2"><div align="center">操作成功</div></td>
</tr>
<tr>
<td colspan="2"><div align="center"><a href="index.html">返回菜单</a></div></td>
</tr>
</table>
<?php } ?>
</body>
</html>

I know that My server name and pass is right because i can register thru Xampp with it on local. Any help will get thanks and be appreciated.
08/07/2009 11:35 janvier123#4
if iam not mistaken you need this script running on localhost
(use iframe, or php include)

i have no idea if you change config.inc.php
$db_host="127.0.0.1";
to your IP
08/07/2009 17:08 twiggy345#5
Quote:
Originally Posted by janvier123 View Post
if iam not mistaken you need this script running on localhost
(use iframe, or php include)

i have no idea if you change config.inc.php
$db_host="127.0.0.1";
to your IP
its running on my local server and i can access it and register people. I just want the players to be able to register themselves.
08/07/2009 17:35 janvier123#6
ive said it before
do a port check on port 80
or if you running teamviewer port 80 is in use so try to use port 8080
and check with your provider is port 80 is blocked (mine does from port 0 - 1024)
08/07/2009 17:40 twiggy345#7
ok ill check tyvm
08/08/2009 04:21 pandragon#8
I don't know if this helps you (if nothing else works, give it a shot)

-Host register.html, register.php and config.inc.php on the machine you have your server (perf xamp)
-Create ODBC for account database named account (you can create ODBC from your windows Control Panel)
-Change $db_host="127.0.0.1"; to $db_host="localhost"; (maybe this fixes it, worked for me)
-Link register.php, from your database machine to your new website host page (registration files hosted on server and website hosted on random website provider)