Help with my "create an account" page - One problem :(

So…

You are saying that when someone clicks submit it SHOULD work and go into a folder but the page will look the same? Is it because of these?

[php][/php]

That type of coding keeps it the same?

well yes, because your setting the value of the text box to whatever the variable is. If you don’t want it to be remembered, then either remove the value or null it out after everything is done.

Well, at the moment, more importantly…my information was not saved :frowning: I click submit, reloads, info stays but it is not obtained anywhere?

is the user folder being created?

I created one in my file manager int he root folder - Where am I able to verify the name, maybe its a little off?

I have a folder “memberFiles” for the information but there is nothing inside.

ok, so we need to see where its getting to before it fails. After the two duplication checks, echo the number of rows that are returned. They should return 0 rows if the user doesn’t exist already.

Not sure I understand what you mean?

Here is my updated code is needed:

[php]<?php

$errorMsg = “”;
// First we check to see if the form has been submitted
if (isset($_POST[‘submit’])){
echo “

”;
print_r($_POST);
echo “
”;
//Connect to the database through our include
include_once “/mypersonalsql.php”;
// Filter the posted variables
$username = ereg_replace("[^A-Za-z0-9]", “”, $_POST[‘username’]); // filter everything but numbers and letters
$country = ereg_replace("[^A-Z a-z0-9]", “”, $_POST[‘country’]); // filter everything but spaces, numbers, and letters
$state = ereg_replace("[^A-Z a-z0-9]", “”, $_POST[‘state’]); // filter everything but spaces, numbers, and letters
$city = ereg_replace("[^A-Z a-z0-9]", “”, $_POST[‘city’]); // filter everything but spaces, numbers, and letters
$accounttype = ereg_replace("[^a-z]", “”, $_POST[‘accounttype’]); // filter everything but lowercase letters
$email = stripslashes($_POST[‘email’]);
$email = strip_tags($email);
$email = mysql_real_escape_string($email);
$password = ereg_replace("[^A-Za-z0-9]", “”, $_POST[‘password’]); // filter everything but numbers and letters
// Check to see if the user filled all fields with
// the “Required”(*) symbol next to them in the join form
// and print out to them what they have forgotten to put in
if((!$username) || (!$country) || (!$state) || (!$city) || (!$accounttype) || (!$email) || (!$password)){
	$errorMsg = "You did not submit the following required information!<br /><br />";
	if(!$username){
		$errorMsg .= "--- User Name";
	} else if(!$country){
		$errorMsg .= "--- Country"; 
	} else if(!$state){ 
	    $errorMsg .= "--- State"; 
   } else if(!$city){ 
       $errorMsg .= "--- City"; 
   } else if(!$accounttype){ 
       $errorMsg .= "--- Account Type"; 
   } else if(!$email){ 
       $errorMsg .= "--- Email Address"; 
   } else if(!$password){ 
       $errorMsg .= "--- Password"; 
   }
} else {
// Database duplicate Fields Check
$sql_username_check = mysql_query("SELECT id FROM members WHERE username='$username' LIMIT 1");
$sql_email_check = mysql_query("SELECT id FROM members WHERE email='$email' LIMIT 1");
$username_check = mysql_num_rows($sql_username_check);
$email_check = mysql_num_rows($sql_email_check); 
if ($username_check > 0){ 
	$errorMsg = "<u>ERROR:</u><br />Your User Name is already in use inside our system. Please try another.";
} else if ($email_check > 0){ 
	$errorMsg = "<u>ERROR:</u><br />Your Email address is already in use inside our system. Please try another.";
} else {
	// Add MD5 Hash to the password variable
   $hashedPass = md5($password); 
	// Add user info into the database table, claim your fields then values 
	$sql = mysql_query("INSERT INTO memberFiles (username, country, state, city, accounttype, email, password, signupdate) 
	VALUES('$username','$country','$state','$city','$accounttype','$email','$hashedPass', now())") or die (mysql_error());
	// Get the inserted ID here to use in the activation email
	$id = mysql_insert_id();
	// Create directory(folder) to hold each user files(pics, MP3s, etc.) 
	mkdir("memberFiles/$id", 0755); 
	// Start assembly of Email Member the activation link
	$to = $email;
	// Change this to your site admin email
	$from = "[email protected]";
	$subject = "Complete your registration";
	//Begin HTML Email Message where you need to change the activation URL inside
	$message = "<html>
<body bgcolor='#FFFFFF'>
Hi  $username <br /><br />
You must complete this step to activate your account with us.
<br /><br />
Please click here to activate now &gt;&gt;
<a href='http://www.somewebsite.com/activation.php?id=$id'>ACTIVATE NOW</a>
<br /><br />
Your Login Data is as follows:
<br /><br />
E-mail Address: $email<br />
Password: $password
<br /><br />
Thanks!
</body>
</html>";
	// end of message
	$headers = "From: $from\r\n";
	$headers .= "Content-type: text/html\r\n";
	$to = "$to";
	// Finally send the activation email to the member
	mail($to, $subject, $message, $headers);
	// Then print a message to the browser for the joiner 
	print "<br /><br /><br /><h4>OK $firstname, one last step to verify your email identity:</h4><br />
	We just sent an Activation link to: $email<br /><br />
	<strong><font color=\"#990000\">Please check your email inbox in a moment</font></strong> to click on the Activation <br />
	Link inside the message. After email activation you can log in.";
	exit(); // Exit so the form and page does not display, just this success message
} // Close else after database duplicate field value checks

} // Close else after missing vars check
} //Close if $_POST
?>

Member Registration
REGISTER AS A MEMBER HERE
<?php echo $errorMsg; ?>
User Name:
Country:
Australia Canada Mexico United Kingdom United States Zimbabwe
State:
City:
Account Type:
Normal User Expert User Super User
Email:
Password:
(letters or numbers only, no spaces no symbols)
Captcha:
Add Captcha Here for security
[/php]

[php]$sql_username_check = mysql_query(“SELECT id FROM members WHERE username=’$username’ LIMIT 1”);
$sql_email_check = mysql_query(“SELECT id FROM members WHERE email=’$email’ LIMIT 1”);
$username_check = mysql_num_rows($sql_username_check);
echo “Username rows found: “.$username_check.”
”;
$email_check = mysql_num_rows($sql_email_check);
echo “Email rows found: “.$email_check.”
”;[/php]

Doing that will tell us if its finding anyone.

Should I put that in my page or in SQL database?

Just had a thought! (Silly I know)

Shouldnt I have something in my MySQL for the members information or will it be saved to a folder in my filemanager directory?

Your direct code gave me an issue when entering in SQL database.

The code i gave you didn’t have anything to do with inserting info into the database, it just echoed how many rows each query returned.

If you want, email the registration page to me and i’ll get it working for you. my email is [email protected]

I emailed you :slight_smile:

I emailed u this same page
[php]<?php
$errorMsg = “”;
if(isset($_POST[‘submit’])){// First we check to see if the form has been submitted

//Connect to the database through our include
include_once "mypersonalsql.php";

// Filter the posted variables
$username = @ereg_replace("[^A-Za-z0-9]", "", $_POST['username']); // filter everything but numbers and letters	
$country = @ereg_replace("[^A-Z a-z0-9]", "", $_POST['country']); // filter everything but spaces, numbers, and letters	
$state = @ereg_replace("[^A-Z a-z0-9]", "", $_POST['state']); // filter everything but spaces, numbers, and letters	
$city = @ereg_replace("[^A-Z a-z0-9]", "", $_POST['city']); // filter everything but spaces, numbers, and letters	
$accounttype = @ereg_replace("[^a-z]", "", $_POST['accounttype']); // filter everything but lowercase letters	
$email = stripslashes($_POST['email']);	$email = strip_tags($email);	$email = mysql_real_escape_string($email);	
$password = @ereg_replace("[^A-Za-z0-9]", "", $_POST['password']); // filter everything but numbers and letters	
// Check to see if the user filled all fields with the "Required"(*) symbol next to them in the join form	
// and print out to them what they have forgotten to put in	
if((!$username) || (!$country) || (!$state) || (!$city) || (!$accounttype) || (!$email) || (!$password)){
	$errorMsg = "You did not submit the following required information!<br /><br />";
	if(!$username){
		$errorMsg .= "--- User Name";
	} elseif(!$country){
		$errorMsg .= "--- Country";
	} elseif(!$state){
		$errorMsg .= "--- State";
	} elseif(!$city){
		$errorMsg .= "--- City";
	} elseif(!$accounttype){
		$errorMsg .= "--- Account Type";
	} elseif(!$email){
		$errorMsg .= "--- Email Address";
	} elseif(!$password){
		$errorMsg .= "--- Password";
	}
} else {
	// Database duplicate Fields Check
	$sql_username_check = mysql_query("SELECT id FROM members WHERE username='$username' OR email = '$email'") or die(mysql_error());
	$username_check = mysql_num_rows($sql_username_check);
	if ($username_check > 0){
		$errorMsg = "<u>ERROR:</u><br />Your User Name or Email Address is already in use inside our system. Please try another.";
	} 
	// Add MD5 Hash to the password variable
	$hashedPass = md5($password);
	if(!$errorMsg) {
		// Add user info into the database table, claim your fields then values
		$sql = mysql_query("INSERT INTO members (username, country, state, city, accounttype, email, password, signupdate)
							VALUES('$username','$country','$state','$city','$accounttype','$email','$hashedPass', now())") or die (mysql_error());
		// Get the inserted ID here to use in the activation email
		$id = mysql_insert_id();
		if($sql) {
			// Create directory(folder) to hold each user files(pics, MP3s, etc.)
			mkdir("memberFiles/$id");
			chmod("memberFiles/$id", 0755);
			// Start assembly of Email Member the activation link
			$to = $email;
			// Change this to your site admin email
			$from = "[email protected]";
			$subject = "Complete your registration";
			//Begin HTML Email Message where you need to change the activation URL inside
			$message = "<html>
			<body bgcolor='#FFFFFF'>
			Hi $username <br /><br />
			You must complete this step to activate your account with us.
			<br /><br />
			Please click here to activate now &gt;&gt;
			<a href='http://www.somewebsite.com/activation.php?id=$id'>ACTIVATE NOW</a>	<br /><br />
			Your Login Data is as follows: 	<br /><br />
			E-mail Address: $email<br />
			Password: $password
			<br /><br /> 
			Thanks!
			</body>
			</html>";
		
			$msg = "You have been registered";
			
			unset($username);
			unset($password);
			unset($country);
			unset($state);
			unset($city);
			unset($accounttype);
			unset($email);
			unset($id);
		}
	}
}

}
?>

Member Registration
REGISTER AS A MEMBER HERE
<?php if($errorMsg) { ?> <?php } if($msg) { ?> <?php } ?>
<?=$errorMsg?>
<?=$msg?>
User Name:
Country:
<?=$country?> Australia Canada Mexico United Kingdom United States Zimbabwe
State:
City:
Account Type:
<?=$accounttype?> Normal User Expert User Super User
Email:
Password:
(letters or numbers only, no spaces no symbols)
Captcha:
Add Captcha Here for security
[/php]
Sponsor our Newsletter | Privacy Policy | Terms of Service