PHP:Wrong Login info does not redirect to the specific page

Posted by sdr on Stack Overflow See other posts from Stack Overflow or by sdr
Published on 2010-04-22T13:18:13Z Indexed on 2010/04/22 13:23 UTC
Read the original article Hit count: 228

Filed under:
|
<?php
include 'lib/db_conn.php';
$uid=$_REQUEST['uid'];
$pass=$_REQUEST['pass'];
if(($uid==NULL && $pass==NULL) ||($uid==NULL) ||($pass==NULL))
{
    header("location:index.php?msg=Fields can't be left blank..");
}

$pass=md5($pass);
$sql1="SELECT * FROM `tb_user` WHERE `email`='$uid' AND `pass`='$pass'";
$rs1=mysql_query($sql1) or die (mysql_error());
$row1=mysql_fetch_array($rs1) or die (mysql_error());
$email=$row1['email'];
if($uid==$email)
{
        session_start();
        $_SESSION['id']=$row1['id'];
        header("location:home.php");
}
else
{
header("location:index.php?msg=Wrong Credentials..");
}
?>

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql