unable to login
Posted: Wed Jun 22, 2011 5:21 am
Dear all,
I am new to PHP. here I want to develop a login page. what's wrong in the following page?
<?php
include ('/includes/dbConfig.php');
session_start();
// username and password sent from form
$email=$_POST['email'];
$password=md5($_POST['password']);
// To protect MySQL injection (more detail about MySQL injection)
$email = mysql_real_escape_string($email);
$password = mysql_real_escape_string($password);
$query="SELECT * FROM member_info WHERE email='$email' and password='$password'";
$result=mysql_query($query);
if (mysql_num_rows($result) != 1) {
//$error = "Bad Login";
echo "Bad Login";
}
else
{
header("location:index.php");
}
?>
Regards:
Muhammad Nadeem
I am new to PHP. here I want to develop a login page. what's wrong in the following page?
<?php
include ('/includes/dbConfig.php');
session_start();
// username and password sent from form
$email=$_POST['email'];
$password=md5($_POST['password']);
// To protect MySQL injection (more detail about MySQL injection)
$email = mysql_real_escape_string($email);
$password = mysql_real_escape_string($password);
$query="SELECT * FROM member_info WHERE email='$email' and password='$password'";
$result=mysql_query($query);
if (mysql_num_rows($result) != 1) {
//$error = "Bad Login";
echo "Bad Login";
}
else
{
header("location:index.php");
}
?>
Regards:
Muhammad Nadeem