|  | Posted by d_goto on 05/17/06 20:07 
I am trying to do a simple login page.  However, even when I input acorrect user name and password, I get the "You are not authorized!"
 display.  If anyone could looks over my code and see if anything is
 incorrect that would be great!  Thanks.
 
 Here is my html form:
 
 
 
 <HTML>
 
 <HEAD>
 
 <TITLE>Steering Committee Login</TITLE>
 
 
 </HEAD>
 
 <center><form action="login.php" method="post">
 <table border=0>
 <tr>
 <td><strong>Username:</strong></td>
 <td><input type="text" name="username" size="10" maxsize="10"></td>
 </tr>
 <tr>
 <td><strong>Password:</strong></td>
 <td><input type="password" name="password" size="10" maxsize="10"></td>
 </tr>
 <tr>
 <td colspan="2" align="center">
 <input type="submit" value="Login">
 </td>
 </tr>
 </table>
 </form>
 </center>
 </body>
 </html>
 
 
 Here is the login.php file:
 
 
 
 <?
 include "database_info.php";
 
 $connection = mysql_connect($server,$login,$password) or die("Couldn't
 make connection.");
 $db = mysql_select_db("ertcomm", $connection) or die("Couldn't select
 database.");
 $sql = "SELECT ID FROM login WHERE username='$username' and
 password='$password'";
 $sql_result = mysql_query($sql,$connection) or die("Couldn't execute
 query.");
 $num = mysql_numrows($sql_result);
 
 if ($num == 1)
 echo "You are now logged in!";
 else if ($num == 0)
 echo "You are not authorized!";
 
 ?>
  Navigation: [Reply to this message] |