session_start(); if($_SESSION["UserId"] == "") { header("location:login.php"); exit; } if(isset($_POST["hfAction"])) { include "config.php"; $sql = "select * from tbluser where email='".$_POST["txtUserName"]."'"; $res = mysql_query($sql); if( mysql_num_rows($res) > 0 ) { $arr = mysql_fetch_array($res); if($_POST["txtPassword"] == $arr["password"]) { $_SESSION["UserId"] = $arr["id"]; $_SESSION["UserName"] = $arr["email"]; header("location:main.php"); } else { $Msg = "Invalid Password."; } } else { $Msg = "Invalid User Name"; } } ?>
|