???

php

Hi everyone,

New to php and new to the phphelp area. THANK YOU FOR THIS SITE!!!

Thank you in advance for any help.

I am getting an error code with this, and have looked and looked for the problem but I just can’t see it. Here is the php:

<?php /* Created By Adam Khoury @ www.flashbuilding.com -----------------------June 20, 2008----------------------- */ // Set error message as blank upon arrival to page $errorMsg = ""; // First we check to see if the form has been submitted if (isset($_POST['username'])){ //Connect to the database through our include include_once "connect_to_mysql.php"; // Filter the posted variables $username = ereg_replace("[^A-Za-z0-9]", "", $_POST['username']); // filter everything but numbers and letters $password = ereg_replace("[^A-Za-z0-9]", "", $_POST['password']); // filter everything but numbers and letters $realname = ereg_replace("[^A-Za-z0-9]", "", $_POST['realname']); // filter everything but numbers and letters $phone = ereg_replace("[^A-Za-z0-9]", "", $_POST['phone']); // filter everything but numbers and letters $email = stripslashes($_POST['email']); $email = strip_tags($email); $email = mysql_real_escape_string($email); $address = ereg_replace("[^A-Za-z0-9]", "", $_POST['address']); // filter everything but numbers and letters $city = ereg_replace("[^A-Z a-z0-9]", "", $_POST['city']); // filter everything but spaces, numbers, and letters $state = ereg_replace("[^A-Z a-z0-9]", "", $_POST['state']); // filter everything but spaces, numbers, and letters $zip = ereg_replace("[^A-Z a-z0-9]", "", $_POST['zip']); // filter everything but spaces, numbers, and letters $country = ereg_replace("[^A-Z a-z0-9]", "", $_POST['country']); // filter everything but spaces, numbers, and letters $accounttype = ereg_replace("[^a-z]", "", $_POST['accounttype']); // filter everything but lowercase letters $bio = ereg_replace("[^A-Z a-z0-9]", "", $_POST['bio']); // filter everything but spaces, numbers, and letters $resume = ereg_replace("[^A-Z a-z0-9]", "", $_POST['resume']); // filter everything but spaces, numbers, and letters // email fields...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) || (!$password) || (!$realname) || (!$phone) || (!$email) || (!$city) || (!$state) || (!$zip) || (!$country) || (!$bio)){ $errorMsg = "You did not submit the following required information!

"; if(!$username){ $errorMsg .= "--- User Name"; } else if(!$password){ $errorMsg .= "--- Password"; } else if(!$realname){ $errorMsg .= "--- Your Real Name"; } else if(!$email){ $errorMsg .= "--- Email"; } else if(!$address){ $errorMsg .= "--- address"; } else if(!$city){ $errorMsg .= "--- City"; } else if(!$state){ $errorMsg .= "--- State"; } else if(!$zip){ $errorMsg .= "--- Zip"; } else if(!$country){ $errorMsg .= "--- country"; } else if(!$accounttype){ $errorMsg .= "--- Account Type"; } else if(!$bio){ $errorMsg .= "--- Bio"; } } 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 = "ERROR:
Your User Name is already in use inside our system. Please try another."; } else if ($email_check > 0){ $errorMsg = "ERROR:
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 members (id, username, password, realname, phone, email, address, city, state, zip, country, accounttype, bio, resume, signupdate) VALUES('$username','$realname', '$address','$city','$state','$zip','$country','$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 = ' Hi ' . $username . ',

You must complete this step to activate your account with us.

Please click here to activate now >> ACTIVATE NOW

Your Login Data is as follows:

E-mail Address: ' . $email . '
Password: ' . $password . '

Thanks! '; // 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 "


OK $firstname, one last step to verify your email identity:


We just sent an Activation link to: $email

Please check your email inbox in a moment to click on the Activation
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 ?>

Why not post the error message what you get? Also it will help if you use the “PHP” tag to format php code in your post (there is a button labeled “php” when you enter your post message).

Sponsor our Newsletter | Privacy Policy | Terms of Service