tomfmason Posted July 3, 2006 Share Posted July 3, 2006 I followed the member system tutorial and found several syntax errors. But this one has me stumped I think that it is in my join script.Here is the join.php[code]<?php$filename = "registration.php";$title = "Registration"; $content = " <div class=\"feature\"> <div align=\"center\"> <p> <b>Registration Form</b> </div> </p> <form method=\"POST\" action=\"includes/register.php\"> <p> First Name </p> <p> <input type=\"text\" name=\"first_name\" id=\"first_name2\"> </p> <p> Last Name </p> <p> <input type=\"text\" name=\"last_name\" id=\"last_name\"> </p> <p> Email </p> <p> <input type=\"text\" name=\"email\" id=\"email\"> </p> <p> Desired Username </p> <p> <input type=\"text\" name=\"username\" id=\"username\"> </p> <div align=\"center\"> <p> <input type=\"submit\" name=\"Submit\" value=\"Join Now\"> </p> </div> </form> </div> </div>";include("includes/main.php"); ?>[/code]The problem that I am having is that the join.php is not posting the user information to register.phphere is the register.php[code] <?phpinclude 'db.php';$first_name = $_POST['first_name'];$lastname_name = $_POST['last_name'];$username = $_POST['username'];$email_address = $_POST['email_address'];$first_name = stripslashes($first_name);$last_name = stripslashes($last_name);$username = stripslashes($username);$email_address = stripslashes($email_address);if((!$first_name) || (!$last_name) || (!$email_address) || (!$username)){ echo "You did not submit the following required information ! </br>"; } if(!$first_name){ echo "Your first name is a required field. Please enter it below. </br>"; } if(!$last_name){ echo "Your last name is a required field. Please enter it below. </br>"; } if(!$username){ echo "Your username is a required field. Please enter it below. </br>"; } if(!$email_address){ echo "Your email address is a required field. Please enter it below. </br>"; } include '..\join.php'; exit(); $sql_email_check = mysql_query("SELECT email_address FROM home WHERE email_address='$email_address'"); $sql_username_check = mysql_query("SELECT username FROM home WHERE username='$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 "Please fix the following errors: <br />"; } if($email_check > 0){ echo "<strong>Your email address has already been used by another member in our database. Please use a different Email address!<br />"; unset($email_address); } if($username_check > 0){ echo "The username you have selected has already been used by another member in our database. Please choose a different Username!<br />"; unset($username); } include 'join.php'; exit(); function makeRandomPassword() { $salt = "abchefghjkmnpqrstuvwxyz0123456789"; srand((double)microtime()*1000000); $i = 0; while ($i <= 7) { $num = rand() % 33; $tmp = substr($salt, $num, 1); $pass = $pass . $tmp; $i++; } return $pass; } $random_password = makeRandomPassword(); $db_password = md5($random_password); $sql = mysql_query("INSERT INTO users (first_name, last_name, email_address, username, password, signup_date, decrypted_password) VALUES('$first_name', '$last_name', '$email_address', '$username', '$db_password', now(), '$random_password')") or die (mysql_error()); if(!$sql){ echo 'There has been an error creating your account. Please contact the webmaster.'; } else { $userid = mysql_insert_id(); $subject = "Your Membership at owpt.biz"; $message = "Dear $first_name $last_name, You are now registered at our website, http://www.owpt.biz! To activate your membership, please login here: http://www.owpt.biz/home/index.php Once you activate your membership, you will be able to login with the following information: Username: $username Password: $random_password Please keep this username and password in a location that is easily accessible by you. Thanks! WebMaster, Owpt.biz This is an automated response, please do not reply!"; mail($email_address, $subject, $message, "From: Owpt<[email protected]>\nX-Mailer: PHP/" . phpversion()); echo 'Your membership information has been mailed to your email address! Please check it and follow the directions!'; } ?>[code] I think that the user information from join.php is not getting passed to register.php [/code][/code] Link to comment https://forums.phpfreaks.com/topic/13521-registration-problems/ Share on other sites More sharing options...
tomfmason Posted July 3, 2006 Author Share Posted July 3, 2006 this was a simple fix..lol. it was the email_address field.before[code] <p> Email </p> <p> <input type=\"text\" name=\"email\" id=\"email\"> </p>[/code]Now[code] <p> Email </p> <p> <input type=\"text\" name=\"email\" id=\"email\"> </p>[/code]Now I am having another problem. After the register.php checks if the user imputed the correct information it doesn't go any further. What I mean is that it just sends me back to the join.php form. Here is where I think it is stoping the process.[code]if((!$first_name) || (!$last_name) || (!$email_address) || (!$username)){ echo "You did not submit the following required information ! </br>"; } if(!$first_name){ echo "Your first name is a required field. Please enter it below. </br>"; } if(!$last_name){ echo "Your last name is a required field. Please enter it below. </br>"; } if(!$username){ echo "Your username is a required field. Please enter it below. </br>"; } if(!$email_address){ echo "Your email address is a required field. Please enter it below. </br>"; } include '..\join.php'; exit();[/code]Any suggestions would be great Link to comment https://forums.phpfreaks.com/topic/13521-registration-problems/#findComment-52379 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.