monkeypaw201 Posted July 29, 2008 Share Posted July 29, 2008 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 More sharing options...
.josh Posted July 29, 2008 Share Posted July 29, 2008 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? Link to comment https://forums.phpfreaks.com/topic/117086-solved-login-script-not-working/#findComment-602233 Share on other sites More sharing options...
monkeypaw201 Posted July 29, 2008 Author Share Posted July 29, 2008 Yes, this is the login.php, I updated the = to == and it didn't change anything.. I also added an echo $_POST['pilot_id']; right after the first query and its not outputting anything... Link to comment https://forums.phpfreaks.com/topic/117086-solved-login-script-not-working/#findComment-602238 Share on other sites More sharing options...
.josh Posted July 29, 2008 Share Posted July 29, 2008 Ah I know why. You named your submit button "button" not "submit" so your condition never evaluates true Link to comment https://forums.phpfreaks.com/topic/117086-solved-login-script-not-working/#findComment-602239 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.