Jump to content

elmas156

Members
  • Posts

    276
  • Joined

  • Last visited

Everything posted by elmas156

  1. Hello everyone, Here's what I'm trying to do: I want to have an if/else statement to say "if one thing true AND another thing is true then do something" I'm sure there's a simple solution but I don't know what it is... can anyone help please? Here's what I've got but it's not working: <?php if ($r1 > 0) AND ($r2 < 1) { echo "There is no information for widget 2."; } else { echo "There is info on widget 2."; } ?>
  2. Hello everyone, I've developed a password retrieval page so if someone forgets their password it will be sent to them in an email. I have everything working except for one thing. When the user signs up their password is sent to the database encrypted using md5 so when their password is retrieved from the database and emailed to them, it is still encrypted. Is there a way to "un-encrypt" the password before sending it to the user in an email? Here is what I have so far: <?php include("conf.inc.php"); // Includes the db and form info. session_start(); // Starts the session. $email=$_SESSION['email']; if (!isset($_POST['getpword'])) { // If the getpword form has not been submitted. $result = mysql_query("SELECT fname,question,pword FROM users WHERE email = '$email'"); $row = mysql_fetch_row($result); echo $row[1]; echo "<p><form action=\"pwordhelp2.php\" method=\"POST\"></p>"; echo "<input name=\"answer\" type=\"text\" id=\"answer\" size=\"37\" maxlength=\"50\">"; echo "<input name=\"getpword\" type=\"submit\" value=\"Get my password.\">"; } else { // The getpword form has been submitted $answer = form($_POST['answer']); $a = mysql_query("SELECT * FROM `users` WHERE answer = '$answer'") or die (mysql_error()); // mySQL Query $c = mysql_num_rows($a); // Checks to see if anything is in the db. if ($c > 0) { // If the answer is correct. $result2 = mysql_query("SELECT fname,pword FROM users WHERE email = '$email'"); $inforow = mysql_fetch_row($result2); $fname = "$inforow[0]"; $pword = "$inforow[1]"; $to = "$email"; $subject = "Alleyway Oil & Lube Password."; $message = "<html> <body> Hello $fname,<p> Your login information is listed below.</p> Email Address/User ID: $email<br> Password: '$pword'<br> <br> <a href=\"http://www.alleywayoil.com\">Click Here to Login to Alleyway Oil $ Lube</a> </body> </html>"; // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // Additional headers $headers .= 'From: Alleyway Oil & Lube <support@alleywayoil.com>' . "\r\n"; // Mail it mail($to, $subject, $message, $headers); echo "Thank you $fname, your password has been emailed to you."; echo "<br><a href=\"index.php\">Click here to login.</a>"; session_destroy(); // Destroys the session. exit(); // Stops the rest of the script. } else { echo $row[1]; echo "<font color=\"#FF0000\">That is not the answer you provided<br>"; echo "when you signed up. Please try again.</font>"; echo "<p><form action=\"pwordhelp2.php\" method=\"POST\"></p>"; echo "<input name=\"answer\" type=\"text\" id=\"answer\" size=\"37\" maxlength=\"50\">"; echo "<input name=\"getpword\" type=\"submit\" value=\"Get my password.\">"; } } ?> Thanks for any help that you can provide.
  3. I've been looking at this for 3 hours and I just can't seem to figure out what's wrong... any help would be greatly appreciated. I'm getting the following error with this code: Error: Parse error: syntax error, unexpected T_ELSE in /home/a9893922/public_html/pwordhelp.php on line 93 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Untitled Document</title> </head> <body> <div align="center"> <table width="275" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="275"> <?php include("conf.inc.php"); // Includes the db and form info. if (!isset($_POST['submit'])) { // If the form has not been submitted. echo "<p>Forgot your password?<br>"; echo "No problem, what is your email address?</p>"; echo "<p><form action=\"pwordhelp.php\" method=\"POST\"></p>"; echo "<input name=\"email\" type=\"text\" id=\"email\" size=\"37\" maxlength=\"50\">"; echo "<input name=\"submit\" type=\"submit\" value=\"Continue\">"; } else { // The form has been submitted. $email = form($_POST['email']); $q = mysql_query("SELECT * FROM `users` WHERE email = '$email'") or die (mysql_error()); // mySQL Query $r = mysql_num_rows($q); // Checks to see if anything is in the db. if ($r > 0) { // If there are users with the same email. $result = mysql_query("SELECT fname,question,pword FROM users WHERE email = '$email'"); $row = mysql_fetch_row($result); if (!isset($_POST['getpword'])) { // If "getpword" has not been submitted. echo $row[1]; echo "<p><form action=\"pwordhelp.php\" method=\"POST\"></p>"; echo "<input name=\"answer\" type=\"text\" id=\"answer\" size=\"37\" maxlength=\"50\">"; echo "<input name=\"getpword\" type=\"submit\" value=\"Get my password.\">"; } else { // If "getpword" has been submitted $answer = form($_POST['answer']); $a = mysql_query("SELECT answer FROM `users` WHERE email = '$email'") or die (mysql_error()); // mySQL Query $c = mysql_num_rows($q); // gets answer from database if ($c == $answer) { // if entered answer matches the one in database. $fname = "$row[0]"; $pword = "$row[2]"; $to = "$email"; $subject = "Alleyway Oil & Lube Password."; $message = "<html> <body> <img src=\"http://www.dfwbounce.com/Logo1.gif\"> <br> Hello $fname,<p> Your login information is listed below.</p> Email Address/User ID: $email<br> Password: $pword<br> <br> <a href=\"http://www.alleywayoil.com\">Click Here to Login to Alleyway Oil $ Lube</a> </body> </html>"; // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // Additional headers $headers .= 'From: Alleyway Oil & Lube <support@alleywayoil.com>' . "\r\n"; // Mail it mail($to, $subject, $message, $headers); echo "Thank you, your password has been emailed to you."; } else { //if answer is not right echo $row[1]; echo "<font color=\"#FF0000\">That is not the answer you provided<br>"; echo "when you signed up. Please try again.</font>"; echo "<p><form action=\"pwordhelp.php\" method=\"POST\"></p>"; echo "<input name=\"answer\" type=\"text\" id=\"answer\" size=\"37\" maxlength=\"50\">"; echo "<input name=\"getpword\" type=\"submit\" value=\"Get my password.\">"; } } } } else { //if email is not in database... THIS IS LINE 93 echo "<p><font color=\"#FF0000\">That email has not been registered.<br>"; echo "Please enter another email address or</font>"; echo "<a href=\"signup.php\">Click Here to Sign Up.</a></p>"; echo "<p><form action=\"pwordhelp.php\" method=\"POST\"></p>"; echo "<input name=\"email\" type=\"text\" id=\"email\" size=\"37\" maxlength=\"50\">"; echo "<input name=\"submit\" type=\"submit\" value=\"Continue\">"; } ?> <p> </p></td> </tr> </table> </div> </body> </html>
  4. The result that I should get on the members page when viewed is: Hello John Doe! This is the main page! Logout? But this is the result that I'm getting: Hello ! This is the main page! Logout? Here is the updated code: Index/Login Page: <?php include("conf.inc.php"); // Includes the db and form info. session_start(); // Starts the session. if ($_SESSION['logged'] == 1) { // User is already logged in. header("Location: members.php"); // Goes to main page. exit(); // Stops the rest of the script. } else { if (!isset($_POST['submit'])) { // The form has not been submitted. echo "<form action=\"index.php\" method=\"POST\">"; echo "<table width=\"150\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td><p><strong>Member Sign In</strong></p>"; echo "<p>Email Address:"; echo "<input type=\"text\" name=\"email\" id=\"email\">"; echo "Password:<br>"; echo "<input type=\"password\" name=\"pword\">"; echo "<br>"; echo "<input type=\"submit\" name=\"submit\" value=\"Submit...\">"; echo "<br>"; echo "<a href=\"signup.php\">Sign Me Up!</a><br>"; echo "<a href=\"pwordhelp.php\">Forgot Password</a></p>"; echo "</td>"; echo "</tr>"; echo "</table>"; echo "</form>"; } else { $email = form($_POST['email']); $pword = md5($_POST['pword']); // Encrypts the password. $q = mysql_query("SELECT * FROM `users` WHERE email = '$email' AND pword = '$pword'") or die (mysql_error()); // mySQL query $r = mysql_num_rows($q); // Checks to see if anything is in the db. if ($r == 1) { // There is something in the db. The username/password match up. $_SESSION['logged'] = 1; // Sets the session. $_SESSION['email'] = $email; header("Location: members.php"); // Goes to main page. exit(); // Stops the rest of the script. } else { // Invalid username/password. echo "<form action=\"index.php\" method=\"POST\">"; echo "<table width=\"150\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td><p><strong>Member Sign In</strong></p>"; echo "<p><font color=\"#FF0000\">Incorrect Email or Password, please try again.</font></p>"; echo "<p>Email Address:"; echo "<input name=\"email\" type=\"text\" id=\"email\" value=\"$email\">"; echo "Password:<br>"; echo "<input type=\"password\" name=\"pword\">"; echo "<br>"; echo "<input type=\"submit\" name=\"submit\" value=\"Submit...\">"; echo "<br>"; echo "<a href=\"signup.php\">Sign Me Up!</a><br>"; echo "<a href=\"pwordhelp.php\">Forgot Password</a></p>"; echo "</td>"; echo "</tr>"; echo "</table>"; echo "</form>"; } } } mysql_close($db_connect); // Closes the connection. ?> Members Page: <?php $email=$_SESSION['email']; include("conf.inc.php"); // Includes the db and form info. session_start(); // Starts the session. if ($_SESSION['logged'] != 1) { // There was no session found! header("Location: index.php"); // Goes to login page. exit(); // Stops the rest of the script. } $result = mysql_query("SELECT fname,lname FROM users WHERE email = '$email'"); if (!$result) { echo 'Could not run query: ' . mysql_error(); exit; } $row = mysql_fetch_row($result); echo "Hello "; echo $row[0]; echo " "; echo $row[1]; echo "!<br>"; echo "This is the main page!"; echo "<br />"; echo "<a href=\"logout.php\">Logout?</a>" ?>
  5. OK, I've tried this in several different variations and it's not working... any other ideas?
  6. that's my question, how do I send it in a session or using $_POST without changing the whole form? Or does anyone see a problem with leaving it the way it is? Let the opinions roll in :-)
  7. Here's what I'm trying to do... When users sign in on the index page using their email address and a passord, a session is started and they are redirected to the members page using header("Location: somepage.php"); What I want to do is to transfer the $email variable to the next page because I use it as the unique field in every table in my database. Basically, once a user is signed in and sent to the members page, the variable $email is also sent to the members page set as whatever email they just signed in with. This way the page can look in different tables to pull out different information without the user having to enter their email address again because it's already there. I have figured out how to do this using the $_GET function and just adding the information to the end of the page name that the page is redirected to but I'm wondering if there might be a better or more efficient way of doing it. Here is the code to both pages. Index/Login Page: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Untitled Document</title> </head> <body> <?php include("conf.inc.php"); // Includes the db and form info. session_start(); // Starts the session. if ($_SESSION['logged'] == 1) { // User is already logged in. header("Location: members.php"); // Goes to main page. exit(); // Stops the rest of the script. } else { if (!isset($_POST['submit'])) { // The form has not been submitted. echo "<form action=\"index.php\" method=\"POST\">"; echo "<table width=\"150\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td><p><strong>Member Sign In</strong></p>"; echo "<p>Email Address:"; echo "<input type=\"text\" name=\"email\" id=\"email\">"; echo "Password:<br>"; echo "<input type=\"password\" name=\"pword\">"; echo "<br>"; echo "<input type=\"submit\" name=\"submit\" value=\"Submit...\">"; echo "<br>"; echo "<a href=\"signup.php\">Sign Me Up!</a><br>"; echo "<a href=\"pwordhelp.php\">Forgot Password</a></p>"; echo "</td>"; echo "</tr>"; echo "</table>"; echo "</form>"; } else { $email = form($_POST['email']); $pword = md5($_POST['pword']); // Encrypts the password. $q = mysql_query("SELECT * FROM `users` WHERE email = '$email' AND pword = '$pword'") or die (mysql_error()); // mySQL query $r = mysql_num_rows($q); // Checks to see if anything is in the db. if ($r == 1) { // There is something in the db. The username/password match up. $_SESSION['logged'] = 1; // Sets the session. header("Location: members.php?email=$email"); // Goes to main page. exit(); // Stops the rest of the script. } else { // Invalid username/password. echo "<form action=\"index.php\" method=\"POST\">"; echo "<table width=\"150\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td><p><strong>Member Sign In</strong></p>"; echo "<p><font color=\"#FF0000\">Incorrect Email or Password, please try again.</font></p>"; echo "<p>Email Address:"; echo "<input name=\"email\" type=\"text\" id=\"email\" value=\"$email\">"; echo "Password:<br>"; echo "<input type=\"password\" name=\"pword\">"; echo "<br>"; echo "<input type=\"submit\" name=\"submit\" value=\"Submit...\">"; echo "<br>"; echo "<a href=\"signup.php\">Sign Me Up!</a><br>"; echo "<a href=\"pwordhelp.php\">Forgot Password</a></p>"; echo "</td>"; echo "</tr>"; echo "</table>"; echo "</form>"; } } } mysql_close($db_connect); // Closes the connection. ?> </body> </html> Members Page: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Untitled Document</title> </head> <body> <?php $email=$_GET['email']; include("conf.inc.php"); // Includes the db and form info. session_start(); // Starts the session. if ($_SESSION['logged'] != 1) { // There was no session found! header("Location: login.php"); // Goes to login page. exit(); // Stops the rest of the script. } $result = mysql_query("SELECT fname,lname FROM users WHERE email = '$email'"); if (!$result) { echo 'Could not run query: ' . mysql_error(); exit; } $row = mysql_fetch_row($result); echo "Hello "; echo $row[0]; echo " "; echo $row[1]; echo "!<br>"; echo "This is the main page!"; echo "<br />"; echo "<a href=\"logout.php\">Logout?</a>" ?> </body> </html>
  8. Ok, before anyone says anything... i know that I posted this in the MySQL help section but then I thought... "Is this really a MySQL question or is it a PHP question because my goal is to actually make info from a MySQL field into a variable?" Anyway, here is my question: I'm trying to select from a MySQL database a certain piece of information and display it on the page. For example: After a user has signed up and logged in to the website, I want to select "firstname" from "usertable" where "email" = $email. The problem I'm having is trying to make "firstname" into a variable so that I can display it on the page to say something like: "Welcome $firstname". I've gone over the database tutorial on here but I didn't see anywhere that it covered taking a single field from a table and turning it into a variable. Any suggestions? Thanks for your help.
  9. Hello everyone, This question seems to me like it would be pretty basic but I haven't found the way to do it, maybe I'm looking in the wrong places... Anyway, I'm trying to select from a database a certain piece of information and display it on the page. For example: After a user has signed up and logged in to the website, I want to select "username" from "users table" where "email" = $email. The problem I'm having is trying to make "username" into a variable so that I can display it on the page to say something like: "Welcome $username". I've gone over the database tutorial on here but I didn't see anywhere that it covered taking a single field from a table and turning it into a variable. Any suggestions? Thanks for your help.
  10. Why does my code work with some web hosting companies but not on others? I'm blowing my mind trying to make things work on one server but if I upload to a different server to test it, it works fine. What am I missing???
  11. OK, here is the code for the entire page, from top to bottom. As you probably already know, I'm very new to PHP, therefore I'm still learning alot. <html> <head> <title>Alleyway Oil & Lube Customer Sign-up</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script language="JavaScript"> <!-- function validate(form) { if (form.fname.value.length == 0) { alert("Please enter your first name.") form.fname.focus() return false } if (form.lname.value.length == 0) { alert("Please enter your last name.") form.lname.focus() return false } if (form.haddress.value.length == 0) { alert("Please enter your home address.") form.haddress.focus() return false } if (form.hcity.value.length == 0) { alert("Please enter the city you live in.") form.hcity.focus() return false } if (form.hzip.value.length < 5) { alert("Please enter your 5 digit zip code."); form.hzip.focus(); return false; } if (form.hphone.value.length < 10) { alert("Please enter your home phone number, including area code.."); form.hphone.focus(); return false; } if (form.email.value.indexOf("@") == -1) { alert("Please enter a valid e-mail address."); form.email.focus(); return false; } if (form.email.value.indexOf(".") == -1) { alert("Please enter a valid e-mail address."); form.email.focus(); return false; } if (form.pword.value.length < 6) { alert("Your password must contain at least 6 charachters."); form.pword.focus(); return false; } if (form.pword.value != form.pword2.value) { alert("The passwords that you entered do not match. Please check your password and type it again"); form.pword2.focus(); return false; } if (form.question.value == 0) { alert("Please choose a security question."); form.question.focus(); return false; } if (form.answer.value.length == 0) { alert("Please enter an answer to your security question before continuing."); form.answer.focus(); return false; } } //--> </script> <script language="JavaScript" type="text/JavaScript"> <!-- function MM_reloadPage(init) { //reloads the window if Nav4 resized if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) { document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }} else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload(); } MM_reloadPage(true); function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_nbGroup(event, grpName) { //v6.0 var i,img,nbArr,args=MM_nbGroup.arguments; if (event == "init" && args.length > 2) { if ((img = MM_findObj(args[2])) != null && !img.MM_init) { img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src; if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array(); nbArr[nbArr.length] = img; for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) { if (!img.MM_up) img.MM_up = img.src; img.src = img.MM_dn = args[i+1]; nbArr[nbArr.length] = img; } } } else if (event == "over") { document.MM_nbOver = nbArr = new Array(); for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) { if (!img.MM_up) img.MM_up = img.src; img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])? args[i+1] : img.MM_up); nbArr[nbArr.length] = img; } } else if (event == "out" ) { for (i=0; i < document.MM_nbOver.length; i++) { img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; } } else if (event == "down") { nbArr = document[grpName]; if (nbArr) for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; } document[grpName] = nbArr = new Array(); for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) { if (!img.MM_up) img.MM_up = img.src; img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up; nbArr[nbArr.length] = img; } } } //--> </script> <style type="text/css"> <!-- body { background-color: #000000; background-image: url(../bg.jpg); } --> </style></head> <body> <?php include("conf.inc.php"); // Includes the db and form info. if (!isset($_POST['submit'])) { // If the form has not been submitted. echo "<form action=\"signup.php\" method=\"POST\">"; echo "<div align=\"center\">"; echo "<table width=\"645\" border=\"2\" cellpadding=\"0\" cellspacing=\"0\" bordercolor=\"#FFFFFF\">"; echo "<tr>"; echo "<td width=\"640\" height=\"321\" align=\"center\" valign=\"top\">"; echo "<p align=\"left\"><strong><font color=\"#FFFFFF\" size=\"5\"> Customer Sign-Up...<br>"; echo "</font></strong><font color=\"#FF0000\"> The following information will be used only to contact you regarding your service.</font></p>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td width=\"187\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">First Name:</font></strong></td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<input name=\"fname\" type=\"text\" id=\"fname\" size=\"37\" maxlength=\"25\">"; echo "</td>"; echo "</tr>"; echo "</table><br>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td width=\"187\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">Last Name:</font></strong></td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<input name=\"lname\" type=\"text\" id=\"lname\" size=\"37\" maxlength=\"25\">"; echo "</td>"; echo "</tr>"; echo "</table><br>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td width=\"187\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">Home Address:</font></strong></td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<input name=\"haddress\" type=\"text\" id=\"haddress\" size=\"37\" maxlength=\"35\">"; echo "</td>"; echo "</tr>"; echo "</table><br>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td width=\"187\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">City, State & Zip:</font></strong></td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<input name=\"hcity\" type=\"text\" id=\"hcity\" size=\"18\" maxlength=\"20\">"; echo ","; echo "<select name=\"hstate\" id=\"hstate\">"; echo "<option value=\"AL\">AL</option>"; echo "<option value=\"AK\">AK</option>"; echo "<option value=\"AZ\">AZ</option>"; echo "<option value=\"AR\">AR</option>"; echo "<option value=\"CA\">CA</option>"; echo "<option value=\"CO\">CO</option>"; echo "<option value=\"CT\">CT</option>"; echo "<option value=\"DE\">DE</option>"; echo "<option value=\"DC\">DC</option>"; echo "<option value=\"FL\">FL</option>"; echo "<option value=\"GA\">GA</option>"; echo "<option value=\"HI\">HI</option>"; echo "<option value=\"ID\">ID</option>"; echo "<option value=\"IL\">IL</option>"; echo "<option value=\"IN\">IN</option>"; echo "<option value=\"IA\">IA</option>"; echo "<option value=\"KS\">KS</option>"; echo "<option value=\"KY\">KY</option>"; echo "<option value=\"LA\">LA</option>"; echo "<option value=\"ME\">ME</option>"; echo "<option value=\"MD\">MD</option>"; echo "<option value=\"MA\">MA</option>"; echo "<option value=\"MI\">MI</option>"; echo "<option value=\"MN\">MN</option>"; echo "<option value=\"MS\">MS</option>"; echo "<option value=\"MO\">MO</option>"; echo "<option value=\"MT\">MT</option>"; echo "<option value=\"NE\">NE</option>"; echo "<option value=\"NV\">NV</option>"; echo "<option value=\"NH\">NH</option>"; echo "<option value=\"NJ\">NJ</option>"; echo "<option value=\"NM\">NM</option>"; echo "<option value=\"NY\">NY</option>"; echo "<option value=\"NC\">NC</option>"; echo "<option value=\"ND\">ND</option>"; echo "<option value=\"OH\">OH</option>"; echo "<option value=\"OK\">OK</option>"; echo "<option value=\"OR\">OR</option>"; echo "<option value=\"PA\">PA</option>"; echo "<option value=\"RI\">RI</option>"; echo "<option value=\"SC\">SC</option>"; echo "<option value=\"SD\">SD</option>"; echo "<option value=\"TN\">TN</option>"; echo "<option value=\"TX\" selected>TX</option>"; echo "<option value=\"UT\">UT</option>"; echo "<option value=\"VT\">VT</option>"; echo "<option value=\"VA\">VA</option>"; echo "<option value=\"WA\">WA</option>"; echo "<option value=\"WV\">WV</option>"; echo "<option value=\"WI\">WI</option>"; echo "<option value=\"WY\">WY</option>"; echo "</select>"; echo " <input name=\"hzip\" type=\"text\" id=\"hzip\" size=\"3\" maxlength=\"5\">"; echo "</td>"; echo "</tr>"; echo "</table><br>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td width=\"187\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">Home Phone:</font></strong></td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<input name=\"hphone\" type=\"text\" id=\"hphone\" size=\"37\" maxlength=\"14\">"; echo "<font size=\"2\"><br>"; echo "<font color=\"#999999\">Include area code (i.e. 940-555-1234)</font></font></td>"; echo "</tr>"; echo "</table><br>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td width=\"187\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">Email Address:</font></strong></td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<input name=\"email\" type=\"text\" id=\"email\" size=\"37\" maxlength=\"40\">"; echo "<br>"; echo "<font color=\"#999999\" size=\"2\">(Your email will also be your user ID.)</font></td>"; echo "</tr>"; echo "</table><br>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td width=\"187\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">Choose a Password:</font></strong></td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<input name=\"pword\" type=\"password\" id=\"pword\" size=\"37\" maxlength=\"20\">"; echo "<br>"; echo "<font color=\"#999999\"size=\"2\">(Minimum of 6 characters in length.)</font></td>"; echo "</tr>"; echo "</table><br>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td width=\"187\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">Re-enter Password:</font></strong></td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<input name=\"pword2\" type=\"password\" id=\"pword2\" size=\"37\" maxlength=\"20\">"; echo "</td>"; echo "</tr>"; echo "</table><br>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td width=\"187\" height=\"24\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">Security Question:</font></strong></td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<select name=\"question\" id=\"question\">"; echo "<option value=\"0\" selected>--Choose a security question--</option>"; echo "<option value=\"What was your high school mascot?\">What was your high school mascot?</option>"; echo "<option value=\"What is your mother's maiden name?\">What is your mother's maiden name?</option>"; echo "<option value=\"What was your first car?\">What was your first car?</option>"; echo "<option value=\"Who was your favorite teacher?\">Who was your favorite teacher?</option>"; echo "<option value=\"What is your library card number?\">What is your library card number?</option>"; echo "</select>"; echo "</td>"; echo "</tr>"; echo "</table><br>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td width=\"187\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">Answer:</font></strong></td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<input name=\"answer\" type=\"text\" id=\"answer\" size=\"37\" maxlength=\"35\">"; echo "</td>"; echo "</tr>"; echo "</table><br>"; echo "<table width=\"625\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">"; echo "<tr>"; echo "<td width=\"187\" height=\"102\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">Terms of Service:</font></strong></td>"; echo "<td width=\"438\" align=\"right\" valign=\"top\">"; echo "<textarea cols=\"40\" rows=\"5\" readonly=\"readonly\" wrap=\"VIRTUAL\" style=\"width:100%;text-align:\" onfocus=\"this.rows=10\">"; echo "Terms of Service text goes here."; echo "</textarea>"; echo "</td>"; echo "</tr>"; echo "</table>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td> </td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\"><font color=\"#FFFFFF\">"; echo "By clicking 'I accept' below, you are agreeing to the Terms of Service and the Alleyway Oil & Lube Service Agreement.</font></td>"; echo "</tr>"; echo "</table>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td> </td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<div align=\"left\">"; echo "<input name=\"submit\" type=\"submit\" value=\"I accept, continue to my account.\" onClick=\"return validate(form)\">"; echo "</div></td>"; echo "</tr>"; echo "</table>"; echo "<br>"; echo "</td>"; echo "</tr>"; echo "</table>"; echo "</div>"; echo "</form>"; } else { // The form has been submitted. $fname = form($_POST['fname']); $lname = form($_POST['lname']); $haddress = form($_POST['haddress']); $hcity = form($_POST['hcity']); $hstate = form($_POST['hstate']); $hzip = form($_POST['hzip']); $hphone = form($_POST['hphone']); $email = form($_POST['email']); $pword = md5($_POST['pword']); // Encrypts the password. $question = form($_POST['question']); $answer = form($_POST['answer']); $q = mysql_query("SELECT * FROM `users` WHERE email = '$email'") or die (mysql_error()); // mySQL Query $r = mysql_num_rows($q); // Checks to see if anything is in the db. if ($r > 0) { // If there are users with the same email. exit("That email is already registered!"); } else { mysql_query("INSERT INTO `users` (fname,lname,haddress,hcity,hstate,hzip,hphone,email,pword,question,answer) VALUES ('$fname','$lname','$haddress','$hcity','$hstate','$hzip','$hphone','$email','$pword','$question','$answer')") or die (mysql_error()); // Inserts the user info. header("Location: login.php"); // Back to login. } } mysql_close($db_connect); // Closes the connection. ?> </body> </html>
  12. I tried it but I still get the same error message...
  13. I had a problem with this the other day and I thought I had fixed it but I guess not. With the following code, after the form is submitted, everything is submitted to the database like it is supposed to be but the page doesn't redirect to the login page as it should and I'm getting this error message: Warning: Cannot modify header information - headers already sent by (output started at /home/content/a/l/l/alleywayoil/html/signup.php:6) in /home/content/a/l/l/alleywayoil/html/signup.php on line 383 Here is the code: <?php include("conf.inc.php"); // Includes the db and form info. if (!isset($_POST['submit'])) { // If the form has not been submitted. echo "<form action=\"signup.php\" method=\"POST\">"; echo "<div align=\"center\">"; echo "<table width=\"645\" border=\"2\" cellpadding=\"0\" cellspacing=\"0\" bordercolor=\"#FFFFFF\">"; echo "<tr>"; echo "<td width=\"640\" height=\"321\" align=\"center\" valign=\"top\">"; echo "<p align=\"left\"><strong><font color=\"#FFFFFF\" size=\"5\"> Customer Sign-Up...<br>"; echo "</font></strong><font color=\"#FF0000\"> The following information will be used only to contact you regarding your service.</font></p>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td width=\"187\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">First Name:</font></strong></td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<input name=\"fname\" type=\"text\" id=\"fname\" size=\"37\" maxlength=\"25\">"; echo "</td>"; echo "</tr>"; echo "</table><br>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td width=\"187\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">Last Name:</font></strong></td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<input name=\"lname\" type=\"text\" id=\"lname\" size=\"37\" maxlength=\"25\">"; echo "</td>"; echo "</tr>"; echo "</table><br>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td width=\"187\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">Home Address:</font></strong></td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<input name=\"haddress\" type=\"text\" id=\"haddress\" size=\"37\" maxlength=\"35\">"; echo "</td>"; echo "</tr>"; echo "</table><br>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td width=\"187\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">City, State & Zip:</font></strong></td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<input name=\"hcity\" type=\"text\" id=\"hcity\" size=\"18\" maxlength=\"20\">"; echo ","; echo "<select name=\"hstate\" id=\"hstate\">"; echo "<option value=\"AL\">AL</option>"; echo "<option value=\"AK\">AK</option>"; echo "<option value=\"AZ\">AZ</option>"; echo "<option value=\"AR\">AR</option>"; echo "<option value=\"CA\">CA</option>"; echo "<option value=\"CO\">CO</option>"; echo "<option value=\"CT\">CT</option>"; echo "<option value=\"DE\">DE</option>"; echo "<option value=\"DC\">DC</option>"; echo "<option value=\"FL\">FL</option>"; echo "<option value=\"GA\">GA</option>"; echo "<option value=\"HI\">HI</option>"; echo "<option value=\"ID\">ID</option>"; echo "<option value=\"IL\">IL</option>"; echo "<option value=\"IN\">IN</option>"; echo "<option value=\"IA\">IA</option>"; echo "<option value=\"KS\">KS</option>"; echo "<option value=\"KY\">KY</option>"; echo "<option value=\"LA\">LA</option>"; echo "<option value=\"ME\">ME</option>"; echo "<option value=\"MD\">MD</option>"; echo "<option value=\"MA\">MA</option>"; echo "<option value=\"MI\">MI</option>"; echo "<option value=\"MN\">MN</option>"; echo "<option value=\"MS\">MS</option>"; echo "<option value=\"MO\">MO</option>"; echo "<option value=\"MT\">MT</option>"; echo "<option value=\"NE\">NE</option>"; echo "<option value=\"NV\">NV</option>"; echo "<option value=\"NH\">NH</option>"; echo "<option value=\"NJ\">NJ</option>"; echo "<option value=\"NM\">NM</option>"; echo "<option value=\"NY\">NY</option>"; echo "<option value=\"NC\">NC</option>"; echo "<option value=\"ND\">ND</option>"; echo "<option value=\"OH\">OH</option>"; echo "<option value=\"OK\">OK</option>"; echo "<option value=\"OR\">OR</option>"; echo "<option value=\"PA\">PA</option>"; echo "<option value=\"RI\">RI</option>"; echo "<option value=\"SC\">SC</option>"; echo "<option value=\"SD\">SD</option>"; echo "<option value=\"TN\">TN</option>"; echo "<option value=\"TX\" selected>TX</option>"; echo "<option value=\"UT\">UT</option>"; echo "<option value=\"VT\">VT</option>"; echo "<option value=\"VA\">VA</option>"; echo "<option value=\"WA\">WA</option>"; echo "<option value=\"WV\">WV</option>"; echo "<option value=\"WI\">WI</option>"; echo "<option value=\"WY\">WY</option>"; echo "</select>"; echo " <input name=\"hzip\" type=\"text\" id=\"hzip\" size=\"3\" maxlength=\"5\">"; echo "</td>"; echo "</tr>"; echo "</table><br>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td width=\"187\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">Home Phone:</font></strong></td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<input name=\"hphone\" type=\"text\" id=\"hphone\" size=\"37\" maxlength=\"14\">"; echo "<font size=\"2\"><br>"; echo "<font color=\"#999999\">Include area code (i.e. 940-555-1234)</font></font></td>"; echo "</tr>"; echo "</table><br>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td width=\"187\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">Email Address:</font></strong></td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<input name=\"email\" type=\"text\" id=\"email\" size=\"37\" maxlength=\"40\">"; echo "<br>"; echo "<font color=\"#999999\" size=\"2\">(Your email will also be your user ID.)</font></td>"; echo "</tr>"; echo "</table><br>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td width=\"187\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">Choose a Password:</font></strong></td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<input name=\"pword\" type=\"password\" id=\"pword\" size=\"37\" maxlength=\"20\">"; echo "<br>"; echo "<font color=\"#999999\"size=\"2\">(Minimum of 6 characters in length.)</font></td>"; echo "</tr>"; echo "</table><br>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td width=\"187\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">Re-enter Password:</font></strong></td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<input name=\"pword2\" type=\"password\" id=\"pword2\" size=\"37\" maxlength=\"20\">"; echo "</td>"; echo "</tr>"; echo "</table><br>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td width=\"187\" height=\"24\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">Security Question:</font></strong></td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<select name=\"question\" id=\"question\">"; echo "<option value=\"0\" selected>--Choose a security question--</option>"; echo "<option value=\"What was your high school mascot?\">What was your high school mascot?</option>"; echo "<option value=\"What is your mother's maiden name?\">What is your mother's maiden name?</option>"; echo "<option value=\"What was your first car?\">What was your first car?</option>"; echo "<option value=\"Who was your favorite teacher?\">Who was your favorite teacher?</option>"; echo "<option value=\"What is your library card number?\">What is your library card number?</option>"; echo "</select>"; echo "</td>"; echo "</tr>"; echo "</table><br>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td width=\"187\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">Answer:</font></strong></td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<input name=\"answer\" type=\"text\" id=\"answer\" size=\"37\" maxlength=\"35\">"; echo "</td>"; echo "</tr>"; echo "</table><br>"; echo "<table width=\"625\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">"; echo "<tr>"; echo "<td width=\"187\" height=\"102\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">Terms of Service:</font></strong></td>"; echo "<td width=\"438\" align=\"right\" valign=\"top\">"; echo "<textarea cols=\"40\" rows=\"5\" readonly=\"readonly\" wrap=\"VIRTUAL\" style=\"width:100%;text-align:\" onfocus=\"this.rows=10\">"; echo "Terms of Service text goes here."; echo "</textarea>"; echo "</td>"; echo "</tr>"; echo "</table>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td> </td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\"><font color=\"#FFFFFF\">"; echo "By clicking 'I accept' below, you are agreeing to the Terms of Service and the Alleyway Oil & Lube Service Agreement.</font></td>"; echo "</tr>"; echo "</table>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td> </td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<div align=\"left\">"; echo "<input name=\"submit\" type=\"submit\" value=\"I accept, continue to my account.\" onClick=\"return validate(form)\">"; echo "</div></td>"; echo "</tr>"; echo "</table>"; echo "<br>"; echo "</td>"; echo "</tr>"; echo "</table>"; echo "</div>"; echo "</form>"; } else { // The form has been submitted. $fname = form($_POST['fname']); $lname = form($_POST['lname']); $haddress = form($_POST['haddress']); $hcity = form($_POST['hcity']); $hstate = form($_POST['hstate']); $hzip = form($_POST['hzip']); $hphone = form($_POST['hphone']); $email = form($_POST['email']); $pword = md5($_POST['pword']); // Encrypts the password. $question = form($_POST['question']); $answer = form($_POST['answer']); $q = mysql_query("SELECT * FROM `users` WHERE email = '$email'") or die (mysql_error()); // mySQL Query $r = mysql_num_rows($q); // Checks to see if anything is in the db. if ($r > 0) { // If there are users with the same email. exit("That email is already registered!"); } else { mysql_query("INSERT INTO `users` (fname,lname,haddress,hcity,hstate,hzip,hphone,email,pword,question,answer) VALUES ('$fname','$lname','$haddress','$hcity','$hstate','$hzip','$hphone','$email','$pword','$question','$answer')") or die (mysql_error()); // Inserts the user info. header("Location: login.php"); // Back to login. (THIS IS LINE 383, WHERE THE PROBLEM IS) } } mysql_close($db_connect); // Closes the connection. ?> I've also thought about using this code to get the job done: <meta http-equiv=\"refresh" CONTENT=\"1; URL=\"login.php\"> but there has to be a more efficient way. Any ideas? Thanks for your help.
  14. OK everyone, thanks for the help but what I was doing was working all along. I'm using a free web hosting service to test my site until I get it finished and I guess there was some function that was disabled or something because when I tried it using a different hosting company it worked fine. Sorry to waste everyone's time.
  15. OK, I've tried both of your suggestions but neither worked... I basically made it to where if the form has been submitted it would insert the information into the data base and if not the form is displayed. The code worked fine except it didn't redirect to the login page... same problem as before. Any other ideas?
  16. OK, I posted earlier about some code that I was having a problem with and you guys were extremely helpful so the problem was solved in just a few minutes. Here's the same code, different problem: When the page is visited the code checks to see if the form on the page has been submitted, if not it shows the form. When the form is submitted the information is inserted into the database and the page should redirect to the login page. The problem is, the page isn't redirecting, it just reloads the same page and, because the form has been submitted, the page is now blank. Can anyone help out and let me know why the page isn't redirecting to the login page? Thanks in advance for your help. Here is the code: <?php include("conf.inc.php"); // Includes the db and form info. if (!isset($_POST['submit'])) { // If the form has not been submitted. echo "<form action=\"signup.php\" method=\"POST\">"; echo "<div align=\"center\">"; echo "<table width=\"645\" border=\"2\" cellpadding=\"0\" cellspacing=\"0\" bordercolor=\"#FFFFFF\">"; echo "<tr>"; echo "<td width=\"640\" height=\"321\" align=\"center\" valign=\"top\">"; echo "<p align=\"left\"><strong><font color=\"#FFFFFF\" size=\"5\"> Customer Sign-Up...<br>"; echo "</font></strong><font color=\"#FF0000\"> The following information will be used only to contact you regarding your service.</font></p>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td width=\"187\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">First Name:</font></strong></td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<input name=\"fname\" type=\"text\" id=\"fname\" size=\"37\" maxlength=\"25\">"; echo "</td>"; echo "</tr>"; echo "</table><br>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td width=\"187\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">Last Name:</font></strong></td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<input name=\"lname\" type=\"text\" id=\"lname\" size=\"37\" maxlength=\"25\">"; echo "</td>"; echo "</tr>"; echo "</table><br>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td width=\"187\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">Home Address:</font></strong></td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<input name=\"haddress\" type=\"text\" id=\"haddress\" size=\"37\" maxlength=\"35\">"; echo "</td>"; echo "</tr>"; echo "</table><br>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td width=\"187\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">City, State & Zip:</font></strong></td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<input name=\"hcity\" type=\"text\" id=\"hcity\" size=\"18\" maxlength=\"20\">"; echo ","; echo "<select name=\"hstate\" id=\"hstate\">"; echo "<option value=\"AL\">AL</option>"; echo "<option value=\"AK\">AK</option>"; echo "<option value=\"AZ\">AZ</option>"; echo "<option value=\"AR\">AR</option>"; echo "<option value=\"CA\">CA</option>"; echo "<option value=\"CO\">CO</option>"; echo "<option value=\"CT\">CT</option>"; echo "<option value=\"DE\">DE</option>"; echo "<option value=\"DC\">DC</option>"; echo "<option value=\"FL\">FL</option>"; echo "<option value=\"GA\">GA</option>"; echo "<option value=\"HI\">HI</option>"; echo "<option value=\"ID\">ID</option>"; echo "<option value=\"IL\">IL</option>"; echo "<option value=\"IN\">IN</option>"; echo "<option value=\"IA\">IA</option>"; echo "<option value=\"KS\">KS</option>"; echo "<option value=\"KY\">KY</option>"; echo "<option value=\"LA\">LA</option>"; echo "<option value=\"ME\">ME</option>"; echo "<option value=\"MD\">MD</option>"; echo "<option value=\"MA\">MA</option>"; echo "<option value=\"MI\">MI</option>"; echo "<option value=\"MN\">MN</option>"; echo "<option value=\"MS\">MS</option>"; echo "<option value=\"MO\">MO</option>"; echo "<option value=\"MT\">MT</option>"; echo "<option value=\"NE\">NE</option>"; echo "<option value=\"NV\">NV</option>"; echo "<option value=\"NH\">NH</option>"; echo "<option value=\"NJ\">NJ</option>"; echo "<option value=\"NM\">NM</option>"; echo "<option value=\"NY\">NY</option>"; echo "<option value=\"NC\">NC</option>"; echo "<option value=\"ND\">ND</option>"; echo "<option value=\"OH\">OH</option>"; echo "<option value=\"OK\">OK</option>"; echo "<option value=\"OR\">OR</option>"; echo "<option value=\"PA\">PA</option>"; echo "<option value=\"RI\">RI</option>"; echo "<option value=\"SC\">SC</option>"; echo "<option value=\"SD\">SD</option>"; echo "<option value=\"TN\">TN</option>"; echo "<option value=\"TX\" selected>TX</option>"; echo "<option value=\"UT\">UT</option>"; echo "<option value=\"VT\">VT</option>"; echo "<option value=\"VA\">VA</option>"; echo "<option value=\"WA\">WA</option>"; echo "<option value=\"WV\">WV</option>"; echo "<option value=\"WI\">WI</option>"; echo "<option value=\"WY\">WY</option>"; echo "</select>"; echo " <input name=\"hzip\" type=\"text\" id=\"hzip\" size=\"3\" maxlength=\"5\">"; echo "</td>"; echo "</tr>"; echo "</table><br>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td width=\"187\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">Home Phone:</font></strong></td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<input name=\"hphone\" type=\"text\" id=\"hphone\" size=\"37\" maxlength=\"14\">"; echo "<font size=\"2\"><br>"; echo "<font color=\"#999999\">Include area code (i.e. 940-555-1234)</font></font></td>"; echo "</tr>"; echo "</table><br>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td width=\"187\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">Email Address:</font></strong></td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<input name=\"email\" type=\"text\" id=\"email\" size=\"37\" maxlength=\"40\">"; echo "<br>"; echo "<font color=\"#999999\" size=\"2\">(Your email will also be your user ID.)</font></td>"; echo "</tr>"; echo "</table><br>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td width=\"187\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">Choose a Password:</font></strong></td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<input name=\"pword\" type=\"password\" id=\"pword\" size=\"37\" maxlength=\"20\">"; echo "<br>"; echo "<font color=\"#999999\"size=\"2\">(Minimum of 6 characters in length.)</font></td>"; echo "</tr>"; echo "</table><br>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td width=\"187\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">Re-enter Password:</font></strong></td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<input name=\"pword2\" type=\"password\" id=\"pword2\" size=\"37\" maxlength=\"20\">"; echo "</td>"; echo "</tr>"; echo "</table><br>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td width=\"187\" height=\"24\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">Security Question:</font></strong></td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<select name=\"question\" id=\"question\">"; echo "<option value=\"0\" selected>--Choose a security question--</option>"; echo "<option value=\"What was your high school mascot?\">What was your high school mascot?</option>"; echo "<option value=\"What is your mother's maiden name?\">What is your mother's maiden name?</option>"; echo "<option value=\"What was your first car?\">What was your first car?</option>"; echo "<option value=\"Who was your favorite teacher?\">Who was your favorite teacher?</option>"; echo "<option value=\"What is your library card number?\">What is your library card number?</option>"; echo "</select>"; echo "</td>"; echo "</tr>"; echo "</table><br>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td width=\"187\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">Answer:</font></strong></td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<input name=\"answer\" type=\"text\" id=\"answer\" size=\"37\" maxlength=\"35\">"; echo "</td>"; echo "</tr>"; echo "</table><br>"; echo "<table width=\"625\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">"; echo "<tr>"; echo "<td width=\"187\" height=\"102\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">Terms of Service:</font></strong></td>"; echo "<td width=\"438\" align=\"right\" valign=\"top\">"; echo "<textarea cols=\"40\" rows=\"5\" readonly=\"readonly\" wrap=\"VIRTUAL\" style=\"width:100%;text-align:\" onfocus=\"this.rows=10\">"; echo "Terms of Service text goes here."; echo "</textarea>"; echo "</td>"; echo "</tr>"; echo "</table>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td> </td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\"><font color=\"#FFFFFF\">"; echo "By clicking 'I accept' below, you are agreeing to the Terms of Service and the Alleyway Oil & Lube Service Agreement.</font></td>"; echo "</tr>"; echo "</table>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td> </td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<div align=\"left\">"; echo "<input name=\"submit\" type=\"submit\" value=\"I accept, continue to my account.\" onClick=\"return validate(form)\">"; echo "</div></td>"; echo "</tr>"; echo "</table>"; echo "<br>"; echo "</td>"; echo "</tr>"; echo "</table>"; echo "</div>"; echo "</form>"; } else { // The form has been submitted. $fname = form($_POST['fname']); $lname = form($_POST['lname']); $haddress = form($_POST['haddress']); $hcity = form($_POST['hcity']); $hstate = form($_POST['hstate']); $hzip = form($_POST['hzip']); $hphone = form($_POST['hphone']); $email = form($_POST['email']); $pword = md5($_POST['pword']); // Encrypts the password. $question = form($_POST['question']); $answer = form($_POST['answer']); $q = mysql_query("SELECT * FROM `users` WHERE email = '$email'") or die (mysql_error()); // mySQL Query $r = mysql_num_rows($q); // Checks to see if anything is in the db. if ($r > 0) { // If there are users with the same email. exit("That email is already registered!"); } else { mysql_query("INSERT INTO `users` (fname,lname,haddress,hcity,hstate,hzip,hphone,email,pword,question,answer) VALUES ('$fname','$lname','$haddress','$hcity','$hstate','$hzip','$hphone','$email','$pword','$question','$answer')") or die (mysql_error()); // Inserts the user info. header("Location: login.php"); // Back to login. } } mysql_close($db_connect); // Closes the connection. ?>
  17. so it's something that would have to be done at the server rather than my browser... oh well, Barand, your suggestion did it. that was the only thing that was wrong. Thanks!
  18. I'm fairly new to PHP and, as most, I'm learning as I go. I'm creating a membership system and using some ideas from unidox's tutorial but I'm having some problems. Basically when I upload the following page, it is totally blank when viewed. The idea is that, because the form on the page has not been submitted yet, it should show the form so that the user can fill it out. After the form is completed and submitted it will redirect to the login page of the site. I'm sure there is something wrong with the code but I have no clue where to start because I'm not getting an error message... just a blank white page. Any help would be greatly appreciated. Here is the code: <?php include("conf.inc.php"); // Includes the db and form info. if (!isset($_POST['submit'])) { // If the form has not been submitted. echo "<form action=\"signup.php\" method=\"POST\">"; echo "<div align=\"center\">"; echo "<table width=\"645\" border=\"2\" cellpadding=\"0\" cellspacing=\"0\" bordercolor=\"#FFFFFF\">"; echo "<tr>"; echo "<td width=\"640\" height=\"321\" align=\"center\" valign=\"top\">"; echo "<p align=\"left\"><strong><font color=\"#FFFFFF\" size=\"5\"> Customer Sign-Up...<br>"; echo "</font></strong><font color=\"#FF0000\"> The following information will be used only to contact you regarding your service.</font></p>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td width=\"187\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">First Name:</font></strong></td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<input name=\"fname\" type=\"text\" id=\"fname\" size=\"37\" maxlength=\"25\">"; echo "</td>"; echo "</tr>"; echo "</table><br>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td width=\"187\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">Last Name:</font></strong></td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<input name=\"lname\" type=\"text\" id=\"lname\" size=\"37\" maxlength=\"25\">"; echo "</td>"; echo "</tr>"; echo "</table><br>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td width=\"187\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">Home Address:</font></strong></td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<input name=\"haddress\" type=\"text\" id=\"haddress\" size=\"37\" maxlength=\"35\">"; echo "</td>"; echo "</tr>"; echo "</table><br>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td width=\"187\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">City, State & Zip:</font></strong></td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<input name=\"hcity\" type=\"text\" id=\"hcity\" size=\"18\" maxlength=\"20\">"; echo ","; echo "<select name=\"hstate\" id=\"hstate\">"; echo "<option value=\"AL\">AL</option>"; echo "<option value=\"AK\">AK</option>"; echo "<option value=\"AZ\">AZ</option>"; echo "<option value=\"AR\">AR</option>"; echo "<option value=\"CA\">CA</option>"; echo "<option value=\"CO\">CO</option>"; echo "<option value=\"CT\">CT</option>"; echo "<option value=\"DE\">DE</option>"; echo "<option value=\"DC\">DC</option>"; echo "<option value=\"FL\">FL</option>"; echo "<option value=\"GA\">GA</option>"; echo "<option value=\"HI\">HI</option>"; echo "<option value=\"ID\">ID</option>"; echo "<option value=\"IL\">IL</option>"; echo "<option value=\"IN\">IN</option>"; echo "<option value=\"IA\">IA</option>"; echo "<option value=\"KS\">KS</option>"; echo "<option value=\"KY\">KY</option>"; echo "<option value=\"LA\">LA</option>"; echo "<option value=\"ME\">ME</option>"; echo "<option value=\"MD\">MD</option>"; echo "<option value=\"MA\">MA</option>"; echo "<option value=\"MI\">MI</option>"; echo "<option value=\"MN\">MN</option>"; echo "<option value=\"MS\">MS</option>"; echo "<option value=\"MO\">MO</option>"; echo "<option value=\"MT\">MT</option>"; echo "<option value=\"NE\">NE</option>"; echo "<option value=\"NV\">NV</option>"; echo "<option value=\"NH\">NH</option>"; echo "<option value=\"NJ\">NJ</option>"; echo "<option value=\"NM\">NM</option>"; echo "<option value=\"NY\">NY</option>"; echo "<option value=\"NC\">NC</option>"; echo "<option value=\"ND\">ND</option>"; echo "<option value=\"OH\">OH</option>"; echo "<option value=\"OK\">OK</option>"; echo "<option value=\"OR\">OR</option>"; echo "<option value=\"PA\">PA</option>"; echo "<option value=\"RI\">RI</option>"; echo "<option value=\"SC\">SC</option>"; echo "<option value=\"SD\">SD</option>"; echo "<option value=\"TN\">TN</option>"; echo "<option value=\"TX\" selected>TX</option>"; echo "<option value=\"UT\">UT</option>"; echo "<option value=\"VT\">VT</option>"; echo "<option value=\"VA\">VA</option>"; echo "<option value=\"WA\">WA</option>"; echo "<option value=\"WV\">WV</option>"; echo "<option value=\"WI\">WI</option>"; echo "<option value=\"WY\">WY</option>"; echo "</select>"; echo " <input name=\"hzip\" type=\"text\" id=\"hzip\" size=\"3\" maxlength=\"5\">"; echo "</td>"; echo "</tr>"; echo "</table><br>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td width=\"187\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">Home Phone:</font></strong></td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<input name=\"hphone\" type=\"text\" id=\"hphone\" size=\"37\" maxlength=\"14\">"; echo "<font size=\"2\"><br>"; echo "<font color=\"#999999\">Include area code (i.e. 940-555-1234)</font></font></td>"; echo "</tr>"; echo "</table><br>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td width=\"187\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">Email Address:</font></strong></td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<input name=\"email\" type=\"text\" id=\"email\" size=\"37\" maxlength=\"40\">"; echo "<br>"; echo "<font color=\"#999999\" size=\"2\">(Your email will also be your user ID.)</font></td>"; echo "</tr>"; echo "</table><br>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td width=\"187\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">Choose a Password:</font></strong></td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<input name=\"pword\" type=\"password\" id=\"pword\" size=\"37\" maxlength=\"20\">"; echo "<br>"; echo "<font color=\"#999999\"size=\"2\">(Minimum of 6 characters in length.)</font></td>"; echo "</tr>"; echo "</table><br>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td width=\"187\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">Re-enter Password:</font></strong></td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<input name=\"pword2\" type=\"password\" id=\"pword2\" size=\"37\" maxlength=\"20\">"; echo "</td>"; echo "</tr>"; echo "</table><br>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td width=\"187\" height=\"24\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">Security Question:</font></strong></td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<select name=\"question\" id=\"question\">"; echo "<option value=\"0\" selected>--Choose a security question--</option>"; echo "<option value=\"What was your high school mascot?\">What was your high school mascot?</option>"; echo "<option value=\"What is your mother's maiden name?\">What is your mother's maiden name?</option>"; echo "<option value=\"What was your first car?\">What was your first car?</option>"; echo "<option value=\"Who was your favorite teacher?\">Who was your favorite teacher?</option>"; echo "<option value=\"What is your library card number?\">What is your library card number?</option>"; echo "</select>"; echo "</td>"; echo "</tr>"; echo "</table><br>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td width=\"187\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">Answer:</font></strong></td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<input name=\"answer\" type=\"text\" id=\"answer\" size=\"37\" maxlength=\"35\">"; echo "</td>"; echo "</tr>"; echo "</table><br>"; echo "<table width=\"625\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">"; echo "<tr>"; echo "<td width=\"187\" height=\"102\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">Terms of Service:</font></strong></td>"; echo "<td width=\"438\" align=\"right\" valign=\"top\">"; echo "<textarea cols=\"40\" rows=\"5\" readonly=\"readonly\" wrap=\"VIRTUAL\" style=\"width:100%;text-align:\" onfocus=\"this.rows=10\">"; echo "Terms of Service text goes here."/ echo "</textarea>"; echo "</td>"; echo "</tr>"; echo "</table>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td> </td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\"><font color=\"#FFFFFF\">"; echo "By clicking 'I accept' below, you are agreeing to the Terms of Service and the Alleyway Oil & Lube Service Agreement.</font></td>"; echo "</tr>"; echo "</table>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td> </td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<div align=\"left\">"; echo "<input name=\"Submit\" type=\"submit\" id=\"Submit\" value=\"I accept, continue to my account.\" onClick=\"return validate(form)\">"; echo "</div></td>"; echo "</tr>"; echo "</table>"; echo "<br>"; echo "</td>"; echo "</tr>"; echo "</table>"; echo "</div>"; echo "</form>"; } else { // The form has been submitted. $fname = form($_POST['fname']); $lname = form($_POST['lname']); $haddress = form($_POST['haddress']); $hcity = form($_POST['hcity']); $hstate = form($_POST['hstate']); $hzip = form($_POST['hzip']); $hphone = form($_POST['hphone']); $email = form($_POST['email']); $pword = md5($_POST['pword']); // Encrypts the password. $question = form($_POST['question']); $answer = form($_POST['answer']); $q = mysql_query("SELECT * FROM `users` WHERE email = '$email'") or die (mysql_error()); // mySQL Query $r = mysql_num_rows($q); // Checks to see if anything is in the db. if ($r > 0) { // If there are users with the same email. exit("That email is already registered!"); } else { mysql_query("INSERT INTO `users` (fname,lname,haddress,hcity,hstate,hzip,hphone,email,pword,question,answer) VALUES ('$fname','$lname','$haddress','$hcity','$hstate','$hzip','$hphone','$email','$pword','$question','$answer')") or die (mysql_error()); // Inserts the user info. header("Location: login.php"); // Back to login. } } mysql_close($db_connect); // Closes the connection. ?>
  19. I'll try it again tomorrow and see what it happens. Maybe there was something that I missed. If I can't get it to work, I'll be looking for some more help. Do you mind if I contact you directly if you're online? If not that's ok, I'll just start a new post asking specifically about the encryption. Thanks very much, you've been a great help.
  20. So to clarify... 1. The user enters a simple password when they register. 2. That simple password is encrypted when it is sent to the database and stored as something other than the simple password. 3. When the user logs in they enter their simple password. 4. The simple password is encrypted and now should match whatever is stored in the database, therefore granting them access to the site. Is this the way it should work? Does each password always change to the same set of letters and numbers each time it's encrypted? If so, I'm still confused about how to make the code on this membership system work. Thanks for all your help, I know I'm being difficult here.
  21. well, I was trying the code the way the author wrote it, with the "md5" encryption, but it wouldn't work because when the page would check to see if the user name and password matched what was in the database, of course the password in the database would not be what the user entered because it was encrypted (I'm guessing this is what the case was). Anyway, to make it work, I took the md5 part out and replaced it with "form" like it is for the username and email sections on the code. I would rather make it work with the "md5" encryption but I don't know what was causing it to not work and I don't even know where to start to debug it. If I have to I can leave it the way it is but I'd rather not.
  22. It works perfectly, thanks! Any ideas on the password encryption problem?
  23. Hello, I just came across this membership system tutorial located at http://www.phpfreaks.com/forums/index.php/topic,192840.0.html and I wanted to see how it worked. I copied and pasted the code exactly how the tutorial said to do it and everything worked perfectly except for one thing. On the index or main page there is a link to the logout page, which is supposed to end the session and redirect the page back to the login page. For some reason, when I click on this "logout" link, it doesn't do as it should. I think what is happening is it is sending me to "logout.php" but it isn't destroying the session, then it sends me back to "login.php", which, because the session wasn't ended as it should have, the server recognizes that I'm still logged in, therefore sends me back to "index.php". I'm not sure if there is something that I should have done to make this work or if it's a problem with the code. Is there another way to end a session that would work better? I'm at a loss as to what to try now. Does anyone have any suggestions? The code that I used is exactly as it is in the tutorial except for some database server and login information that works fine. Thanks in advance for any suggestions.... Oh, I almost forgot... anywhere a password is entered in this code the author had the password encripted. It wouldn't work for me... I had to remove the "md5" and change it to "form" like the rest of it to get it to work. Any suggestions on that?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.