Jump to content

[SOLVED] Login Script Not Working


monkeypaw201

Recommended Posts

I tried making a login page but it doesn't seem to posting anything...

 

<?php

if(isset($_POST['submit']))
{

mysql_select_db("database", $connection);

$password = sha1($_POST['password']);

$user = mysql_query("SELECT * FROM `users` WHERE `pilot_id` = '" . $_POST['pilot_id'] . "' AND `password` = '" . $password . "'") or die(mysql_error());
$user_count = mysql_num_rows($user);

if($user_count = 1)
{

$_SESSION['pilot_id'] = $_POST['pilot_id'];

}else{

echo "<p align=\"center\"><font color=\"red\">Sorry, the Pilot ID and password combination you provided was not found, please try again.</font></p>";

}

}else{
?>
<form name="loginbox" method="post" action="login.php">
<table width="100%" border="0">

  <tr>

    <td>Pilot ID</td>

    <td><label>

      <input type="text" name="pilot_id" id="pilot_id" value="COR" size="10" maxlength="7">

    </label></td>

  </tr>

  <tr>

    <td>Password</td>

    <td><label>

      <input type="password" name="password" id="password" size="10">

    </label></td>

  </tr>

  <tr>

    <td> </td>

    <td> </td>

  </tr>

  <tr>

    <td colspan="2"><label>

      <div align="right">

        <input type="submit" name="button" id="button" value="Log In">

        </div>

    </label></td>

  </tr>

</table>
</form>
<?php
}
?></code]

Link to comment
https://forums.phpfreaks.com/topic/117086-solved-login-script-not-working/
Share on other sites

well I'll start out by saying that

 

if($user_count = 1)

 

needs two = signs like this:

 

if($user_count == 1)

 

= is assignment operator, == is equality operator.  And I assume that since your form action is login.php that this script is login.php?

Archived

This topic is now archived and is closed to further replies.

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