Can some one help me with this script of mine. ive coded this script so people can register on the register page which this script forms up, but the script is comming up with some errors which i cannot find and if i do find it another one pops up. so could an experienced scripter please help me with my issue.

the current error was Parse error: syntax error, unexpected $end in /home/my webhost (hidden for security reasons)/public_html/register.php on line 231

<?php
session_start();
include_once"includes/db_connect.php";
if (isset($_SESSION)){
header("Location: /game/play.php");
exit();
}


$referal=$_GET;


$referal2=$_POST;


$scriptcheck=$_POST;
$scriptcheck2=$_POST;
$sc=rand(111,999);


if(!$referal2){
$referal2=0;
}



if ($_POST){


// Define post fields into simple variables
$reg_username = $_POST;


$email = $_POST;
$email1 = $_POST;
$location=strip_tags($_POST);
$reg_username=trim($reg_username);


$today = gmdate('Y-m-d H:i:s');



$reg_username = stripslashes($reg_username);
$email = stripslashes($email);
$reg_username = strip_tags($reg_username);
$email = strip_tags($email);



if((!$reg_username) ||(!$reg_password) ||(!$email) || (!$location)){
$message="Please fill in all fields";
}else{
if($reg_password != $reg_password2){
$message="Passwords do not match";
}elseif ($reg_password  = $reg_password2){
if($email != $email1){
$message="Emails do not match";
}elseif ($email = $email1){
if($scriptcheck != $scriptcheck2){
print"Script check wrong!";
}else{
if (ereg('[^A-Za-z]', $reg_username)) {
$message="Your username can only contain letters.";
}elseif (!ereg('[^A-Za-z]', $reg_username)) {



if (strlen($reg_username) <= 3 || strlen($reg_username) >= 40){
$message= "password too big or small.";
}elseif (strlen($reg_username) > 3 || strlen($reg_username) < 40){


if (strlen($reg_password and $reg_password2) <= 5 || strlen($reg_password and $reg_password2) >= 15){
$message= "password too big or small.";
}elseif (strlen($reg_password and $reg_password2) > 5 || strlen($reg_password and $reg_password2) < 15){



$sql_email_check = mysql_query("SELECT email FROM users
WHERE email='$email' AND status='Alive'");
$sql_username_check = mysql_query("SELECT username FROM users
WHERE username='$reg_username'");


$email_check = mysql_num_rows($sql_email_check);
$username_check = mysql_num_rows($sql_username_check);


if(($email_check > 0) || ($username_check > 0)){
echo "Im sorry but there has been an error please read on..<br />";
if($email_check > 0){
print"Your email address has already been used by another gangster!";
unset($email);
}
if($username_check > 0){
print"Your desired username is already in use!";
unset($reg_username);
}



}else{
$ip = $_SERVER;



mysql_query("INSERT INTO `user_info` ( `id` , `username`)
VALUES (
'', '$reg_username')");


mysql_query("INSERT INTO `users` ( `id` , `username` , `password` , `money` , `regged` , `email` , `location` , `ip` , `r_ip`, `referal`)
VALUES ('', '$reg_username', '$reg_password', '10000', '$time', '$email', '$location', '$ip', '$ip', '$referal2')") or die(mysql_error);


$userid = mysql_insert_id();
// Let's mail the user!
$subject = "Modern Mobsters";
$message = "Thank you for registering at Modern Mobsters,
You can login to the game at www.rsboxx.com with the following details:
Username: $reg_username
Password: $reg_password


Thank you very much for registering


http://www.rsboxx.com staff.


Note: This is an automated email, please do not reply as you wont get response.";


mail($email, $subject, $message,
"From: Modern Mobsters<mailserver@rsboxx.com>");
echo "Your account has been registered! Check your email for your password!";
} }}}}}}


?>
<!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=iso-8859-1" />
<title>Register</title>
<link href="stylesheets/index.css" rel="stylesheet" type="text/css" />
<script language=JavaScript>
function so(dis)
{
for (i=0;i<dis.elements.length;i++){
if (dis.elements.type=='submit')
dis.elements.style.visibility='hidden';
}
if(fs==false){
fs=true;
return true;
}else
return false;
}
function goaway()
{
for(i=0;i<document.forms.length;i++)
document.forms.onsubmit = function() {return so(this);};
}
</script>
</head>


<body onLoad="goaway();">
<table border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td class="header">Modern Mobsters</td>
</tr>
<tr>
<td height="18" align="center"><div id="sectionLinks">
<a href="index.php">Home</a><a href="register.php">Register</a><a href="lostpass.php">Lost Password</a><a href="/screens.php">Screenshots</a><a href="story.php">Story Line </a></div></td>
</tr>
<tr>
<td height="300" class="main"><p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<form action="" method="post" name="form2" id="form2">
<table width="300"  border="0" align="center" cellpadding="0" cellspacing="0">


<tr>
<td width="130" height="40" class="bodytext">              Username:            </td>
<td width="57%"><input name="reg_username" type="text" id="reg_username" maxlength="40" /></td>
</tr>
<tr>
<td class="bodytext">Password:</td>
<td><input name="reg_password" type="text" id="reg_password" maxlength="15" /></td>
</tr>
<tr>
<td class="bodytext">Re-Type Password:</td>
<td><input name="reg_password2" type="text" id="reg_password2" maxlength="15" /></td>
</tr>
<tr>
<td class="bodytext">E-mail:</td>
<td><input name="email" type="text" id="email" value="" /></td>
</tr>
<tr>
<td class="bodytext">Re-Type E-mail: </td>
<td><input name="email1" type="text" id="email1" value="" /></td>
</tr>
<tr>
<td height="20" class="bodytext">Starting Location </td>
<td><select name="location" class="ddm" id="location" >
<option value="England" selected="selected">England</option>
<option value="China">China</option>
<option value="France">France</option>
<option value="Holland">Holland</option>
<option value="USA">USA</option>
<option value="Germany">Germany</option>
<option value="Canada">Canada</option>
<option value="South Africa">South Africa</option>
</select></td>
</tr>
<tr>
<td height="20" class="bodytext"><p>Script Check: <b><? print"$sc"; ?></b></p>            </td>
<td><input name="scriptcheck" type="text" id="scriptcheck" value="" />
<input type="hidden" value="<? print"$sc"; ?>" name="scrip"></td>
</tr>
<tr>
<td height="20" class="bodytext">Referal (optional) </td>
<td>
<? if(!$referal){ ?>
<input name="ref2" type="text" id="ref2" value="<? print"$referal"; ?>" maxlength="40" />
<? }else{ ?>
<input name="ref2" type="text" id="ref2" value="<? print"$referal"; ?>" maxlength="40" READONLY>
<? } ?>          </td>
</tr>
<tr>
<td>&nbsp;</td>
<td>              <input name="Submit" type="submit" class="submit" value="Register!" />            </td>
</tr>
</table>
</form>      </td>
</tr>
</table>


</td>
<td>&nbsp;</td>
<div align="center"></div>
<tr><td height="14">&nbsp;</td>
</tr>
</body>
</html>

Edited 3 Years Ago by happygeek: fixed formatting

The error you have alerts you that you have an unescape block. Simply put you have "{" but don't have "}".
Problem may be caused by structures like that:

}elseif (strlen($reg_username) > 3 || strlen($reg_username) < 40) {
if (strlen($reg_password and $reg_password2) <= 5 || strlen($reg_password and $reg_password2) >= 15){

Note you opens two blocks {...{ and you have to close two blocks }...}. Just check that every opening brace have closing brace.

Well, i kinda did what you said (i probaly miss understood) but same error pops up.

Ok, i found. You have unclosed braces at 22 and 43 lines. I think you have to add 2 closing braces more at the end of 118 line.

Get a good editor.Find all the matching braces and check if all the open braces are closed properly.

Ok, i found. You have unclosed braces at 22 and 43 lines. I think you have to add 2 closing braces more at the end of 118 line.

Hi, thx for your post. what do you mean by unclosed braces (different people have different meanings of different things).

"{" - this is opening brace
"}" - this is closing brace
Every opening brace must have closing brace after that. For example

if (true)
{   // Opening brace
     /* Code */
}  // Closing brace

"{" - this is opening brace
"}" - this is closing brace
Every opening brace must have closing brace after that. For example

if (true)
{   // Opening brace
     /* Code */
}  // Closing brace

so are my braces the wrong way around?

Yes

Well thx for the help, i just deleted the bracers instead of finishing them off, as i didnt see what they were for. so now the script works.


but now the downside is that the password wont save into the database under password in users. any help please?

You didn't defined the $reg_password variable.

what do you mean?

Here you defined some variables:

// Define post fields into simple variables 
$reg_username = $_POST['reg_username']; 

$email = $_POST['email'];
$email1 = $_POST['email1']; 
$location=strip_tags($_POST['location']); 
$reg_username=trim($reg_username);

They will be checked later.
But there is no definition of $reg_password and $reg_password2 variables. But they participate in the checking:

if((!$reg_username) ||(!$reg_password) ||(!$email) || (!$location)){ 
$message="Please fill in all fields";
}else{
if($reg_password != $reg_password2){
$message="Passwords do not match";

Just put those bold lines after definition of email variables:

$email = $_POST['email'];
$email1 = $_POST['email1']; 
[B]$reg_password = $_POST['reg_password'];
$reg_password2 = $_POST['reg_password2'];[/B]

Here you defined some variables:

// Define post fields into simple variables 
$reg_username = $_POST['reg_username']; 

$email = $_POST['email'];
$email1 = $_POST['email1']; 
$location=strip_tags($_POST['location']); 
$reg_username=trim($reg_username);

They will be checked later.
But there is no definition of $reg_password and $reg_password2 variables. But they participate in the checking:

if((!$reg_username) ||(!$reg_password) ||(!$email) || (!$location)){ 
$message="Please fill in all fields";
}else{
if($reg_password != $reg_password2){
$message="Passwords do not match";

Just put those bold lines after definition of email variables:

$email = $_POST['email'];
$email1 = $_POST['email1']; 
[B]$reg_password = $_POST['reg_password'];
$reg_password2 = $_POST['reg_password2'];[/B]

thx for this info (you probaly have already noticed im an intermediate scripter). But when i try to make an account which is to test out the script, no fields are added to the databae under users, meaning no users have been added. so their are still some problems with the script. my editor is dreamweaver, can any one spot out why i cant get this script to work?

Write "error_reporting(E_ALL);" in the begining of script and show me the output.

Holy cow!

i did what you said and all these poped up.


Notice: Undefined index: ref in /home/rsboxxc/public_html/register.php on line 10

Notice: Undefined index: ref2 in /home/rsboxxc/public_html/register.php on line 12

Notice: Undefined index: scriptcheck in /home/rsboxxc/public_html/register.php on line 14

Notice: Undefined index: scrip in /home/rsboxxc/public_html/register.php on line 15

Notice: Undefined index: Submit in /home/rsboxxc/public_html/register.php on line 23

Notice: Undefined index: email in /home/rsboxxc/public_html/register.php on line 28

Notice: Undefined index: email1 in /home/rsboxxc/public_html/register.php on line 29

Notice: Undefined index: reg_password in /home/rsboxxc/public_html/register.php on line 30

Notice: Undefined index: reg_password2 in /home/rsboxxc/public_html/register.php on line 31

Notice: Undefined index: location in /home/rsboxxc/public_html/register.php on line 32

Notice: Undefined variable: reg_username in /home/rsboxxc/public_html/register.php on line 33

Notices can be ignored. They dont cause much pain !

Oh, btw, I think you are not posting your form variables properly. Are you sure the form is posted properly and all the values are being passed from page1 to page2 ?

What prints when you submit data?

what do you mean? this is what the script looks now. with all the things you told me to add. but i delete that last bit of code you told me to add which showed error values i think you said.

<?php
session_start();
include_once"includes/db_connect.php";
if (isset($_SESSION['username'])){
header("Location: /game/play.php");
exit();
}

$referal=$_GET['ref'];

$referal2=$_POST['ref2'];

$scriptcheck=$_POST['scriptcheck'];
$scriptcheck2=$_POST['scrip'];
$sc=rand(111,999);

if(!$referal2){
$referal2=0;
}


if ($_POST['Submit'])

// Define post fields into simple variables 
$reg_username = $_POST['reg_username']; 

$email = $_POST['email'];
$email1 = $_POST['email1'];
$reg_password = $_POST['reg_password'];
$reg_password2 = $_POST['reg_password2']; 
$location=strip_tags($_POST['location']); 
$reg_username=trim($reg_username);

$today = gmdate('Y-m-d H:i:s');


$reg_username = stripslashes($reg_username); 
$email = stripslashes($email); 
$reg_username = strip_tags($reg_username); 
$email = strip_tags($email); 


if((!$reg_username) ||(!$reg_password) ||(!$email) || (!$location)){ 
$message="Please fill in all fields";
}else{
if($reg_password != $reg_password2){
$message="Passwords do not match";
}elseif ($reg_password  = $reg_password2){
}else{
if($email != $email1){
$message="Emails do not match";
}elseif ($email = $email1){
if($scriptcheck != $scriptcheck2){
print"Script check wrong!";
}else{
if (ereg('[^A-Za-z]', $reg_username)) { 
$message="Your username can only contain letters.";
}elseif (!ereg('[^A-Za-z]', $reg_username)) { 


if (strlen($reg_username) <= 3 || strlen($reg_username) >= 40){
$message= "password too big or small.";
}elseif (strlen($reg_username) > 3 || strlen($reg_username) < 40){

if (strlen($reg_password and $reg_password2) <= 5 || strlen($reg_password and $reg_password2) >= 15){
$message= "password too big or small.";
}elseif (strlen($reg_password and $reg_password2) > 5 || strlen($reg_password and $reg_password2) < 15){


$sql_email_check = mysql_query("SELECT email FROM users 
            WHERE email='$email' AND status='Alive'"); 
$sql_username_check = mysql_query("SELECT username FROM users 
            WHERE username='$reg_username'"); 

$email_check = mysql_num_rows($sql_email_check); 
$username_check = mysql_num_rows($sql_username_check); 

if(($email_check > 0) || ($username_check > 0)){ 
    echo "Im sorry but there has been an error please read on..<br />"; 
    if($email_check > 0){ 
        print"Your email address has already been used by another gangster!"; 
        unset($email); 
    } 
    if($username_check > 0){ 
        print"Your desired username is already in use!"; 
        unset($reg_username); 
    } 


}else{
$ip = $_SERVER['REMOTE_ADDR'];

$reg_password=$reg_password;
$time=time();

mysql_query("INSERT INTO `user_info` ( `id` , `username`) 
VALUES (
'', '$reg_username')");

mysql_query("INSERT INTO `users` ( `id` , `username` , `password` , `money` , `regged` , `email` , `location` , `ip` , `r_ip`, `referal`)
VALUES ('', '$reg_username', '$reg_password', '10000', '$time', '$email', '$location', '$ip', '$ip', '$referal2')") or die(mysql_error);



     $userid = mysql_insert_id();
    // Let's mail the user! 
    $subject = "Modern Mobsters"; 
    $message = "Thank you for registering at Modern Mobsters,
    You can login to the game at [url]www.rsboxx.com[/url] with the following details:
    Username: $reg_username
    Password: $reg_password



    Thank you very much for registering

    [url]http://www.rsboxx.com[/url] staff.

    Note: This is an automated email, please do not reply as you wont get response."; 

    mail($email, $subject, $message, 
        "From: Modern Mobsters<mailserver@rsboxx.com>"); }
   echo "Your account has been registered! Check your email for your password!";
   } }}}}}}

?>
<!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=iso-8859-1" />
<title>Register</title>
<link href="stylesheets/index.css" rel="stylesheet" type="text/css" />
<script language=JavaScript>
function so(dis)
{
for (i=0;i<dis.elements.length;i++){ 
    if (dis.elements[i].type=='submit')
       dis.elements[i].style.visibility='hidden';
    }
    if(fs==false){
         fs=true;
         return true;
    }else
        return false;
    }
    function goaway()
{
for(i=0;i<document.forms.length;i++)
 document.forms[i].onsubmit = function() {return so(this);};
}
</script>
</head>

<body onLoad="goaway();">
<table border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td class="header">Modern Mobsters</td>
  </tr>
  <tr>
    <td height="18" align="center"><div id="sectionLinks">
      <a href="index.php">Home</a><a href="register.php">Register</a><a href="lostpass.php">Lost Password</a><a href="/screens.php">Screenshots</a><a href="story.php">Story Line </a></div></td>
  </tr>
  <tr>
    <td height="300" class="main"><p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <form action="" method="post" name="form2" id="form2">
        <table width="300"  border="0" align="center" cellpadding="0" cellspacing="0">

          <tr>
            <td width="130" height="40" class="bodytext">              Username:            </td>
            <td width="57%"><input name="reg_username" type="text" id="reg_username" maxlength="40" /></td>
          </tr>
          <tr>
            <td class="bodytext">Password:</td>
            <td><input name="reg_password" type="text" id="reg_password" maxlength="15" /></td>
          </tr>
          <tr>
            <td class="bodytext">Re-Type Password:</td>
            <td><input name="reg_password2" type="text" id="reg_password2" maxlength="15" /></td>
          </tr>
          <tr>
            <td class="bodytext">E-mail:</td>
            <td><input name="email" type="text" id="email" value="" /></td>
          </tr>
          <tr>
            <td class="bodytext">Re-Type E-mail: </td>
            <td><input name="email1" type="text" id="email1" value="" /></td>
          </tr>
          <tr>
            <td height="20" class="bodytext">Starting Location </td>
            <td><select name="location" class="ddm" id="location" >
                <option value="England" selected="selected">England</option>
                <option value="China">China</option>
                <option value="France">France</option>
                <option value="Holland">Holland</option>
                <option value="USA">USA</option>
                <option value="Germany">Germany</option>
                <option value="Canada">Canada</option>
                <option value="South Africa">South Africa</option>
            </select></td>
          </tr>
          <tr>
            <td height="20" class="bodytext"><p>Script Check: <b><? print"$sc"; ?></b></p>            </td>
            <td><input name="scriptcheck" type="text" id="scriptcheck" value="" />
            <input type="hidden" value="<? print"$sc"; ?>" name="scrip"></td>
          </tr>
          <tr>
            <td height="20" class="bodytext">Referal (optional) </td>
            <td>
            <? if(!$referal){ ?>
            <input name="ref2" type="text" id="ref2" value="<? print"$referal"; ?>" maxlength="40" />
            <? }else{ ?>
            <input name="ref2" type="text" id="ref2" value="<? print"$referal"; ?>" maxlength="40" READONLY>
            <? } ?>          </td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td>              <input name="Submit" type="submit" class="submit" value="Register!" />            </td>
          </tr>
        </table>
      </form>      </td>
  </tr>
</table>

</td>
<td>&nbsp;</td>
  <div align="center"></div>
<tr><td height="14">&nbsp;</td>
</tr>
</body>
</html>

Edited 3 Years Ago by mike_2000_17: Fixed formatting

Next time, put your code within [/code ] tags.

Anyway, put print_r($_POST); at the beginning of the script and tell us what does it print after you click on register button.[code=php ] [/code ] tags.

Anyway, put print_r($_POST); at the beginning of the script and tell us what does it print after you click on register button.

Next time, put your code within (code=php) (/code) tags.

Anyway, put print_r($_POST); at the beginning of the script and tell us what does it print after you click on register button.

did what yopu said and this showed at the top of the screen when i tried to register a test account

"Array ( [reg_username] => ugotownd [reg_password] => pokemon [reg_password2] => pokemon [email] => smack123@hotmail.co.uk [email1] => smack123@hotmail.co.uk [location] => England [scriptcheck] => 905 [scrip] => 905 [ref2] => [Submit] => Register! )
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/rsboxxc/public_html/register.php:2) in /home/rsboxxc/public_html/register.php on line 3"

Edited 3 Years Ago by mike_2000_17: Fixed formatting

Ok! so the values are being posted correctly. umm.. Try this..

<?php
session_start();
include_once"includes/db_connect.php";
if (isset($_SESSION['username'])){
header("Location: /game/play.php");
exit();
}

$referal=$_GET['ref'];

$referal2=$_POST['ref2'];

$scriptcheck=$_POST['scriptcheck'];
$scriptcheck2=$_POST['scrip'];
$sc=rand(111,999);

if(!$referal2){
$referal2=0;
}


if ($_POST['Submit']) {

// Define post fields into simple variables
$reg_username = $_POST['reg_username'];

$email = $_POST['email'];
$email1 = $_POST['email1'];
$reg_password = $_POST['reg_password'];
$reg_password2 = $_POST['reg_password2'];
$location=strip_tags($_POST['location']);
$reg_username=trim($reg_username);

$today = gmdate('Y-m-d H:i:s');


$reg_username = stripslashes($reg_username);
$email = stripslashes($email);
$reg_username = strip_tags($reg_username);
$email = strip_tags($email);


if((!$reg_username) ||(!$reg_password) ||(!$email) || (!$location)){
$message="Please fill in all fields";
}else{
if($reg_password != $reg_password2){
$message="Passwords do not match";
}elseif ($reg_password = $reg_password2){
}else{
if($email != $email1){
$message="Emails do not match";
}elseif ($email = $email1){
if($scriptcheck != $scriptcheck2){
print"Script check wrong!";
}else{
if (ereg('[^A-Za-z]', $reg_username)) {
$message="Your username can only contain letters.";
}elseif (!ereg('[^A-Za-z]', $reg_username)) {


if (strlen($reg_username) <= 3 || strlen($reg_username) >= 40){
$message= "password too big or small.";
}elseif (strlen($reg_username) > 3 || strlen($reg_username) < 40){

if (strlen($reg_password and $reg_password2) <= 5 || strlen($reg_password and $reg_password2) >= 15){
$message= "password too big or small.";
}elseif (strlen($reg_password and $reg_password2) > 5 || strlen($reg_password and $reg_password2) < 15){


$sql_email_check = mysql_query("SELECT email FROM users
WHERE email='$email' AND status='Alive'");
$sql_username_check = mysql_query("SELECT username FROM users
WHERE username='$reg_username'");

$email_check = mysql_num_rows($sql_email_check);
$username_check = mysql_num_rows($sql_username_check);

if(($email_check > 0) || ($username_check > 0)){
echo "Im sorry but there has been an error please read on..<br />";
if($email_check > 0){
print"Your email address has already been used by another gangster!";
unset($email);
}
if($username_check > 0){
print"Your desired username is already in use!";
unset($reg_username);
}


}else{
$ip = $_SERVER['REMOTE_ADDR'];

$reg_password=$reg_password;
$time=time();

mysql_query("INSERT INTO `user_info` ( `id` , `username`)
VALUES (
'', '$reg_username')");

mysql_query("INSERT INTO `users` ( `id` , `username` , `password` , `money` , `regged` , `email` , `location` , `ip` , `r_ip`, `referal`)
VALUES ('', '$reg_username', '$reg_password', '10000', '$time', '$email', '$location', '$ip', '$ip', '$referal2')") or die(mysql_error);



$userid = mysql_insert_id();
// Let's mail the user!
$subject = "Modern Mobsters";
$message = "Thank you for registering at Modern Mobsters,
You can login to the game at www.rsboxx.com with the following details:
Username: $reg_username
Password: $reg_password



Thank you very much for registering

http://www.rsboxx.com staff.

Note: This is an automated email, please do not reply as you wont get response.";

mail($email, $subject, $message,
"From: Modern Mobsters<mailserver@rsboxx.com>"); }
echo "Your account has been registered! Check your email for your password!";
} }}}}}}
}
?>
<!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=iso-8859-1" />
<title>Register</title>
<link href="stylesheets/index.css" rel="stylesheet" type="text/css" />
<script language=JavaScript>
function so(dis)
{
for (i=0;i<dis.elements.length;i++){
if (dis.elements[i].type=='submit')
dis.elements[i].style.visibility='hidden';
}
if(fs==false){
fs=true;
return true;
}else
return false;
}
function goaway()
{
for(i=0;i<document.forms.length;i++)
document.forms[i].onsubmit = function() {return so(this);};
}
</script>
</head>

<body onLoad="goaway();">
<table border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td class="header">Modern Mobsters</td>
</tr>
<tr>
<td height="18" align="center"><div id="sectionLinks">
<a href="index.php">Home</a><a href="register.php">Register</a><a href="lostpass.php">Lost Password</a><a href="/screens.php">Screenshots</a><a href="story.php">Story Line </a></div></td>
</tr>
<tr>
<td height="300" class="main"><p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<form action="" method="post" name="form2" id="form2">
<table width="300" border="0" align="center" cellpadding="0" cellspacing="0">

<tr>
<td width="130" height="40" class="bodytext"> Username: </td>
<td width="57%"><input name="reg_username" type="text" id="reg_username" maxlength="40" /></td>
</tr>
<tr>
<td class="bodytext">Password:</td>
<td><input name="reg_password" type="text" id="reg_password" maxlength="15" /></td>
</tr>
<tr>
<td class="bodytext">Re-Type Password:</td>
<td><input name="reg_password2" type="text" id="reg_password2" maxlength="15" /></td>
</tr>
<tr>
<td class="bodytext">E-mail:</td>
<td><input name="email" type="text" id="email" value="" /></td>
</tr>
<tr>
<td class="bodytext">Re-Type E-mail: </td>
<td><input name="email1" type="text" id="email1" value="" /></td>
</tr>
<tr>
<td height="20" class="bodytext">Starting Location </td>
<td><select name="location" class="ddm" id="location" >
<option value="England" selected="selected">England</option>
<option value="China">China</option>
<option value="France">France</option>
<option value="Holland">Holland</option>
<option value="USA">USA</option>
<option value="Germany">Germany</option>
<option value="Canada">Canada</option>
<option value="South Africa">South Africa</option>
</select></td>
</tr>
<tr>
<td height="20" class="bodytext"><p>Script Check: <b><? print"$sc"; ?></b></p> </td>
<td><input name="scriptcheck" type="text" id="scriptcheck" value="" />
<input type="hidden" value="<? print"$sc"; ?>" name="scrip"></td>
</tr>
<tr>
<td height="20" class="bodytext">Referal (optional) </td>
<td>
<? if(!$referal){ ?>
<input name="ref2" type="text" id="ref2" value="<? print"$referal"; ?>" maxlength="40" />
<? }else{ ?>
<input name="ref2" type="text" id="ref2" value="<? print"$referal"; ?>" maxlength="40" READONLY>
<? } ?> </td>
</tr>
<tr>
<td>&nbsp;</td>
<td> <input name="Submit" type="submit" class="submit" value="Register!" /> </td>
</tr>
</table>
</form> </td>
</tr>
</table>

</td>
<td>&nbsp;</td>
<div align="center"></div>
<tr><td height="14">&nbsp;</td>
</tr>
</body>
</html>

If this doesn't work, indent your code, check for all the opening braces { and its ending brace. }

$query="INSERT INTO `user_info` ( `id` ,`username`) VALUES (
'', '$reg_username')";
echo $query;
mysql_query($query) or die(mysql_error());

$query2="INSERT INTO `users` ( `id` , `username` , `password` , `money` , `regged` , `email` , `location` , `ip` , `r_ip`, `referal`)
VALUES ('', '$reg_username', '$reg_password', '10000', '$time', '$email', '$location', '$ip', '$ip', '$referal2')";
echo $query2;
mysql_query($query2) or die(mysql_error());

Okay! Try these 2 lines instead of your insert statements. It will print 2 queries. Execute these queries in phpmyadmin or any other mysql client.

$query="INSERT INTO `user_info` ( `id` ,`username`) VALUES (
'', '$reg_username')";
echo $query;
mysql_query($query) or die(mysql_error());

$query2="INSERT INTO `users` ( `id` , `username` , `password` , `money` , `regged` , `email` , `location` , `ip` , `r_ip`, `referal`)
VALUES ('', '$reg_username', '$reg_password', '10000', '$time', '$email', '$location', '$ip', '$ip', '$referal2')";
echo $query2;
mysql_query($query2) or die(mysql_error());

Okay! Try these 2 lines instead of your insert statements. It will print 2 queries. Execute these queries in phpmyadmin or any other mysql client.

Try what exactly?

fill in the form and click submit. On submit, it will echo these 2 queries. :)

Well, If you are unable to understand what I am saying, I have a simple suggestion for you. Instead of mysql_query("insert into ....."); you can do something like this.

$query="insert into ....."; 
echo $query;
mysql_query($query);

By doing so, you can echo $query to know what exactly the query is.

This article has been dead for over six months. Start a new discussion instead.