Recieving a 500 Internal Server error after login success?
Posted
by
Jeremy Quick
on Server Fault
See other posts from Server Fault
or by Jeremy Quick
Published on 2012-10-29T16:14:37Z
Indexed on
2012/10/29
17:04 UTC
Read the original article
Hit count: 233
I created my first member login form which takes the typical username and password and then sends it to the code below:
checklogin.php:
mysql_connect($db_host, $db_username, $db_password) or die(mysql_error());
mysql_select_db($db_database) or die(mysql_error());
$username=$_POST['username'];
$password=$_POST['password'];
$username = stripslashes($username);
$password = stripslashes($password);
$username = mysql_real_escape_string($username);
$password = mysql_real_escape_string($password);
$sql="SELECT * FROM users WHERE username='$username' and password='$password'";
$result=mysql_query($sql);
$count=mysql_num_rows($result);
if($count == 1) //ERROR APPEARS TO TAKE PLACE HERE
{
session_start();
$_SESSION['username'] = $username;
$_SESSION['password'] = $password;
header('login_success.php');
}
else {
header("location:login_fail.php");
}
If I type in the wrong information everything works properly so I know the error appears to be taking effect in the marked if statement
. I have been searching the internet now looking for solutions but none seem to match mine or I am overlooking them. I've made a few changes which brought me to this point, before I was receiving deprecation warnings.
Also, I have checked the logs and they are empty of errors relating to this.
© Server Fault or respective owner