Проблем със код за регистрация

bowby

Registered
Ето ви целия код
Код:
<?
include("html.php");

$html = mysql_fetch_array(mysql_query("SELECT rules,tos FROM $tab[html];"));
$ref = $_GET['ref'];
$ref2 = $_POST['ref'];

if(!$step){$step=1;}

    if(($step1 == 1) && ($agree == yes)){ header("Location: ?ref=$ref&step=2"); }
elseif(($step1 == 1) && ($agree != yes)){ header("Location: ?ref=$ref&warn=yes"); }
elseif(($step2 == 1) && ($agree == yes)){ header("Location: ?ref=$ref2&step=3"); }
elseif(($step2 == 1) && ($agree != yes)){ header("Location: ?ref=$ref2&step=2&warn=yes"); }

       if($signup)
         {
         $host=gethostbyaddr("$REMOTE_ADDR");
         $code = md5($username.trucode.$password);
         $pin = md5($email.trucode);
           
           if ((!preg_match ('/^[a-z0-9][a-z0-9\.\-_]*$/i', $username)) || (strstr($username,".")))
              { $msg="&#149 Invalid username: a-Z 0-9 -_ charactors only."; $username=""; }
       elseif ((strlen($username) <= 2) || (strlen($username) >= 19))
              { $msg="&#149 Invalid username: must be at least 3-18 in length."; $username=""; }
       elseif (fetch("SELECT username FROM $tab[user] WHERE username='$username';"))
              { $msg="&#149 Invalid username: already taken."; $username="";}
       elseif ((!preg_match ('/^[a-z0-9][a-z0-9\.\-_]*$/i', $password)) || (strstr($password,".")))
              { $msg="&#149 Invalid password: a-Z 0-9 -_ charactors only."; $password=""; $cpassword=""; }
       elseif ((strlen($password) <= 2) || (strlen($password) >= 13))
              { $msg="&#149 Invalid password: must be at least 3-12 in length."; $password=""; $cpassword=""; }
       elseif ($password != $cpassword)
              { $msg="&#149 Invalid password: your passwords do not match."; $password=""; $cpassword=""; }
       elseif (!ereg("^.+@.+\\..+$", $email))
              { $msg="&#149 Invalid email: that is not a valid e-mail address."; $email=""; }
       elseif (fetch("SELECT email FROM $tab[user] WHERE email='$email';"))
              { $msg="&#149 That e-mail address has already been used."; $email="";}
       elseif ((!preg_match ('/^[a-z]*$/i', $first)) || (strstr($first,".")))
              { $msg="&#149 Invalid first name: a-Z charactors only."; $first=""; }
       elseif ((!preg_match ('/^[a-z]*$/i', $last)) || (strstr($last,".")))
              { $msg="&#149 Invalid last name: a-Z charactors only."; $last=""; }
       elseif (($age <= 13) || ($age >= 80))
              { $msg="&#149 Invalid age: you must be 14 years or older to play."; $age=""; }
       elseif (($messager == AIM) && (!preg_match ('/^[a-z0-9][a-z0-9]*$/i', $messager_id)))
              { $msg="&#149 Invalid screen name: sould only contain a-Z 0-9 charactors, no spaces."; $messager=""; $messager_id=""; }
       elseif (($messager == MSN) && (!ereg("^.+@.+\\..+$", $messager_id)))
              { $msg="&#149 Invalid msn email: that is not a valid e-mail address.."; $messager=""; $messager_id=""; }
       elseif (($messager == YaHoO) && (!preg_match ('/^[a-z0-9][a-z0-9]*$/i', $messager_id)))
              { $msg="&#149 Invalid screen name: sould only contain a-Z 0-9 charactors, no spaces."; $messager=""; $messager_id=""; }
			
	   else {
				
			   mysql_query("UPDATE $tab[user] SET credits=credits+1000 WHERE id=$referrer");
			   mysql_query("UPDATE $tab[user] SET referrals=referrals+1 WHERE id=$referrer");
			   mysql_query("UPDATE $tab[user] SET refcredits=refcredits+1000 WHERE id=$referrer");

               mysql_query("INSERT INTO $tab[user] (username,password,email,fullname,age,messager,online,ip,host,code,membersince,ref_by) VALUES ('$username','$password','$email','$first $last','$age','$messager: $messager_id','$time','$REMOTE_ADDR','$host','$code','$time','$referrer');");

               mail_1("Welcome to $sitename!","\nWelcome to $domain!\n\nYour account information:\n   Username: $username\n   Password: $password\n   Pin: $pin\n\nBefore you can login, you must verify your email address.\n\nTo confirm this email address click on the bottom link, or copy and paste it to your browser.\n$site[location]confirm.php?verify=yes&email=$email&pin=$pin\n\nIf that link doesnt work, go to $site[location], login and enter in this pin:\n\n $pin\n\n-Admin\n","$email");

               header("Location: signup.php?step=4&email=$email");

              }
         }

siteheader();

//LAMER CHECK//////////////
$host=gethostbyaddr("$REMOTE_ADDR");
$getbans =mysql_query("SELECT banned FROM $tab[banned];");
$bans = array();
while($ban=mysql_fetch_array($getbans)) {
  array_push($bans, $ban[0]);
}

foreach ($bans as $correct){
if(strstr($host,"$correct")){ 
$banreason = mysql_fetch_array(mysql_query("SELECT reason FROM $tab[banned] WHERE banned='$correct';"));
?>
<style type="text/css">

</style>
<style type="text/css">

</style>
<table width="99%" height="100%">
 <tr>
  <td valign="top">
  <br><b>Your account has been permently banned from <?=$sitename?>.
  <br>Here is our stated reason:</b><br><br><font color="#7777CC"><?=$banreason[0]?></font>
  </td>
 </tr>
</table>

<?

$lamerstop=bitch;
}
}

////////////////////////////
if($lamerstop!=bitch){
?>
   <table width="100%" height="100%">
    <tr>
     <td height="12"><b><?=$sitename?> Sign Up: <font color="#89B93A">Step <?=$step?></font></b></td>
    </tr>
    <tr>
     
    </tr>
    <tr>
     <td valign="top">
<?
         if($step==4){?>
         <br>
      <center>Thanks For Joining Mobster Gods, No pin number is needed, so just click play and log in! Welcome to the game!
         <?}elseif($step==3){?>
         <form method="post" action="signup.php?step=3">
         <?if($msg){?><center><b><font color="#89B93A"><?=$msg?></font></b></center><?}?>
         <table align="center" cellspacing="1">
          <tr>
           <td colspan="2" bgcolor="#111111"><b>Login Info:</b> <font color="#CCCCCC">Required</font></td>
          </tr>
          <tr>
           <td align="right" bgcolor="#111111">username:</td><td bgcolor="#222222"><input type="text" class="signup1" name="username" maxlength="18" value="<?=htmlentities($username)?>"> <font color="#CCCCCC" size="1">3-18 length, a-Z 0-9 Charactors.</font></td>
          </tr>
          <tr>
           <td align="right" bgcolor="#111111">password:</td><td bgcolor="#222222"><input type="password" class="signup1" name="password" maxlength="12" value="<?=htmlentities($password)?>"> <font color="#CCCCCC" size="1">3-12 length, a-Z 0-9 Charactors.</font></td>
          </tr>
          <tr>
           <td align="right" bgcolor="#111111">confirm password:</td><td bgcolor="#222222"><input type="password" class="signup1" name="cpassword" maxlength="12" value="<?=htmlentities($cpassword)?>"></td>
          </tr>
          <tr>
           <td align="right" bgcolor="#111111">e-mail address:</td><td bgcolor="#222222"><input type="text" class="signup1" name="email" maxlength="100" value="<?=htmlentities($email)?>"> <font color="#CCCCCC" size="1">Pin Number will be sent here. Needed to login!</font></td>
          </tr>
          <tr>
           <td colspan="2" bgcolor="#111111"><b>Personal:</b> <font color="#CCCCCC">Required</font></td>
          </tr>
          <tr>
           <td align="right" bgcolor="#111111">first name:</td><td bgcolor="#222222"><input type="text" class="signup1" name="first" maxlength="25" value="<?=htmlentities($first)?>"></td>
          </tr>
          <tr>
           <td align="right" bgcolor="#111111">last name:</td><td bgcolor="#222222"><input type="text" class="signup1" name="last" maxlength="25" value="<?=htmlentities($last)?>"></td>
          </tr>
          <tr>
           <td align="right" bgcolor="#111111">age:</td><td bgcolor="#222222"><input type="text" class="signup2" name="age" size="4" maxlength="2" value="<?=htmlentities($age)?>"> <font color="#CCCCCC" size="1">14+ only.</font></td>
          </tr>
          <tr>
           <td align="right" bgcolor="#111111">Referrer:</td><td bgcolor="#222222"><input type="text" class="signup1" name="referrer" size="25" maxlength="50" value="<?=htmlentities($_GET[ref])?>"> <font color="#CCCCCC" size="1">Leave blank if you don't know.</font></td>
          </tr>
          <tr>
           <td colspan="2" bgcolor="#000000"><b>Misc:</b> <font color="#CCCCCC">Optional</font></td>
          </tr>
          <tr>
           <td align="right" bgcolor="#111111" class="signup1">instant messager:</td><td bgcolor="#222222"> <select name="messager"><option <?if($messager==""){echo"selected";}?>>N/A</option><option value="AIM" <?if($messager=="AIM"){echo"selected";}?>>AIM</option><option value="MSN" <?if($messager=="MSN"){echo"selected";}?>>MSN</option><option value="YaHoO" <?if($messager=="YaHoO"){echo"selected";}?>>YaHoO</option></select> <input type="text" class="signup1" name="messager_id" size="14" maxlength="50" value="<?=htmlentities($messager_id)?>"> <font color="#CCCCCC" size="1">so we may contact you if important.</font></td>
          </tr>
          <tr>
           <td colspan="2" bgcolor="#111111" align="center"><br><b>You ip address is being logged as: <font color="#89B93A"><?=$REMOTE_ADDR?></font></b><br><br></td>
          </tr>
          <tr>
           <td align="center" colspan="2" bgcolor="#111111"><input type="submit" class="signup2" name="signup" value="signup">       <input type="reset" class="signup2" value="cancel"></td>
          </tr>
         </table>

         </form>
         <?}elseif($step==2){?>
         <form method="post" action="signup.php">
         <?if($warn==yes){?><b><?}?>In order to proceed, you must agree with the following Game Rules:</b>
         <table width="100%">
          <tr>
           <td colspan="2">
           <div style="border:thin inset;background: #111111; padding:6px; height:175px; overflow:auto"><?=$html[0]?></div>
           </td>
          </tr>
          <tr>
           <td><input type="checkbox" name="agree" value="yes" style="background: #111111;"> <input type="hidden" name="step2" value="1"> <strong>I have read, and agree to abide by the Game Rules.</strong></td>
           <input type="hidden" name="ref" value="<?=$ref?>">
           <td align="right"><input type="submit" class="signup2" value="next >>"></td>
          </tr>
         </table>

         </form>
         <?}else{?>
         <form method="post" action="signup.php?ref=<?=$ref?>&">
         <?if($warn==yes){?><b><?}?>In order to proceed, you must agree with the following Terms of Service:</b>
         <table width="100%">
          <tr>
           <td colspan="2">
           <div style="border:thin inset;background: #111111; padding:6px; height:175px; overflow:auto"><?=$html[1]?></div>
           </td>
          </tr>
          <tr>
           <td><input type="checkbox" name="agree" value="yes" style="background: #111111;"> <input type="hidden" name="step1" value="1"> <strong><nobr>I have read, and agree to abide by the Terms of Service.</nobr></strong></td>
           <td align="right"><input type="submit" class="signup2" value="next >>"></td>
          </tr>
         </table>
         <input type="hidden" name="ref" value="<?$_GET['ref']?>">

         </form>
         <?}?>
     </td>
    </tr>
   </table>
<?}
sitefooter();
?>
Като завърша стъпка 1 от регистрацията (приемане на условията) не пристъпва към стъпка 2 :(
 

Back
Горе