Jump to content

cluce

Members
  • Posts

    354
  • Joined

  • Last visited

    Never

Posts posted by cluce

  1. I am trying to count the number of unsuccessful logins. Can someone tell me would be the syntax to increment this in a table?  How could I add to the current value?

    Or would do an INSERT?  can someone give me some direction?

     

     

    here is my code

    	//redirect back to login form if not authorized
    $_SESSION['error'] =  "<font color='red'>invalid username and/or password combination</font>"; 
    $sql3 = "UPDATE auth_users SET failed_logins =       WHERE username = '".$_POST["username"]."'";   
    header("Location: user_logon.php");
    exit;
    }

  2. here was my solution........

     

    <?php
    session_start();
    
    //check for required fields from the form
    if ((!isset($_POST["username"])) || (!isset($_POST["password"]))) {
    	header("Location: user_logon.html");
    exit;
    }
    
    //connect to server and select database
    $mysqli = mysqli_connect("localhost", "root", "", "test");
    
    //create and issue the query
    $sql = "SELECT username, f_name, l_name FROM auth_users WHERE username = '".$_POST["username"]."' AND password = PASSWORD('".$_POST["password"]."')";
    
    $result = mysqli_query($mysqli, $sql) or die(mysqli_error($mysqli));
    
    
    //checks if user is disabled
    
    
    //get the number of rows in the result set; should be 1 if a match
    if (mysqli_num_rows($result) == 1) {
    
    //if authorized, get the values of f_name l_name
    while ($info = mysqli_fetch_array($result)) {
    	$f_name = stripslashes($info['f_name']);
    	$l_name = stripslashes($info['l_name']);
    }
    
    //set authorization cookie
    setcookie("auth", "1", 0, "/", "yourdomain.com", 0);
    $_SESSION['usersname'] = $f_name . " " . $l_name;
    
    
    //record logons
        $sql2 = "INSERT INTO events (user, date) VALUES ('".$_POST['username']."', NOW())";
        
    //$sql2="UPDATE auth_users SET last_login=NOW() WHERE username = '".$_POST["username"]."'";   
         mysqli_query($mysqli,$sql2);
    
    //or die(mysql_error());
    
    //directs authorized user
    header("Location: logon.php");
    
    
    } else {
    //redirect back to login form if not authorized
    $_SESSION['error'] =  "<font color='red'>invalid username and/or password combination</font>"; 
    header("Location: user_logon.php");
    exit;
    }
    ?>
    
    

  3. OK this is what I have so far but no data is being inserted into the events table. can someone tell me what I am missing??

     

    <?php
    session_start();
    
    //check for required fields from the form
    if ((!isset($_POST["username"])) || (!isset($_POST["password"]))) {
    	header("Location: user_logon.html");
    exit;
    }
    
    //connect to server and select database
    $mysqli = mysqli_connect("localhost", "root", "", "test");
    
    //create and issue the query
    $sql = "SELECT f_name, l_name FROM auth_users WHERE username = '".$_POST["username"]."' AND password = PASSWORD('".$_POST["password"]."')";
    
    $result = mysqli_query($mysqli, $sql) or die(mysqli_error($mysqli));
    
    //get the number of rows in the result set; should be 1 if a match
    if (mysqli_num_rows($result) == 1) {
    
    //if authorized, get the values of f_name l_name
    while ($info = mysqli_fetch_array($result)) {
    	$f_name = stripslashes($info['f_name']);
    	$l_name = stripslashes($info['l_name']);
    }
    
    //set authorization cookie
    setcookie("auth", "1", 0, "/", "yourdomain.com", 0);
    $_SESSION['usersname'] = $f_name . " " . $l_name;
    
    
    //record logon event
        $sql = mysqli_query($mysqli,"INSERT INTO events (user) VALUES ('".$_POST['username']."'");
    
    //directs authorized user
    header("Location: logon.php");
    
    
    } else {
    //redirect back to login form if not authorized
    $_SESSION['error'] =  "<font color='red'>invalid username and/or password combination</font>"; 
    header("Location: user_logon.php");
    exit;
    }
    ?>
    
    

  4. OK I got rid of my previous warnings from previous question. 

     

    can someone show me how to record the date/time ofeach login event???

     

    here is my code..

    <?php
    session_start();
    
    //check for required fields from the form
    if ((!isset($_POST["username"])) || (!isset($_POST["password"]))) {
    	header("Location: user_logon.html");
    exit;
    }
    
    //connect to server and select database
    $mysqli = mysqli_connect("localhost", "root", "", "test");
    
    //create and issue the query
    $sql = "SELECT f_name, l_name FROM auth_users WHERE username = '".$_POST["username"]."' AND password = PASSWORD('".$_POST["password"]."')";
    
    $result = mysqli_query($mysqli, $sql) or die(mysqli_error($mysqli));
    
    //get the number of rows in the result set; should be 1 if a match
    if (mysqli_num_rows($result) == 1) {
    
    //if authorized, get the values of f_name l_name
    while ($info = mysqli_fetch_array($result)) {
    	$f_name = stripslashes($info['f_name']);
    	$l_name = stripslashes($info['l_name']);
    }
    
    //set authorization cookie
    setcookie("auth", "1", 0, "/", "yourdomain.com", 0);
    $_SESSION['usersname'] = $f_name . " " . $l_name;
    
    //directs authorized user
    header("Location: logon.php");
    
    //record logon event
        //$sql = "INSERT INTO Events (user, Date) VALUES ('".$_POST['username']."',?date/timestamp?)";
    
    } else {
    //redirect back to login form if not authorized
    $_SESSION['error'] =  "<font color='red'>invalid username and/or password combination</font>"; 
    header("Location: user_logon.php");
    exit;
    }
    ?>
    

  5. All I did was add the sql insert command because I want to record the date/time every time soneone logs on and now I am getting these warnings and I can't get rid of them. This was code was working before I did that. This is driving me bannanas. Can someone please tell me whats going on??

     

    Here are my errors...

     

    Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\wamp\www\userlogin.php:1) in C:\wamp\www\userlogin.php on line 4

     

    Warning: Cannot modify header information - headers already sent by (output started at C:\wamp\www\userlogin.php:1) in C:\wamp\www\userlogin.php on line 50

     

     

    here is my code...

     <?php
    //initialize the session
    if (!isset($_SESSION)) {
      session_start();
    }
    
    //check for required fields from the form
    if ((!isset($_POST["username"])) || (!isset($_POST["password"]))) {
    	header("Location: user_logon.html");
    exit;
    }
    
    //connect to server and select database
    $mysqli = mysqli_connect("localhost", "root", "", "test");
    
    
    
    //create and issue the query
    $sql = "SELECT f_name, l_name FROM auth_users WHERE username = '".$_POST["username"]."' AND password = PASSWORD('".$_POST["password"]."')";
    
    $result = mysqli_query($mysqli, $sql) or die(mysqli_error($mysqli));
    
    
    
    //get the number of rows in the result set; should be 1 if a match
    if (mysqli_num_rows($result) == 1) {
    
    
    
    //if authorized, get the values of f_name l_name
    while ($info = mysqli_fetch_array($result)) {
    	$f_name = stripslashes($info['f_name']);
    	$l_name = stripslashes($info['l_name']);
    }
    
    
    //set authorization cookie
    setcookie("auth", "1", 0, "/", "yourdomain.com", 0);
    $_SESSION['usersname'] = $f_name . " " . $l_name;
    
    //records logon event 
    //$sql = "INSERT INTO Events (user, Date) VALUES ('".$_POST['username']."')";
    
    //directs authorized user
    header("Location: logon.php");
    
    } else {
    //redirect back to login form if not authorized
    $_SESSION['error'] =  "<font color='red'>Invalid username and/or password combination</font>"; 
    header("Location: user_logon.php");
    exit;
    }
    ?>
    

  6. Can someone tell me how to get my registration page to start out fresh.  For example, let say a user tries to register but the password fields are not identical. That person would recieve a message saying passwords are not identical.  So that person tries again and types in identical passwords but the username already exists. Even though the passwords match, that person will still recieve two messages one from before,"the password is not identical" and "the username is already in use".???  Its like my registration page isn't refreshed. It shows old error messages.

     

     

    here is my code

    <?php
    session_start();
    Header("Cache-control: private, no-cache");
    Header("Expires: Mon, 26 Jun 1997 05:00:00 GMT");
    Header("Pragma: no-cache");
    
    //checks for identical passwords
    if($_POST["password"]!==$_POST["confirmpassword"]){
            $_SESSION['identical'] = "Passwords are not identical.";
    	header("Location: registration.php");
    }  else {
    $mysqli = mysqli_connect("localhost", "root", "", "test");
    }
    if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit();
    }
    // checks if the username is in use
    if (!get_magic_quotes_gpc()) {
    $_POST['username'] = addslashes($_POST['username']);
    }
    
    $usercheck = $_POST['username'];
    $check = mysqli_query($mysqli,"SELECT username FROM auth_users WHERE username = '$usercheck'"); 
    $check2 = mysqli_num_rows($check);
    
    //if the name exists it gives an error
    if ($check2 != 0) {
    $_SESSION['userExists'] = "<font color='red'>" .$_POST['username']. " is already in use. Please choose another username.</font>";	
        header ("Location: registration.php");
    
    }  else  {
    
    $sql = "INSERT INTO auth_users (username, password, ConfirmPassword, f_name, L_name, address, city, state, zip, phoneNumber, AltphoneNumber, email, company) VALUES ('".$_POST['username']."',PASSWORD('".$_POST["password"]."'),PASSWORD('".$_POST["confirmpassword"]."'),'".$_POST['firstname']."','".$_POST['lastname']."','".$_POST['address']."','".$_POST['city']."','".$_POST['state']."','".$_POST['zip']."','".$_POST['phone']."','".$_POST['alternate']."','".$_POST['email']."','".$_POST['company']."')";
    $res = mysqli_query($mysqli, $sql);
    
    }
    if ($res === TRUE) {
    	header("Location: registered.html");
    	} else {
    printf("Could not insert record: %s\n", mysqli_error($mysqli));
    }
    mysqli_close($mysqli);
    
    ?>

  7. I have it working with a basic message. I am trying to be more personable.

     

    can someone show me the correct way to type this line........ 

     

        $_SESSION['userExists'] = "<font color='red'> .$_POST['username']. is already in use. Please choose another username.</font>";

     

     

    I keep getting errors...

     

     

    Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\wamp\www\insert.php on line 24

     

  8. OK I changed the mysql to mysqli to be consistent but I still recieve two warnings..  ALthough I see the proper message too

     

    Warning: mysqli_query() expects at least 2 parameters, 1 given in C:\wamp\www\insert.php on line 14

     

    Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, null given in C:\wamp\www\insert.php on line 16

    Sorry, the username jdoe is already in use.Could not insert record

     

    <?php
    
    //checks for identical passwords
    if($_POST["password"]!==$_POST["confirmpassword"]){
            header("Location: registration.html");
    }  else {
    $mysqli = mysqli_connect("localhost", "root", "", "test");
    }
    if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit();
    }
    // checks if the username exists
    $result = mysqli_query("SELECT username FROM auth_users WHERE username = '$username'");
    
    if(mysqli_num_rows($result) !== 0){
        //$_SESSION['userExists'] 
    echo ('Sorry, the username '.$_POST['username'].' is already in use.');
    //header ("Location: registration.php");
    
    }  else  {
    
    $sql = "INSERT INTO auth_users (username, password, ConfirmPassword, f_name, L_name, address, city, state, zip, phoneNumber, AltphoneNumber, email, company) VALUES ('".$_POST['username']."',PASSWORD('".$_POST["password"]."'),PASSWORD('".$_POST["confirmpassword"]."'),'".$_POST['firstname']."','".$_POST['lastname']."','".$_POST['address']."','".$_POST['city']."','".$_POST['state']."','".$_POST['zip']."','".$_POST['phone']."','".$_POST['alternate']."','".$_POST['email']."','".$_POST['company']."')";
    $res = mysqli_query($mysqli, $sql);
    }
    if ($res === TRUE) {
    	header("Location: registered.html");
    	} else {
    	printf("Could not insert record: %s\n", mysqli_error($mysqli));
    }
    mysqli_close($mysqli);
    
    ?>

  9. OK I simplyfied my code a bit but I still have the warnings........

     

    Warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\insert.php on line 14

     

    Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in C:\wamp\www\insert.php on line 14

     

    Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\wamp\www\insert.php on line 16

    Sorry, the username jdoe is already in use.Could not insert record:

     

    here is the new code

    <?php
    
    //checks for identical passwords
    if($_POST["password"]!==$_POST["confirmpassword"]){
            header("Location: registration.html");
    }  else {
    $mysqli = mysqli_connect("localhost", "root", "", "test");
    }
    if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit();
    }
    // checks if the username exists
    $result = mysql_query("SELECT username FROM auth_users WHERE username = '$username'");
    
    if(mysql_num_rows($result) !== 0){
       echo ('Sorry, the username '.$_POST['username'].' is already in use.');
    
    }  else  {
    
    $sql = "INSERT INTO auth_users (username, password, ConfirmPassword, f_name, L_name, address, city, state, zip, phoneNumber, AltphoneNumber, email, company) VALUES ('".$_POST['username']."',PASSWORD('".$_POST["password"]."'),PASSWORD('".$_POST["confirmpassword"]."'),'".$_POST['firstname']."','".$_POST['lastname']."','".$_POST['address']."','".$_POST['city']."','".$_POST['state']."','".$_POST['zip']."','".$_POST['phone']."','".$_POST['alternate']."','".$_POST['email']."','".$_POST['company']."')";
    $res = mysqli_query($mysqli, $sql);
    }
    if ($res === TRUE) {
    	header("Location: registered.html");
    	} else {
    	printf("Could not insert record: %s\n", mysqli_error($mysqli));
    }
    mysqli_close($mysqli);
    
    ?>

  10. OK added the mySQL but now I get database.  I guess I am not connected to the database but I cant see why? Here are some new errors.

     

    Warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\insert.php on line 19

     

    Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in C:\wamp\www\insert.php on line 19

     

    Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\wamp\www\insert.php on line 20

     

    Warning: Cannot modify header information - headers already sent by (output started at C:\wamp\www\insert.php:19) in C:\wamp\www\insert.php on line 32

  11. I recieve these errors when checking the database for a username that already exists.

     

    Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\wamp\www\insert.php on line 20

     

    Warning: Cannot modify header information - headers already sent by (output started at C:\wamp\www\insert.php:20) in C:\wamp\www\insert.php on line 33

     

    Can someone tell me what I am doing wrong? This is all I have left to my registration page. I would appreciate it.

     

    <?php
    
    //checks for identical passwords
    if($_POST["password"]!==$_POST["confirmpassword"]){
            header("Location: registration.html");
    }  else {
    $mysqli = mysqli_connect("localhost", "root", "", "test");
    }
    if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit();
    }
    // checks if the username is in use
    if (!get_magic_quotes_gpc()) {
    $_POST['username'] = addslashes($_POST['username']);
    }
    
    $usercheck = $_POST['username'];
    $check = ("SELECT username FROM auth_users WHERE username = '$usercheck'");
    $check2 = mysql_num_rows($check);
    
    //if the name exists it gives an error
    if ($check2 != 0) {
    echo ('Sorry, the username '.$_POST['username'].' is already in use.');
    
    }  else  {
    
    $sql = "INSERT INTO auth_users (username, password, ConfirmPassword, f_name, L_name, address, city, state, zip, phoneNumber, AltphoneNumber, email, company) VALUES ('".$_POST['username']."',PASSWORD('".$_POST["password"]."'),PASSWORD('".$_POST["confirmpassword"]."'),'".$_POST['firstname']."','".$_POST['lastname']."','".$_POST['address']."','".$_POST['city']."','".$_POST['state']."','".$_POST['zip']."','".$_POST['phone']."','".$_POST['alternate']."','".$_POST['email']."','".$_POST['company']."')";
    $res = mysqli_query($mysqli, $sql);
    }
    if ($res === TRUE) {
    	header("Location: registered.html");
    	} else {
    	printf("Could not insert record: %s\n", mysqli_error($mysqli));
    }
    mysqli_close($mysqli);
    
    ?>

  12. I have this working buut it appears black on my logon page.  Can any body tell me how to have this error message appear in red.....

     

    //redirect back to login form if not authorized

    $_SESSION['error'] = "invalid username and/or password combination";

     

    I don't know the exact html code to do that to work with php.

     

    here is the code on the logon page....

    <?php print ($_SESSION['error']);	
    ?>

  13. if you dont mind me asking, how do I fix that?  I used Dreamweaver to create one function and the Bothfieldsidentical function I created.  I have the same functions used on a small form of two fields that works but with this one with several fields it doesn't work.

  14. I am trying to validate for required feilds and for identical passwords but the form still gets submitted.  When I hit OK the message comes up saying that the fields are required but it still submits the info. after I click OK to the message. I cant see why this happening.  Can anybody tell me whats wrong with my code? 

    
    <!-- TemplateEndEditable -->
    
    <style type="text/css">
    <!--
    body {
    background-image: url(images/bg_tile.gif);
    }
    .style8 {font-size: 12px}
    a:visited {
    color: #000000;
    text-decoration: none;
    }
    a:hover {
    color: #FF6600;
    background-color: #999999;
    text-decoration: underline;
    }
    a:link {
    color: #000000;
    text-decoration: none;
    }
    a:active {
    color: #FF6600;
    text-decoration: none;
    }
    .style12 {font-size: 14px}
    .style14 {color: #FF0000}
    .style15 {font-family: "Times New Roman", Times, serif; font-size: 14px; color: #FF0000; }
    .style16 {
    font-size: 18px;
    font-family: "Times New Roman", Times, serif;
    font-weight: bold;
    }
    -->
    </style>
    
    <!-- TemplateBeginEditable name="head" --><!-- TemplateEndEditable -->
    
    <script type="text/JavaScript">
    <!--
    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_validateForm() { //v4.0
      var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
      for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
        if (val) { nm=val.name; if ((val=val.value)!="") {
          if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
            if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
          } else if (test!='R') { num = parseFloat(val);
            if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
            if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
              min=test.substring(8,p); max=test.substring(p+1);
              if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
        } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
      } if (errors) alert('The following error(s) occurred:\n'+errors);
      document.MM_returnValue = (errors == '');
    }
    //-->
    </script>
    <div align="center">
      <table width="852" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <th width="852" height="85" colspan="2" align="left" valign="middle" background="images/BG1.png" bgcolor="#CCCCCC" scope="col"><div align="center">
            <p><img src="images/reagman_L.gif" alt="Reagan logo" width="99" height="98" /><img name="ReaganPower" src="images/Reagan Power.gif" width="581" height="59" border="0" id="ReaganPower" alt="Reagan logo" /><img src="images/reagman_R.gif" alt="Reagan logo" width="99" height="98" /></p>
          </div>
              <div align="center"></div></th>
        </tr>
    
        <tr>
          <td colspan="2" align="left" valign="top" bgcolor="#FFFFFF"><p> </p>
            <blockquote>
              <p align="center" class="style16">Registration Form </p>
    
              <p align="center" class="style15">If you are a first time user, you must register </p>
            </blockquote> 
    
    <script type="text/javascript" language="JavaScript">
    <!--
    function BothFieldsIdentical() {
    var one = document.form1.password.value;
    var another = document.form1.confirmpassword.value;
    if(one != another) {
    alert("Passwords must be identical.");
    return false;
    }
    }
    //-->
    </script>
           
            <form id="form1" name="form1" method="post" action="insert.php">
              <blockquote>
                <blockquote>
                  <blockquote>
                    <p align="center" class="style12">Fields marked with  <span class="style14">*</span> are required. </p>
                  </blockquote>
                </blockquote>
              </blockquote>
              
                <table width="426" border="0" align="center" cellpadding="1" cellspacing="1">
                  
                  <tr>
                    <td width="165"><div align="left">Username</div></td>
                    <td width="278"><input name="username" type="text" id="username" size="30" />
                    <span class="style14">*</span></td>
                  </tr>
                  <tr>
                    <td>Password</td>
                    <td><input name="password" type="password" id="password" size="30" />
                    <span class="style14">*</span></td>
                  </tr>
                  <tr>
                    <td>Confirm Password </td>
                    <td><input name="confirmpassword" type="password" id="confirmpassword" size="30" />
                    <span class="style14"> *</span></td>
                  </tr>
                  <tr>
                    <td>First Name: </td>
                    <td><input name="firstname" type="text" id="firstname" size="30" />
                    <span class="style14">*</span></td>
                  </tr>
                  <tr>
                    <td><div align="left">Middle:</div></td>
                    <td><input name="middle" type="text" id="middle" size="30" /></td>
                  </tr>
                  <tr>
                    <td><div align="left">Last Name: </div></td>
                    <td><input name="lastname" type="text" id="lastname" size="30" />
                      <span class="style14">*</span></td>
                  </tr>
                  <tr>
                    <td><div align="left">Address:</div></td>
                    <td><input name="address" type="text" id="address" size="30" />
                      <span class="style14">*</span></td>
                  </tr>
                  
                  <tr>
                    <td><div align="left">City:</div></td>
                    <td><input name="city" type="text" id="city" size="30" />
                      <span class="style14">*</span></td>
                  </tr>
                  <tr>
                    <td><div align="left">State:</div></td>
                    <td><input name="state" type="text" id="state" size="30" />
                      <span class="style14">*</span></td>
                  </tr>
                  <tr>
                    <td><div align="left">Zip:</div></td>
                    <td><input name="zip" type="text" id="zip" size="30" />
                      <span class="style14">*</span></td>
                  </tr>
                  <tr>
                    <td><div align="left">Phone number:</div></td>
                    <td><input name="phone" type="text" id="phone" size="30" />
                      <span class="style14">*</span></td>
                  </tr>
                  <tr>
                    <td><div align="left">Alternate Phone number: </div></td>
                    <td><input name="alternate" type="text" id="alternate" size="30" /></td>
                  </tr>
                  <tr>
                    <td><div align="left">Email:</div></td>
                    <td><input name="email" type="text" id="email" size="30" />
                      <span class="style14">*</span></td>
                  </tr>
                  <tr>
                    <td><div align="left">Company:</div></td>
                    <td><input name="company" type="text" id="company" size="30" /></td>
                  </tr>
              </table>
              <blockquote>
                <blockquote>
                  <blockquote>
                    <blockquote>
                      <blockquote>
                        <p align="left"> </p>
                      </blockquote>
                    </blockquote>
                  </blockquote>
                </blockquote>
                <p align="center">
                  <input name="Submit" type="submit" onclick="MM_validateForm('username','','R','firstname','','R','lastname','','R','address','','R','city','','R','state','','R','zip','','R','phone','','R','email','','RisEmail','password','','R','confirmpassword','','R');return BothFieldsIdentical();return document.MM_returnValue" value="Submit" />
                  <input type="reset" name="Submit2" value="Reset" /></p>
                <p align="center"> </p>
              </blockquote>
            </form>        </td>
        </tr>
        
        <tr>
          <td colspan="2" background="images/BG1.png" bgcolor="#CCCCCC"><div align="center"><span class="style8"><strong>Reagan Equipment Co., Inc.</strong><br />
            Toll free: 800.264.7767<br />
          Email: <a href="mailto:info@reaganpower.com">info@reaganpower.com</a></span></div></td>
        </tr>
        <tr>
          <td colspan="2" background="images/BG1.png" bgcolor="#CCCCCC"><div align="center">
            <p class="style8">Copyright © 2007<br />
              <a href="http://www.point2pointhosting.com/" class="style12"> Hosted by point2point</a></p>
          </div></td>
        </tr>
      </table>
    </div>
    </body>
    </html>
    

  15. OK I did that nu it still gives me the header message............

     

     <?php
       session_start();
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <!-- TemplateBeginEditable name="doctitle" -->
    <title>Careers</title>
    <!-- TemplateEndEditable -->
    
    <style type="text/css">
    <!--
    body {
    background-image: url(images/bg_tile.gif);
    }
    .style8 {font-size: 12px}
    a:visited {
    color: #000000;
    text-decoration: none;
    }
    a:hover {
    color: #FF6600;
    background-color: #999999;
    text-decoration: underline;
    }
    a:link {
    color: #000000;
    text-decoration: none;
    }
    a:active {
    color: #FF6600;
    text-decoration: none;
    }
    .style12 {font-size: 14px}
    .style14 {color: #FF0000}
    .style15 {font-family: "Times New Roman", Times, serif; font-size: 14px; color: #FF0000; }
    .style16 {
    font-size: 18px;
    font-family: "Times New Roman", Times, serif;
    font-weight: bold;
    }
    -->
    </style>
    
    <!-- TemplateBeginEditable name="head" --><!-- TemplateEndEditable -->
    
    <script language="JavaScript" src="../mm_menu.js"></script>
    </head>
    
    <div align="center">
      <table width="852" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <th width="852" height="85" colspan="2" align="left" valign="middle" background="images/BG1.png" bgcolor="#CCCCCC" scope="col"><div align="center">
            <p><img src="images/reagman_L.gif" alt="Reagan logo" width="99" height="98" /><img name="ReaganPower" src="images/Reagan Power.gif" width="581" height="59" border="0" id="ReaganPower" alt="Reagan logo" /><img src="images/reagman_R.gif" alt="Reagan logo" width="99" height="98" /></p>
          </div>
              <div align="center"></div></th>
        </tr>
    
        <tr>
          <td colspan="2" align="left" valign="top" bgcolor="#FFFFFF"><p> </p>
            <blockquote>
              <p align="center" class="style16">Registration Form </p>
    <?php
      		
      echo ($_SESSION['error']) 
    ?>
              <p align="center" class="style15">If you are a first time user, you must register </p>
            </blockquote> 
    
    <script type="text/javascript" language="JavaScript">
    <!--
    function BothFieldsIdentical() {
    var one = document.form1.password.value;
    var another = document.form1.confirmpassword.value;
    if(one != another) {
    alert("Passwords must be identical.");
    return false;
    }
    }
    //-->
    </script>
           
            <form id="form1" name="form1" method="post" action="insert.php">
              <blockquote>
                <blockquote>
                  <blockquote>
                    <p align="center" class="style12">Fields marked with  <span class="style14">*</span> are required. </p>
                  </blockquote>
                </blockquote>
              </blockquote>
              
                <table width="426" border="0" align="center" cellpadding="1" cellspacing="1">
                  
                  <tr>
                    <td width="165"><div align="left">Username</div></td>
                    <td width="278"><input name="username" type="text" id="username" size="30" />
                    <span class="style14">*</span></td>
                  </tr>
                  <tr>
                    <td>Password</td>
                    <td><input name="password" type="password" id="password" size="30" />
                    <span class="style14">*</span></td>
                  </tr>
                  <tr>
                    <td>Confirm Password </td>
                    <td><input name="confirmpassword" type="password" id="confirmpassword" size="30" />
                    <span class="style14"> *</span></td>
                  </tr>
                  <tr>
                    <td>First Name: </td>
                    <td><input name="firstname" type="text" id="firstname" size="30" />
                    <span class="style14">*</span></td>
                  </tr>
                  <tr>
                    <td><div align="left">Middle:</div></td>
                    <td><input name="middle" type="text" id="middle" size="30" /></td>
                  </tr>
                  <tr>
                    <td><div align="left">Last Name: </div></td>
                    <td><input name="lastname" type="text" id="lastname" size="30" />
                      <span class="style14">*</span></td>
                  </tr>
                  <tr>
                    <td><div align="left">Address:</div></td>
                    <td><input name="address" type="text" id="address" size="30" />
                      <span class="style14">*</span></td>
                  </tr>
                  
                  <tr>
                    <td><div align="left">City:</div></td>
                    <td><input name="city" type="text" id="city" size="30" />
                      <span class="style14">*</span></td>
                  </tr>
                  <tr>
                    <td><div align="left">State:</div></td>
                    <td><input name="state" type="text" id="state" size="30" />
                      <span class="style14">*</span></td>
                  </tr>
                  <tr>
                    <td><div align="left">Zip:</div></td>
                    <td><input name="zip" type="text" id="zip" size="30" />
                      <span class="style14">*</span></td>
                  </tr>
                  <tr>
                    <td><div align="left">Phone number:</div></td>
                    <td><input name="phone" type="text" id="phone" size="30" />
                      <span class="style14">*</span></td>
                  </tr>
                  <tr>
                    <td><div align="left">Alternate Phone number: </div></td>
                    <td><input name="alternate" type="text" id="alternate" size="30" /></td>
                  </tr>
                  <tr>
                    <td><div align="left">Email:</div></td>
                    <td><input name="email" type="text" id="email" size="30" />
                      <span class="style14">*</span></td>
                  </tr>
                  <tr>
                    <td><div align="left">Company:</div></td>
                    <td><input name="company" type="text" id="company" size="30" /></td>
                  </tr>
              </table>
              <blockquote>
                <blockquote>
                  <blockquote>
                    <blockquote>
                      <blockquote>
                        <p align="left"> </p>
                      </blockquote>
                    </blockquote>
                  </blockquote>
                </blockquote>
                <p align="center">
                  <input name="Submit" type="submit" onclick="return BothFieldsIdentical();" value="Submit" />
                  <input type="reset" name="Submit2" value="Reset" /></p>
                <p align="center"> </p>
              </blockquote>
            </form>        </td>
        </tr>
        
        <tr>
          <td colspan="2" background="images/BG1.png" bgcolor="#CCCCCC"><div align="center"><span class="style8"><strong>Reagan Equipment Co., Inc.</strong><br />
            Toll free: 800.264.7767<br />
          Email: <a href="mailto:info@reaganpower.com">info@reaganpower.com</a></span></div></td>
        </tr>
        <tr>
          <td colspan="2" background="images/BG1.png" bgcolor="#CCCCCC"><div align="center">
            <p class="style8">Copyright © 2007<br />
              <a href="http://www.point2pointhosting.com/" class="style12"> Hosted by point2point</a></p>
          </div></td>
        </tr>
      </table>
    </div>
    </body>
    </html>
    

  16. I am trying to display a message "invalid username/ password combination" on my registration page but I get nothing. Can someone tell me what's wrong with my code.

     

    on logon page I have......

    	} else {
    //redirect back to login form if not authorized
    $_SESSION['error'] = "invalid username and/or password combination";
    header("Location: registration.html");
    exit;

     

    and registration page I have

     	<?php
    	echo ($_SESSION['error']) 
    	?>

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