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)