How to set up a site where people can register?

09/15/2009 20:25 Xemaroth#1
Well, I finally got the server working, but now how to get the register working, I downloaded the register files from the sticky thread but no idea how to get it set up right.

I don't exactly know all the info it's asking for in the register.php and the config.php

If someone could tell me or put it into more detail of what goes where then I could get past this problem.

Config.php
Code:
<?php
	
	// Configurations
	$myhost="65.75.250.41";
	$mypass="binhazad"; 		//your server login password
	$myuser="necron"; 		//your server login username
	$mydbacc="account";		//your server account database
	$mydbdata="MY";			//your server my database name
	$serveraddress="65.75.250.41"; 	//your server ip
	$accport=9958;		//your ACC connection port
        $msgport=5816;		//your MSG connection port
        $npcport=9958;		//your MSG connection port
	$servername="Alpha-0nline"; 	//your server name
	$mydb="MY";			//your server my database
	$forum="127.0.0.1";
        $mydb = "MY"; //your server my database
        

	// Dont Edit after this
	mysql_connect($myhost,$myuser,$mypass);
	mysql_select_db($mydb);
?>
Register.php
Code:
<?
$myhost="65.75.250.41";
	$mypass="binhazad"; 		//your server login password
	$myuser="necron"; 		//your server login username
	$mydbacc="account";		//your server account database
	$mydbdata="MY";			//your server my database name
	$serverport=3306;		//your server connection port
	$mydb="MY";			//your server my database
	$servername="Alpha-Online";
	// Dont Edit after this
	mysql_connect($myhost,$myuser,$mypass);
	mysql_select_db($mydb);
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>My Server Register</title>
<script type="text/javascript" src="./inc/md5.js"></script>
</head>
<DIV align="center"><b class="h2"><font color="white">
 <?php
	echo "Welcome to ".$servername." Account Registration";
 ?>
</b>
<br />

<br />
<form method='post' action='register.php'>
      <TABLE width="312">
        <TBODY>
        <TR>
          <TD id=GoodStuff style="PADDING-LEFT: 0px; MARGIN-LEFT: 0px">
            <DIV id=theform style="PADDING-LEFT: 0px">
            <TABLE class=body width="323" height="229">
              <TBODY>
              <TR>
                <TD align="left" height="32"><font color="white">UserID:</TD>
                <TD class=it3 height="32">
				<INPUT class=it style="FONT-SIZE: 9pt" name="id" id="id">				</TR>
              <TR>
                <TD align="left" height="37"><font color="white">Password:</TD>
                <TD class=it3 height="37">
				<INPUT class=it id="ipassword" style="FONT-SIZE: 9pt" type=password maxLength=12 name=pass></TD>
                </TR>
              <TR>
                <TD align="left" height="32"><font color="white">Retype Password:</TD>
                <TD class=it3 height="32">
				<input class=it1 id="ipassword" style="FONT-SIZE: 9pt" type=password maxlength=12 name=retpass></TD>
                </TR>
                <TD align="left" height="32"><font color="white">Email:</TD>
                <TD class=it3 height="32">
				<INPUT class=it style="FONT-SIZE: 9pt" name=email>
                <TR>
                <TD></TD>
                <TD style="FONT-SIZE: 14px; VERTICAL-ALIGN: middle">
				<span style="font-size: 9pt"><input type="hidden" name="hash"><input class=Butt type=submit onclick="hash.value = login(pass.value)" value='Register' name=B1></span></TD>
                </TR></TBODY></TABLE>
            </DIV></TD></TR></TBODY></TABLE></FORM>
			<center>
			<?php
			if($_POST['B1'])
					{
					mysql_select_db($mydbacc);
					$userid = trim($_POST['id']);
					$password=trim($_POST['pass']);
					$passretype=trim($_POST['retpass']);
					$hash=$_POST['hash'];
					$email=trim($_POST['email']);

				if($password != $passretype) {
							echo "Password not equal to Retyped Password.";
						}else{
							if(!ereg("^[0-9a-zA-Z]{4,12}$",$password))
							{
								echo "Only letters or numbers, length of 4 to 12 characters";
							}
							else
							{
								$res = mysql_query("select * from account where name = '".$userid."' order by id desc");
								if(mysql_num_rows($res) == 0)
								{
									mysql_query("insert into account (name,Password,Reg_date,email) values ('".$userid."','".$hash."','".date("y-m-d H:i:s", time())."','".$email."')");
									echo "Account registered successfully.";
								}
								else
								{
									echo "Account Already exists in database.";
								}
							}
						}


						}

			?>
			</center>
</DIV>
</body>
</html>
09/16/2009 06:26 mama020153#2
Should Look like this
Config.php
Code:
<?php
	
	// Configurations
	$myhost="65.75.250.41";
	$mypass="binhazad"; 		//your server login password
	$myuser="necron"; 		//your server login username
	$mydbacc="jz_acc";		//your server account database
	$mydbdata="jz";			//your server my database name
	$serveraddress="65.75.250.41"; 	//your server ip
	$accport=9958;		//your ACC connection port
        $msgport=5816;		//your MSG connection port
        $npcport=9958;		//your MSG connection port
	$servername="Alpha-0nline"; 	//your server name
	$mydb="MY";			//your server my database
	$forum="127.0.0.1";
        $mydb = "MY"; //your server my database
        

	// Dont Edit after this
	mysql_connect($myhost,$myuser,$mypass);
	mysql_select_db($mydb);
?>
Should Look like this

Register.php
Code:
<?
$myhost="65.75.250.41";
	$mypass="binhazad"; 		//your server login password
	$myuser="necron"; 		//your server login username
	$mydbacc="jz-acc";		//your server account database
	$mydbdata="jz";			//your server my database name
	$serverport=3306;		//your server connection port
	$mydb="MY";			//your server my database
	$servername="Alpha-Online";
	// Dont Edit after this
	mysql_connect($myhost,$myuser,$mypass);
	mysql_select_db($mydb);
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>My Server Register</title>
<script type="text/javascript" src="./inc/md5.js"></script>
</head>
<DIV align="center"><b class="h2"><font color="white">
 <?php
	echo "Welcome to ".$servername." Account Registration";
 ?>
</b>
<br />

<br />
<form method='post' action='register.php'>
      <TABLE width="312">
        <TBODY>
        <TR>
          <TD id=GoodStuff style="PADDING-LEFT: 0px; MARGIN-LEFT: 0px">
            <DIV id=theform style="PADDING-LEFT: 0px">
            <TABLE class=body width="323" height="229">
              <TBODY>
              <TR>
                <TD align="left" height="32"><font color="white">UserID:</TD>
                <TD class=it3 height="32">
				<INPUT class=it style="FONT-SIZE: 9pt" name="id" id="id">				</TR>
              <TR>
                <TD align="left" height="37"><font color="white">Password:</TD>
                <TD class=it3 height="37">
				<INPUT class=it id="ipassword" style="FONT-SIZE: 9pt" type=password maxLength=12 name=pass></TD>
                </TR>
              <TR>
                <TD align="left" height="32"><font color="white">Retype Password:</TD>
                <TD class=it3 height="32">
				<input class=it1 id="ipassword" style="FONT-SIZE: 9pt" type=password maxlength=12 name=retpass></TD>
                </TR>
                <TD align="left" height="32"><font color="white">Email:</TD>
                <TD class=it3 height="32">
				<INPUT class=it style="FONT-SIZE: 9pt" name=email>
                <TR>
                <TD></TD>
                <TD style="FONT-SIZE: 14px; VERTICAL-ALIGN: middle">
				<span style="font-size: 9pt"><input type="hidden" name="hash"><input class=Butt type=submit onclick="hash.value = login(pass.value)" value='Register' name=B1></span></TD>
                </TR></TBODY></TABLE>
            </DIV></TD></TR></TBODY></TABLE></FORM>
			<center>
			<?php
			if($_POST['B1'])
					{
					mysql_select_db($mydbacc);
					$userid = trim($_POST['id']);
					$password=trim($_POST['pass']);
					$passretype=trim($_POST['retpass']);
					$hash=$_POST['hash'];
					$email=trim($_POST['email']);

				if($password != $passretype) {
							echo "Password not equal to Retyped Password.";
						}else{
							if(!ereg("^[0-9a-zA-Z]{4,12}$",$password))
							{
								echo "Only letters or numbers, length of 4 to 12 characters";
							}
							else
							{
								$res = mysql_query("select * from account where name = '".$userid."' order by id desc");
								if(mysql_num_rows($res) == 0)
								{
									mysql_query("insert into account (name,Password,Reg_date,email) values ('".$userid."','".$hash."','".date("y-m-d H:i:s", time())."','".$email."')");
									echo "Account registered successfully.";
								}
								else
								{
									echo "Account Already exists in database.";
								}
							}
						}


						}

			?>
			</center>
</DIV>
</body>
</html>
09/16/2009 13:39 Xemaroth#3
Thanks, but the problem is still there, I don't see the account in the database.
Heres the setup of the files. (The *** are parts I have choosen to hide.)

Code:
<?php
	
	// Configurations
	$myhost="192.168.1.3";
	$mypass="***"; 		//your server login password
	$myuser="***"; 		//your server login username
	$mydbacc="jz_acc";		//your server account database
	$mydbdata="jz";			//your server my database name
	$serveraddress="192.168.1.3"; 	//your server ip
	$accport=9958;		//your ACC connection port
        $msgport=5816;		//your MSG connection port
        $npcport=9958;		//your MSG connection port
	$servername="Zero"; 	//your server name
	$mydb="jz";			//your server my database
	$forum="***";
        $mydb = "jz"; //your server my database
        

	// Dont Edit after this
	mysql_connect($myhost,$myuser,$mypass);
	mysql_select_db($mydb);
?>

Code:
<?
$myhost="192.168.1.3";
	$mypass="***"; 		//your server login password
	$myuser="***"; 		//your server login username
	$mydbacc="jz_acc";		//your server account database
	$mydbdata="jz";			//your server my database name
	$serverport=3306;		//your server connection port
	$mydb="jz";			//your server my database
	$servername="Zero";
	// Dont Edit after this
	mysql_connect($myhost,$myuser,$mypass);
	mysql_select_db($mydb);
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>My Server Register</title>
<script type="text/javascript" src="./inc/md5.js"></script>
</head>
<DIV align="center"><b class="h2"><font color="white">
 <?php
	echo "Welcome to ".$servername." Account Registration";
 ?>
</b>
<br />

<br />
<form method='post' action='register.php'>
      <TABLE width="312">
        <TBODY>
        <TR>
          <TD id=GoodStuff style="PADDING-LEFT: 0px; MARGIN-LEFT: 0px">
            <DIV id=theform style="PADDING-LEFT: 0px">
            <TABLE class=body width="323" height="229">
              <TBODY>
              <TR>
                <TD align="left" height="32"><font color="black">UserID:</TD>
                <TD class=it3 height="32">
				<INPUT class=it style="FONT-SIZE: 9pt" name="id" id="id">				</TR>
              <TR>
                <TD align="left" height="37"><font color="black">Password:</TD>
                <TD class=it3 height="37">
				<INPUT class=it id="ipassword" style="FONT-SIZE: 9pt" type=password maxLength=12 name=pass></TD>
                </TR>
              <TR>
                <TD align="left" height="32"><font color="black">Retype Password:</TD>
                <TD class=it3 height="32">
				<input class=it1 id="ipassword" style="FONT-SIZE: 9pt" type=password maxlength=12 name=retpass></TD>
                </TR>
                <TD align="left" height="32"><font color="black">Email:</TD>
                <TD class=it3 height="32">
				<INPUT class=it style="FONT-SIZE: 9pt" name=email>
                <TR>
                <TD></TD>
                <TD style="FONT-SIZE: 14px; VERTICAL-ALIGN: middle">
				<span style="font-size: 9pt"><input type="hidden" name="hash"><input class=Butt type=submit onclick="hash.value = login(pass.value)" value='Register' name=B1></span></TD>
                </TR></TBODY></TABLE>
            </DIV></TD></TR></TBODY></TABLE></FORM>
			<center>
			<?php
			if($_POST['B1'])
					{
					mysql_select_db($mydbacc);
					$userid = trim($_POST['id']);
					$password=trim($_POST['pass']);
					$passretype=trim($_POST['retpass']);
					$hash=$_POST['hash'];
					$email=trim($_POST['email']);

				if($password != $passretype) {
							echo "Password not equal to Retyped Password.";
						}else{
							if(!ereg("^[0-9a-zA-Z]{4,12}$",$password))
							{
								echo "Only letters or numbers, length of 4 to 12 characters";
							}
							else
							{
								$res = mysql_query("select * from account where name = '".$userid."' order by id desc");
								if(mysql_num_rows($res) == 0)
								{
									mysql_query("insert into account (name,Password,Reg_date,email) values ('".$userid."','".$hash."','".date("y-m-d H:i:s", time())."','".$email."')");
									echo "Account registered successfully.";
								}
								else
								{
									echo "Account Already exists in database.";
								}
							}
						}


						}

			?>
			</center>
</DIV>
</body>
</html>
09/17/2009 00:22 mama020153#4
are you usein jz_acc or account ? if jz_acc did you give it permission in Navicat ? same for account and if you are not useing jz_acc you need to change it in the config of both files....
09/17/2009 10:35 Xemaroth#5
Quote:
Originally Posted by mama020153 View Post
are you usein jz_acc or account ? if jz_acc did you give it permission in Navicat ? same for account and if you are not useing jz_acc you need to change it in the config of both files....
Yes I am using jz_acc and I did give it permissions.

[Only registered and activated users can see links. Click Here To Register...]

As you can see I in the picture I gave the account permissions, I gave them permissions to do everything.
09/17/2009 20:28 mama020153#6
then it should work and the ip should be 127.0.0.1 not your ip try that...
09/18/2009 05:37 Xemaroth#7
Ok thanks it works now, it actually is adding the accounts to the database now, but now I'm getting a error when I try and login with the made account.

The error is; "Unable to connection game server. Please try again later".
10/28/2009 21:26 Marado9#8
thx guys 4 the big help hope we see moor