Jump to content

Recommended Posts

<?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

Link to comment
https://forums.phpfreaks.com/topic/205534-my-script-does-nothing/
Share on other sites

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)?

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'.

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.