<?php
session_start();
?>
<?php
include("include/config.php");
if(isset($_POST['submit']))
{
$username=mysqli_real_escape_string($conn,$_POST['username']);
$password=mysqli_real_escape_string($conn,$_POST['password']);
$query="SELECT * FROM admin WHERE username='$username' AND password='$password'";
$result = mysqli_query($conn, $query) or die(mysqli_error($conn));
$num = mysqli_num_rows($result);
$row1 = mysqli_fetch_array($result);
$access= $row1['Access'];
if($num>0)
{
if($access == 0)
{
$_SESSION['login_user'] = $username;
header("location:https://vinayakamissions.com/vmcc-ticket/admin/notprocess-complaint.php");
exit();
}
else if ($access == 2)
{
$_SESSION['login_user'] = $username;
header("location:https://vinayakamissions.com/vmcc-ticket/maintenance/notprocess-complaint.php");
exit();
}
else
{
$_SESSION['login_user'] = $username;
header("location:https://vinayakamissions.com/vmcc-ticket/superadmin/notprocess-complaint.php");
exit();
}
}
if(!$num)
{
$_SESSION['errmsg']="Invalid username or password";
$extra="index.php";
$host  = $_SERVER['HTTP_HOST'];
$uri  = rtrim(dirname($_SERVER['PHP_SELF']),'/\\');
header("location:http://$host$uri/$extra");
exit();
}
}
//
//if(isset($_POST['wlogin']))
//{
//$mobile=$_POST['mobile'];
//$wpassword=($_POST['wpassword']);
//$rett=mysqli_query("SELECT * FROM workers WHERE Mobile='$mobile' AND Password='$wpassword'");
//$nums=mysqli_fetch_array($conn, $rett);
//if($nums>0)
//{
//if($nums['Role'] == 'admin'){
//header("location:http://localhost/www/ticket090819/admin/reports/workerreport.php");
//exit();
//	}
//	if($nums['Role'] == 'ict'){
//
//header("location:http://localhost/www/ticket090819/ict/reports/workerreport.php");
//exit();
//}
//}
//else
//{
//exit();
//}
//}
?>