I am trying to check if the inserted username and password match with my database. The problem is that the PHP file is not compiling tell the end. I believe I have a problem in the line when I post the data to the database but I am not able to name the problem. This is the error that occurs.
POST http://localhost:8080/ 500 (Internal Server Error)
<html> <head> <title> Admin Login </title> </head> <body bgcolor="lightblue"> <center> <h3> Admin Login </h3> <form name="frmUser" method="post" action=""> <div class="message"><?php if($message!="") { echo $message; } ?></div> <table> <tr><td> If you are admin login here </td></tr> <tr> <tr></tr> <td> Username </td> <td> <input type="text" id="user" name="user"> </td> </tr> <tr> <td> Password </td> <td> <input type="text" id="password" name="password"> </td> </tr> <tr> <td> <input type="submit" name="submit" id="submit" value="submit"> </td> </tr> <tr><td> If you are guest <a href="guest.html">Click here</a> </td></tr> </table> </form> </center> </body> <?php $message=""; if(count($_POST)>0) { $conn = mysqli_connect("localhost","root","","ICS324"); echo "test"; $result = mysql_query($conn,"SELECT * FROM credentials WHERE user='" . $_POST["user"] . "' and password = '". $_POST["password"]."'"); echo "test"; $count = mysqli_num_rows($result); if($count==0) { $message = "Invalid Username or Password!"; } else { $message = "You are successfully authenticated!"; } } ?> </html> https://stackoverflow.com/questions/67259717/checking-the-entered-credentials-in-mysql April 26, 2021 at 09:15AM
没有评论:
发表评论