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> Quote Link to comment Share on other sites More sharing options...
ratcateme Posted October 7, 2008 Share Posted October 7, 2008 try adding another } at the end Scott. Quote Link to comment 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? Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.