Webmaster Forum

Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Reply
 
LinkBack Thread Tools Display Modes
Old 08-16-2009, 01:10 PM   #1 (permalink)
Junior Member
 
Join Date: 08-16-09
Location: Florida
Posts: 3
iTrader: 0 / 0%
Latest Blog:
None

DarklilSpark is liked by many
Question Need help on PHP code

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.

Last edited by htmlbasictutor; 08-16-2009 at 03:07 PM..
DarklilSpark is offline  
Add Post to del.icio.us
Reply With Quote
Old 08-16-2009, 07:01 PM   #2 (permalink)
v7n Mentor
 
Izzmo's Avatar
 
Join Date: 11-01-03
Location: Kansas City
Posts: 1,338
iTrader: 0 / 0%
Latest Blog:
Starting p90x today

Izzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web pro
Send a message via ICQ to Izzmo Send a message via AIM to Izzmo Send a message via MSN to Izzmo Send a message via Yahoo to Izzmo
the problem is obviously on register.php on line 2. Please show the contents of register.php.
__________________
Izzmo
Coding Guru Extraordinaire
ZeroWeb Hosting & Design - Customizable hosting for every type of user!
Izzmo is offline  
Add Post to del.icio.us
Reply With Quote
Old 08-16-2009, 07:15 PM   #3 (permalink)
Junior Member
 
Join Date: 08-16-09
Location: Florida
Posts: 3
iTrader: 0 / 0%
Latest Blog:
None

DarklilSpark is liked by many
Quote:
Originally Posted by Izzmo View Post
the problem is obviously on register.php on line 2. Please show the contents of register.php.
Yea I know, the code is register.php and I don't get why it isn't going through.
__________________
Get tutorials and graphics for free, Web hosting just $17.99 yearly, free web hosting(yoursitename.darklilspark.net), get it all at www.Darklilspark.net.
DarklilSpark is offline  
Add Post to del.icio.us
Reply With Quote
Old 08-16-2009, 07:17 PM   #4 (permalink)
v7n Mentor
 
Izzmo's Avatar
 
Join Date: 11-01-03
Location: Kansas City
Posts: 1,338
iTrader: 0 / 0%
Latest Blog:
Starting p90x today

Izzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web pro
Send a message via ICQ to Izzmo Send a message via AIM to Izzmo Send a message via MSN to Izzmo Send a message via Yahoo to Izzmo
.. if it is register.php then why is the a include "register.php" at the top?
__________________
Izzmo
Coding Guru Extraordinaire
ZeroWeb Hosting & Design - Customizable hosting for every type of user!
Izzmo is offline  
Add Post to del.icio.us
Reply With Quote
Old 08-16-2009, 08:26 PM   #5 (permalink)
Junior Member
 
Join Date: 08-16-09
Location: Florida
Posts: 3
iTrader: 0 / 0%
Latest Blog:
None

DarklilSpark is liked by many
Quote:
Originally Posted by Izzmo View Post
.. if it is register.php then why is the a include "register.php" at the top?
Lol that's why I posted this question. So what suppose to be there?
__________________
Get tutorials and graphics for free, Web hosting just $17.99 yearly, free web hosting(yoursitename.darklilspark.net), get it all at www.Darklilspark.net.
DarklilSpark is offline  
Add Post to del.icio.us
Reply With Quote
Old 08-17-2009, 06:52 AM   #6 (permalink)
Junior Member
 
Join Date: 08-17-09
Posts: 2
iTrader: 0 / 0%
Latest Blog:
None

Rocketman is liked by many
Change include 'register.php' to include_once 'register.php'. It's looks like your script include register.php until free memory is available.
Rocketman is offline  
Add Post to del.icio.us
Reply With Quote
Old 08-17-2009, 09:13 AM   #7 (permalink)
v7n Mentor
 
Izzmo's Avatar
 
Join Date: 11-01-03
Location: Kansas City
Posts: 1,338
iTrader: 0 / 0%
Latest Blog:
Starting p90x today

Izzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web pro
Send a message via ICQ to Izzmo Send a message via AIM to Izzmo Send a message via MSN to Izzmo Send a message via Yahoo to Izzmo
Yeah, it seems like that is what is happening.

I would remove 'include 'register.php';' all together though. (see if it still works when you do that though )
__________________
Izzmo
Coding Guru Extraordinaire
ZeroWeb Hosting & Design - Customizable hosting for every type of user!
Izzmo is offline  
Add Post to del.icio.us
Reply With Quote
Old 08-17-2009, 10:13 AM   #8 (permalink)
Contributing Member
 
JennyRipley's Avatar
 
Join Date: 08-03-09
Posts: 406
iTrader: 0 / 0%
Latest Blog:
None

JennyRipley is liked by many
Quote:
Originally Posted by Izzmo View Post
Yeah, it seems like that is what is happening.

I would remove 'include 'register.php';' all together though. (see if it still works when you do that though )
Yeah,I agree with you.
__________________
HostEase Web Hosting
Only $0.01 for the first month with coupon code TEST
24/7/365 Email | Livechat | Tel support
JennyRipley is offline  
Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

Reply

Tags
login, membership, php, registery error


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Google Analytics old code vs new code m42 Google Forum 0 03-29-2008 01:04 AM
CSS code daniel0012 Coding Forum 4 03-12-2007 12:15 PM
Google Code Search - Code Search Engine from the Big G Avinash Coding Forum 2 10-05-2006 11:10 PM
Need help I'm getting a 406 code emg35 Web Hosting Forum 5 01-05-2005 06:22 PM
need help with a code kopythat Coding Forum 10 03-11-2004 06:31 PM


Sponsor Links
Get exposure! Contextual Links V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 09:42 PM.
© Copyright 2008 V7 Inc
Powered by vBulletin
Copyright © 2000-2009 Jelsoft Enterprises Limited.


Search Engine Optimization by vBSEO 3.3.0 ©2009, Crawlability, Inc.