jaybeeb Posted October 7, 2008 Share Posted October 7, 2008 Trying to make a simple login form. I know what I have is not very secure, but I do not need it to be secure. I just keep getting an "unexpected end" error. Any ideas? Thanks <BODY> <HTML> <?php mysql_connect("localhost","root", "") or die (mysql_error()); mysql_select_db("emp_agency") or die (mysql_error()); if($_SESSION['uid']) { echo "You are already logged in <br>\n"; } else { ?> <form method="POST" action="login3.php"> <table border="0" style="font-size: 15px; font-family: Tahoma; border: 1px solid black;"><TABLE> <TR> <TD>Username:</TD> <TD><input type="text" name="username" value="<?php echo $_POST ['username']; ?>"></TD> </TR> <TR> <TD>Password:</TD> <TD><input type="password" name="password" value="<?php echo $_POST ['password']; ?>"></TD> </TR> <TR> <TD colspan="2" align="center"> <input type="submit" name="submit" value="login"></TD> </TR> </TABLE> </form> <?php if($_POST['submit']) { $curnum = 0; $username = $_POST['username']; $password = $_POST['password']; if(!$username) { $curnum ++; echo $curnum . ". You need to enter a username!<br>\n"; } if(!$password) { $curnum ++; echo $curnum . ". You need to enter a password|<br>\n"; } $sql = "SELECT * FROM user WHERE username='".$username."'"; $res = mysql_query($sql) or die(mysql_error()); $row = mysql_fetch_assoc($res); if(isset($username) && isset($password)) { if(mysql_num_rows($res) == 0) { $curnum ++; echo $curnum . ". The username '<b>".$username."</b>' does not exist<br>\n"; } if(mysql_num_rows($res) == 1) { //the username does not exist if($password != $row['password']) { $curnum ++; echo $curnum .". Wrong password,br.\n"; } if($curnum == 0) { $_SESSION['uid'] = $row['id']; } } } } ?> </BODY> </HTML> Link to comment https://forums.phpfreaks.com/topic/127358-login-form-help/ Share on other sites More sharing options...
ratcateme Posted October 7, 2008 Share Posted October 7, 2008 try adding another } at the end Scott. Link to comment https://forums.phpfreaks.com/topic/127358-login-form-help/#findComment-658833 Share on other sites More sharing options...
jaybeeb Posted October 7, 2008 Author Share Posted October 7, 2008 try adding another } at the end Scott. Thanks, very silly of me. Can somebody mark as solved if still possible? Link to comment https://forums.phpfreaks.com/topic/127358-login-form-help/#findComment-658842 Share on other sites More sharing options...
revraz Posted October 7, 2008 Share Posted October 7, 2008 Can't mark as solved until they re-add the mod. Link to comment https://forums.phpfreaks.com/topic/127358-login-form-help/#findComment-658991 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.