Jump to content

john_tripod

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

john_tripod's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Ok I've been trying things and now it doesn't return error messages but when i log in it disregards the password and lets anyone in. heres the code for the form and the handler: First the form [code] <html> <body> <form action="salesloginhandler.php" method="post"> <table cellpadding="2" cellspacing="2" border="2" align="center"> <br> <br> <br>     <br> <br> <tr>      <td align="center"><h1>Sales Login Area</h1> </td> </tr>     <tr> <form action="salesloginhandler.php" method="post">      <td align="right" colspan="2">   ID <input type=text name="salesid" size=30><br> </td> </tr>     <tr>      <td align="right" colspan="2">   Password <input type=password name="fpass" size=30><br> </td> </tr> </tr>     <tr><td align=middle><input type="submit" name="login" value="Login"> </td> </tr>   </tr>      </form> </table>               </body> </html> [/code] Now the handler [code] <?php session_start(); $host="localhost"; $user="c3091018"; $password="glow720"; $dbname="c3091018"; $tablename="employee"; $link=mysql_connect ($host, $user, $password); mysql_select_db($dbname) or die("Couldn't select database: $dbname<br>" . mysql_error()); $query = "SELECT * FROM employee WHERE salesid = '$salesid' AND fpass = '$fpass'"; $result=mysql_query ($query) or die("Problem witht the query: $query<br>" . mysql_error()); ?> <HTML> <HEAD>     <TITLE>Sales Login Handler</TITLE> </HEAD> <BODY> </BODY> <?php     $fpass="0"; while ($row=mysql_fetch_array($result)) { $fpass=$row['fpass']; } mysql_close($link); if ($fpass==$fpass) { $status='loggedin'; print " $row[forename]Go To The Car database,<a href=\"employeedisplaycars.php\">Enter"; } else { $status='invalid'; print "not logged in, invalid user information"; }                          ?> </HTML> [/code]
  2. I'm writing some code to create a login area to my site but i keep having the same respone saying the 'while' loop isn't valid. any ideas why? Im passing the 'salesid' and 'password' variables from a form, heres the code for the handler that isn't working: [code] <?php session_start(); $host="localhost"; $user="c3091018"; $password="******"; $dbname="c3091018"; $tablename="employee"; $link=mysql_connect ($host, $user, $password); $query = "SELECT * FROM employee WHERE id = '$salesid' AND password = '$password'";         $result=mysql_db_query ($dbname, $query, $link); ?> <HTML> <HEAD>     <TITLE>Sales Login Handler</TITLE> </HEAD> <BODY> </BODY> <?php     $password="0"; while ($row=mysql_fetch_array($result)) { $password=$row['password']; } mysql_close($link); if ($password==$password) { $status='loggedin'; print " $row[forename]Go To The Car database,<a href=\"employeedisplaycars.php\">Enter"; } else { $status='invalid'; print "not logged in, invalid user information"; }                          ?> </HTML>                [/code]
  3. I've got a field in my database of car prices. I want to be able to search them from a drop down menu of price fields like £1000-£3000. How do I write the PHP for the form and the handler? Cheers John
×
×
  • 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.