I am making a membership system for my site, Darklilspark.net and I have a problem when someone signs up. It says this:
Fatal error: Allowed memory size of 50331648 bytes exhausted (tried to allocate 16304 bytes) in /home/darklils/public_html/register.php on line 2
Here is the PHP page's code that does the actions when someone signs up:
Code:
<?
include 'register.php';
// Define post fields into simple variables
$name = $_POST['name'];
$email = $_POST['email'];
$username = $_POST['username'];
$password = $_POST['password'];
$gender = $_POST['gender'];
$birthday = $_POST['birthday'];
$security = $_POST['security'];
$password = $_POST['password'];
/* Let's strip some slashes in case the user entered
any escaped characters. */
$name = stripslashes($name);
$email = stripslashes($email);
$username = stripslashes($username);
$password = stripslashes($password);
$gender = stripslashes($gender);
$birthday = stripslashes($birthday);
$security = stripslashes($security);
$password = stripslashes($password);
/* Do some error checking on the form posted fields */
if((!$name) || (!$email) || (!$username) || (!$password) || (!$birthday) || (!$gender) || (!$security)){
echo 'You did not fill these place in, click back on your browser and fill them in. <br />';
if(!$name){
echo "Name is a required field. Please enter it below.<br />";
}
if(!$password){
echo "Password is a required field. Please enter it below.<br />";
}
if(!$email){
echo "Email Address is a required field. Please enter a valid one.<br />";
}
if(!$username){
echo "Desired Username is a required field. Please enter it below.<br />";
}
if(!$security){
echo "Please put in the security code.<br />";
}
include 'signup.html'; // Show the form again!
/* End the error checking and if everything is ok, we'll move on to
creating the user account */
exit(); // if the error checking has failed, we'll exit the script!
}
/* Let's do some checking and ensure that the user's email address or username
does not exist in the database */
$sql_email_check = mysql_query("SELECT email FROM users WHERE email='$email'");
$sql_username_check = mysql_query("SELECT username FROM users 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 another email.<br />";
unset($email);
}
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 'signup.html'; // Show the form again!
exit(); // exit the script so that we do not create this account!
}
$sql = mysql_query("INSERT INTO users (name, email, username, password, signup_date)
VALUES('$name', '$email',
'$username', '$db_password', '$info2', now())") or die (mysql_error());
if(!$sql){
echo 'There has been an error creating your account. Please contact the Courtney ASAP.';
} else {
$userid = mysql_insert_id();
// Let's mail the user!
$subject = "Your Membership at Dark lil Spark";
$message = "Hey $name,
Thank you for registering at Dark lil Spark!
You are two steps away from logging in and being in our community.
To activate your membership, please click here:
http://www.darklilspark.net/activate.php?id=$userid&code=$db_password
Once you activate your memebership, you will be able to login with the following
information:
Username: $username
Password: $password
You will get to change your password once you log in and activate your account.
Thanks!
DLS Staff
This is an automated response, please do not reply!";
mail($email, $subject, $message,
"From: Dark lil Spark Staff<dlsstaff@darklilspark.net>\n
X-Mailer: PHP/" . phpversion());
echo 'Your membership information has been mailed to your email address!
Please check it and follow the directions!';
}
I got this code from
http://www.devarticles.com/c/a/PHP/C...ership-System/. If you know what's wrong or know another tutorial that can help me with this, please reply.