Pyro Posted July 26, 2008 Share Posted July 26, 2008 Hi, my registration page was working intil i broke it, it says the emails are not the same when they are, can someone please tell me where ive gone wrong in this php. thanks <?php include_once("config.php"); include_once("connect.php"); if(isset($_POST['Register'])){ $sql = "SELECT status FROM sitestats WHERE id='1'"; $query = mysql_query($sql) or die(mysql_error()); $row = mysql_fetch_object($query); $page_status = htmlspecialchars($row->status); $page_status_array = explode("-", $page_status); if(!empty($page_status_array[32])){ echo htmlspecialchars(stripslashes($page_status_array[32])); }else{ if ((strlen($_POST['password']) > "20") or (strlen($_POST['password']) < "6")){ echo "Your Password needs to be between 6 and 20 characters long."; }else{ if ((strlen($_POST['name']) > "20") or (strlen($_POST['name']) < "2")){ echo "Your name needs to be between 2 and 20 characters long."; }else{ if($_POST['mail'] != $_POST['mail_check']){ echo "The 2 given email's didn't match."; }else{ if($_POST['password'] != $_POST['password_check']){ echo "The 2 given Passwords's didn't match."; }else{ if(empty($_POST['tos'])){ echo "You need to accept the Terms of Service in order to play Gangster Basics."; }else{ $sql = "SELECT id FROM login WHERE name='".mysql_real_escape_string($_POST['name'])."'"; $query = mysql_query($sql) or die(mysql_error()); $count = mysql_num_rows($query); if($count >= "1"){ echo "This username is already taken."; }else{ $sql = "SELECT id FROM login WHERE mail='".mysql_real_escape_string($_POST['mail'])."'"; $query = mysql_query($sql) or die(mysql_error()); $m_count = mysql_num_rows($query); if($m_count >= "1"){ echo "This email has already been used."; }else{ if(!preg_match("/^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,6}$/i", $_POST['mail'])) { echo "Please use a valid email address."; }else{ if (ereg('[^A-Za-z0-9]', $_POST['name'])) { echo "Invalid Name only A-Z,a-z and 0-9 is allowed."; }else{ if (ereg('[^A-Za-z0-9]', $_POST['ref'])) { echo "Invalid Name only A-Z,a-z and 0-9 is allowed."; }else{ $sql = "SELECT id FROM login WHERE name='".mysql_real_escape_string($_POST['ref'])."'"; $query = mysql_query($sql) or die(mysql_error()); $a_count = mysql_num_rows($query); if(empty($a_count) and !empty($_POST['ref'])){ echo "Your referral does not play this game."; }else{ if(($_POST['location'] > "9") or ( $_POST['location'] < "1")){ echo "Invalid Location."; }else{ $pass = md5($_POST['password']); $sql = "INSERT INTO login SET id = '', name = '" .mysql_real_escape_string($_POST['name']). "', signup =NOW() , password = '" .mysql_real_escape_string($pass). "', state = '0', mail = '" .mysql_real_escape_string($_POST['mail']). "',location='".mysql_real_escape_string($_POST['location'])."', signup_ip='".mysql_real_escape_string($_SERVER['REMOTE_ADDR'])."',ref='".mysql_real_escape_string($_POST['ref'])."'"; $res = mysql_query($sql); // send email. $bericht = "Your account has been activated and your personal information is posted below.\n\n"; $bericht .= "Username: ".$_POST['name']."\n"; $bericht .= "Password: ".$_POST['password']."\n"; $mail = mail($_POST['mail'],"Welcome to ".$site_name,$bericht,"From: ".$site_name." <".$site_mail.">"); echo "Thank you for joining. Your account has been activated."; }}// referrals check. }// check if email is used. }// check if the 2 passwords match. }// check if valid location. }// check name characters. }// check if valid email. }// check if name is unused. }// check if accepted to the tos. }// check if 2 mails are the same. }// name check. }// password check. }// if disabled. }// if post register. ?> Link to comment https://forums.phpfreaks.com/topic/116757-registration-page-problem/ Share on other sites More sharing options...
MikeDXUNL Posted July 26, 2008 Share Posted July 26, 2008 Please post the Registration Form Link to comment https://forums.phpfreaks.com/topic/116757-registration-page-problem/#findComment-600457 Share on other sites More sharing options...
Pyro Posted July 26, 2008 Author Share Posted July 26, 2008 O.o forget it people, i found the problem, sorry for wasting your time. ~Py mod please delete this. Link to comment https://forums.phpfreaks.com/topic/116757-registration-page-problem/#findComment-600460 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.