|
Server : Apache/2.4.62 System : FreeBSD fbsdweb2.web.rcn.net 14.1-RELEASE FreeBSD 14.1-RELEASE releng/14.1-n267679-10e31f0946d8 GENERIC amd64 User : www ( 80) PHP Version : 8.3.8 Disable Function : NONE Directory : /domains/klengineers/klwebsite-controller/inc/ |
Upload File : |
<?php
include("../config/config.php");
if(isset($_POST['loginSubmit']))
{
$userName=$_POST['userName'];
$password=$_POST['password'];
$password=md5($password);
$query= "select * from admin where a_name='$userName' and a_pass='$password'";
$result=mysql_query($query) or die("Database connection Failed!");
$row=mysql_fetch_array($result);
if($row)
{
$expire=time()+3600*24;
extract($row);
setcookie("ADMIN_NAME",$a_name,$expire);
setcookie("USER_ID",$id,$expire);
setcookie("PASSWORD",$a_pass,$expire);
//header("location:dashboard.php");
echo "<script>window.location='home.php'</script>";
}
else header("location:index.php?login=false");
}
else
{
if((isset($_COOKIE['ADMIN_NAME']) && isset($_COOKIE['PASSWORD'])) && ($_COOKIE['ADMIN_NAME']!="" && $_COOKIE['PASSWORD']!=""))
{
$user=$_COOKIE['ADMIN_NAME'];
$pass=$_COOKIE['PASSWORD'];
$query= "select * from admin where a_name='$user' and a_pass='$pass'";
$result=mysql_query($query) or die("Database connection Failed!");
$count=mysql_num_rows($result);
if($count!=1)
{
header("location:index.php");
}
else
{
header("location:home.php");
}
}
}
?>