Jump to content

I'm lost... please help!


elmas156

Recommended Posts

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.

Link to comment
Share on other sites

The posted code does not match the error message. To get the best solution, post the actual code.

 

If code is going to redirect on a page, outputting content (intentionally or perhaps in this case unintentionally) is a waste of processing time and causes the page generation to take longer, slowing down the overall operation of your site.

 

Rather than mask a problem by using output buffering, find what the problem is and correct it.

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.