the apprentice webmaster Posted March 31, 2006 Share Posted March 31, 2006 hi guys , wel i am trying to create a join.php script for my website , the form run , but when i try to add that new user i get this message : [b]Object not found!The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.If you think this is a server error, please contact the webmaster.Error 404localhost03/29/06 22:01:37Apache/2.2.0 (Win32) DAV/2 mod_ssl/2.2.0 OpenSSL/0.9.8a mod_autoindex_color PHP/5.1.1 ;[/b][/b]here 's my sample script join.php<?phpinclude $_SERVER['DOCUMENT_ROOT'].'/bpo/layout.php';switch($_REQUEST['req']){case "process": myheader("Become a Member: Step 2"); // Validate all required fields were posted if(!$_POST['first_name'] || !$_POST['last_name'] || !$_POST['email_address'] || !$_POST['email_address2'] || !$_POST['username'] || !$_POST['password'] || !$_POST['password2'] || !$_POST['bio']){ $errors .= "<strong>Form Input Errors:". "</strong>\n\n"; $error = true; if(!$_POST['first_name']){ $errors .= "Missing First Name\n"; } if(!$_POST['last_name']){ $errors .= "Missing Last Name\n"; } if(!$_POST['email_address']){ $errors .= "Missing Email Address\n"; $email_error = true; } if(!$_POST['email_address2']){ $errors .= "Missing Email Address Verification\n"; $email_error = true; } if(!$_POST['username']){ $errors .= "Missing Username\n"; } if(!$_POST['password']){ $errors .= "Missing Password\n"; $password_error = true; } if(!$_POST['password2']){ $errors .= "Missing Password Verification\n"; $password_error = true; } if(!$_POST['bio']){ $errors .= "Missing Information About Yourself\n"; } } // If both emails were posted, validate they match. if($email_error == false){ if($_POST['email_address'] != $_POST['email_address2']){ $error = true; $errors .= "Email addresses do not match!\n\n"; $email_error = true; } } // If both passwords were posted, validate they match. if($password_error == false){ if($_POST['password'] != $_POST['password2']){ $error = true; $errors .= "Passwords do not match!\n\n"; $password_error = true; } } // Verify if username already exists. $ucount = mysql_result(mysql_query("SELECT COUNT(*) AS ucount FROM members WHERE username = '{$_POST['username']}'"),0); // If username exists, generate error and message. if($ucount > 0){ $error = true; $errors .= "Username already exists, ". "please choose another.\n\n"; } if($email_error == false){ // Verify if email address has been used already. $ecount = mysql_result(mysql_query("SELECT COUNT(*) AS ecount FROM members WHERE email_address = '{$_POST['email_address']}'"),0); // If username exists, generate error and message. if($ecount > 0){ $error = true; $errors .= "This email address has already ". "been used ". "please choose another.\n\n"; } } // If $error is TRUE, then include the singup form // and display the errors we found. if($error == true){ $errors = nl2br($errors); include $_SERVER['DOCUMENT_ROOT']. 'bpo/html/forms/membership_signup.html'; footer(); exit(); } // All checks have passed, insert user in database $sql = @mysql_query("INSERT INTO members (first_name, last_name, email_address, signup_date, bio, username, password) VALUES ('$_POST[first_name]', '$_POST[last_name]', '$_POST[email_address]', now(), '$_POST[bio]', '$_POST[username]', '".md5($_POST[password])."')"); if(!$sql){ echo "Error inserting your information into MySQL: ".mysql_error(); footer(); exit(); } $userid = mysql_insert_id(); $verify_url = "http://".$_SERVER['SERVER_NAME']. "/bpo/join.php?req=verify&id=$userid&vcode=". md5($_POST['first_name']); $mailer = &new Email; // Email user $mailer->ToMail = $_POST['email_address']; $mailer->FromMail = "admin@test.com"; $mailer->FromName = "My PHP Site Administrator"; $mailer->Subject = "Your Membership at My PHP Site"; $mailer->Message = "Dear $_POST[first_name],\n". "Thanks for joining our website! We". " welcome you and look forward to". " your participation.\n\n". "Below you will find the ". "information required to ". "Login to our website!\n\n". "First, you will need to verify". " your email address ". "by clicking on this ". "hyperlink:\n$verify_url\nand ". "following the directions in your ". " web browser.\n\n". "=====================\n". "Username: $_POST[username]\n". "Password: $_POST[password]\n". "UserID: $userid\n". "Email Address: ". "$_POST[email_address]\n". "=====================\n\n". "Thank you,\n". "My PHP Site Administrator\n". "http://$_SERVER[SERVER_NAME]\n"; $mailer->SendMail(); // Email Admin $mailer->ToMail = "eric@test.com"; $mailer->FromMail = "admin@test.com"; $mailer->FromName = "My PHP Site Administrator"; $mailer->Subject = "New Member at My PHP Site [$userid]"; $mailer->Message = "Hi,\n\n". "A new member has just signed up ". "at My PHP Site! Here's their ". " information:\n\n". "=====================\n". "First Name: $_POST[first_name]\n". "Last Name: $_POST[last_name]\n". "Email Address: ". "$_POST[email_address]\n". "UserID: $userid\n". "=====================\n\n". "Thank you,\n". "My PHP Site Administrator\n". "http://$_SERVER[SERVER_NAME]\n"; $mailer->SendMail(); // Display Success Message echo '<p align="center"><font size="4" '. 'face="Verdana, Arial, Helvetica, sans-serif">'. '<strong>Your Signup Was Successful!'. '</strong></font></p>'. '<p align="center"><font size="4" '. 'face="Verdana, Arial, Helvetica, sans-serif">'. 'Please check your email for instructions.'. '</font></p>'; // That's it! Done!break;case "verify": myheader("Verify Information"); // Perform MysQL Query: $sql = mysql_result(mysql_query("SELECT COUNT(*) AS vcount FROM members WHERE id='{$_GET['id']}' AND md5(first_name) = '{$_GET['vcode']}' "),0); if($sql == 1){ $update = mysql_query("UPDATE members SET verified='1' WHERE id='{$_GET['id']}'"); if(!$update){ echo "Error with MySQL Query: ".mysql_error(); } else { echo '<p align="center"><font size="4" '. 'face="Verdana, Arial, Helvetica, sans-serif">'. '<strong>You Have Been Verified!'. '</strong></font></p>'; include $_SERVER['DOCUMENT_ROOT']. '/bpo/html/forms/login_form.html'; } } else { echo "Sorry, Could not be verified!"; } footer();break; default: myheader("Become a Member!"); include $_SERVER['DOCUMENT_ROOT']. '/bpo/html/forms/membership_signup.html'; footer(); break;}?> i got the same message when i try to log that same user , i always get good idea n help here and i thank everybody here for that , so help me please thx , i'll be waiting for ya reply thx in advance . Quote Link to comment Share on other sites More sharing options...
realjumper Posted March 31, 2006 Share Posted March 31, 2006 Someone with more experience than me would probably be able to give you more help, but the error is more or less letting you know that the file doesn't exist. So, when try to log in as that same user, and you get the error, see that the file (the one after log in) actually exists. Maybe what you have in your code has a different file name extension perhaps?Sorry I can't be of more help Quote Link to comment Share on other sites More sharing options...
redarrow Posted March 31, 2006 Share Posted March 31, 2006 ive never worked with this statement $_SERVER['DOCUMENT_ROOT'].'/bpo/html/forms/membership_signup.html';why are you using this statement to code.include $_SERVER['DOCUMENT_ROOT'].'/bpo/html/forms/membership_signup.html';this i no but not yoursinclude(''/bpo/html/forms/membership_signup.html");sorry. Quote Link to comment Share on other sites More sharing options...
the apprentice webmaster Posted March 31, 2006 Author Share Posted March 31, 2006 [!--quoteo(post=360262:date=Mar 30 2006, 11:58 PM:name=realjumper)--][div class=\'quotetop\']QUOTE(realjumper @ Mar 30 2006, 11:58 PM) [snapback]360262[/snapback][/div][div class=\'quotemain\'][!--quotec--]Someone with more experience than me would probably be able to give you more help, but the error is more or less letting you know that the file doesn't exist. So, when try to log in as that same user, and you get the error, see that the file (the one after log in) actually exists. Maybe what you have in your code has a different file name extension perhaps?Sorry I can't be of more help[/quote]thx for your reply , really appreciate it[!--quoteo(post=360262:date=Mar 30 2006, 11:58 PM:name=realjumper)--][div class=\'quotetop\']QUOTE(realjumper @ Mar 30 2006, 11:58 PM) [snapback]360262[/snapback][/div][div class=\'quotemain\'][!--quotec--]Someone with more experience than me would probably be able to give you more help, but the error is more or less letting you know that the file doesn't exist. So, when try to log in as that same user, and you get the error, see that the file (the one after log in) actually exists. Maybe what you have in your code has a different file name extension perhaps?Sorry I can't be of more help[/quote]thx for your reply , really appreciate it Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.