Nexus10 Posted June 22, 2010 Share Posted June 22, 2010 <?php // Back-end for user registration session_start(); include("config.php"); include("openDatabase.php"); $user_name = strip_tags($_POST["userName"]); // Strip_tags removes anything enclosed by < or > (i.e. scripts/html etc) $email = strip_tags($_POST["email"]); $password1 = strip_tags($_POST["password1"]); $password2 = strip_tags($_POST["password2"]); echo($email); $_SESSION['account_err'] = "" $_SESSION['register_userName'] = $user_name // Stores the entered data to repopulate the form if necessary if the user needs to correct anything $_SESSION['register_email'] = $email include("config.php"); // MYSQL connection details include("openDatabase.php"); // Connects to the database if (strlen($user_name) < 5){ // User name has be minimum 5 characters in length $_SESSION['account_err'] = "Error: User name must be 5 characters or longer."; endif if (strlen($email) < 6) // Poor check to check at least something has been entered into the field $_SESSION['account_err'] = "Error: A valid email address is needed!"; end if if ($password1 <> $password2){ // Checks if passwor $_SESSION['account_err'] = "Error: Password's do not match!"; else { if (strlen($password1) < 5){ // Password has to be minimum 5 characters in length $_SESSION['account_err'] = "Error: Password must be 5 characters or longer."; endif endif $errStatus = $_SESSION['account_err'] echo("Err status: $errStatus"); if ($_SESSION['account_err'] = ""){ // No errors in data submitted for registration $query = "INSERT INTO Users(user_name, date_registered, password, email) VALUES ($user_name, date("Y/m/d"), $password1, $email)"; mysql_query($query) or die("Error: Registration not saved. Please let us know at ???@???.com"); endif ?> when the above file is called after a user has submitted their details to register, this file loads in the browser but nothing occurs, no error or anything Quote Link to comment https://forums.phpfreaks.com/topic/205534-my-script-does-nothing/ Share on other sites More sharing options...
Nexus10 Posted June 22, 2010 Author Share Posted June 22, 2010 ? Quote Link to comment https://forums.phpfreaks.com/topic/205534-my-script-does-nothing/#findComment-1075511 Share on other sites More sharing options...
ChrisA Posted June 22, 2010 Share Posted June 22, 2010 First thing I would do is put some echo statements in to find out where it is going wrong. eg: <?php // Back-end for user registration echo 1; session_start(); echo 2; include("config.php"); echo 3; include("openDatabase.php"); echo 4; Is something going wrong in one of your include files (which you include again a little further in your script)? Quote Link to comment https://forums.phpfreaks.com/topic/205534-my-script-does-nothing/#findComment-1075512 Share on other sites More sharing options...
Nexus10 Posted June 22, 2010 Author Share Posted June 22, 2010 First thing I would do is put some echo statements in to find out where it is going wrong. eg: <?php // Back-end for user registration echo 1; session_start(); echo 2; include("config.php"); echo 3; include("openDatabase.php"); echo 4; Is something going wrong in one of your include files (which you include again a little further in your script)? Nothing echo's, not even '1'. Quote Link to comment https://forums.phpfreaks.com/topic/205534-my-script-does-nothing/#findComment-1075516 Share on other sites More sharing options...
Pikachu2000 Posted June 22, 2010 Share Posted June 22, 2010 The script has at least 10 parse errors. That's why it wont do anything. You've conflated two different syntaxes of if/else/elseif. You're missing a bunch of semi-colons. You're using an assignment operator '=' instead of a comparison operator '=='. I'll guarantee this script is producing errors, you just can't see them because you don't have error reporting on in php.ini. Quote Link to comment https://forums.phpfreaks.com/topic/205534-my-script-does-nothing/#findComment-1075540 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.