<?php
ob_start();
session_start(); 

include("include/config.php");
$message	="&nbsp;";

/*if ($_SERVER['REQUEST_URI']=="/index.php")

{

	echo "<script>location.href='./index.php'</script>";

	exit;

}

if(isset($_SESSION['admin_id']))

{

	echo "<script>location.href='index.php'</script>";

	exit;

}*/

if(isset($_REQUEST['Login']))

{

	if($_REQUEST['username']!="" && $_REQUEST['password']!="")

	{

		$username		=$_REQUEST['username'];

		$password		=md5($_REQUEST['password']);
		 
		$sel_qry		="SELECT * FROM cf_user_07 WHERE name='$username' AND password='$password'";
		$sel_res		=mysql_query($sel_qry);
		if($sel_res && mysql_num_rows($sel_res)>0)

		{

			while($sel_data=mysql_fetch_object($sel_res))

			{

				if($sel_data->status == '1')

				{
					$_SESSION['emp_id']=$sel_data->e_id;
					$_SESSION['admin_id']=$sel_data->userid;
					$_SESSION['typename']=$sel_data->type;
					$_SESSION['master_stat']=$sel_data->master_status;
					$_SESSION['client_status']=$sel_data->client_status;
					$_SESSION['vendor_status']=$sel_data->vendor_status;
					$_SESSION['vehicle_status']=$sel_data->vehicle_status;
					$_SESSION['product_status']=$sel_data->product_status;
					$_SESSION['user_status']=$sel_data->user_status;
					$_SESSION['kopra_status']=$sel_data->kopra_status;
					$_SESSION['sku_status']=$sel_data->sku_status;
					$_SESSION['filmroll_status']=$sel_data->filmroll_status;
					$_SESSION['brand_status']=$sel_data->brand_status;
					$_SESSION['agmark_status']=$sel_data->agmark_status;
					$_SESSION['openingbal_status']=$sel_data->openingbal_status;					
					
					$_SESSION['hr_status']=$sel_data->hr_status;
					$_SESSION['branch_status']=$sel_data->branch_status;
					$_SESSION['department_status']=$sel_data->department_status;
					$_SESSION['designation_status']=$sel_data->designation_status;
					$_SESSION['employee_status']=$sel_data->employee_status;					
					
					$_SESSION['timesheet_status']=$sel_data->timesheet_status;
					$_SESSION['leave_status']=$sel_data->leave_status;
					$_SESSION['payroll_status']=$sel_data->payroll_status;
					$_SESSION['setting_status']=$sel_data->setting_status;
					$_SESSION['purchase_status']=$sel_data->purchase_status;
					$_SESSION['oilpurchase_status']=$sel_data->oilpurchase_status;
					$_SESSION['koprapurchase_status']=$sel_data->koprapurchase_status;
					$_SESSION['purcahsedashboard_status']=$sel_data->purcahsedashboard_status;
					$_SESSION['inventory_status']=$sel_data->inventory_status;
					$_SESSION['warehousestock_status']=$sel_data->warehousestock_status;					
					
					$_SESSION['skustock_status']=$sel_data->skustock_status;
					$_SESSION['pinnakustock_status']=$sel_data->pinnakustock_status;
					$_SESSION['stationary_status']=$sel_data->stationary_status;
					$_SESSION['package_status']=$sel_data->package_status;
					
					$_SESSION['addpackage_status']=$sel_data->addpackage_status;
					$_SESSION['packagelist_status']=$sel_data->packagelist_status;
					$_SESSION['agmarkno_status']=$sel_data->agmarkno_status;
					$_SESSION['sales_status']=$sel_data->sales_status;
					$_SESSION['addsales_status']=$sel_data->addsales_status;
					$_SESSION['saleslist_status']=$sel_data->saleslist_status;
					$_SESSION['tripsheet_status']=$sel_data->tripsheet_status;
					$_SESSION['addtripsheet_status']=$sel_data->addtripsheet_status;
					$_SESSION['tripsheetpending_status']=$sel_data->tripsheetpending_status;
					$_SESSION['tripsheetfinished_status']=$sel_data->tripsheetfinished_status;
					$_SESSION['vehiclemaster_status']=$sel_data->vehiclemaster_status;
					
					
					$_SESSION['vehiclenotif_status']=$sel_data->vehiclenotif_status;
					$_SESSION['vehiclemilage_status']=$sel_data->vehiclemilage_status;
					$_SESSION['account_status']=$sel_data->account_status;
					$_SESSION['accountgroup_status']=$sel_data->accountgroup_status;
					$_SESSION['ledgergroup_status']=$sel_data->ledgergroup_status;
					$_SESSION['receipt_status']=$sel_data->receipt_status;
					$_SESSION['voucher_status']=$sel_data->voucher_status;
					$_SESSION['advance_status']=$sel_data->advance_status;
					$_SESSION['acpayable_status']=$sel_data->acpayable_status;
					$_SESSION['cashbook_status']=$sel_data->cashbook_status;
					$_SESSION['bankbook_status']=$sel_data->bankbook_status;
					$_SESSION['journal_status']=$sel_data->journal_status;
					$_SESSION['plac_status']=$sel_data->plac_status;
					
					
					$_SESSION['ses_name']=$sel_data->name;
					$_SESSION['ses_mailid']=$sel_data->email;

					//header("Location:./admin.php");

					echo "<script>location.href='home.php'</script>";

					exit;

				}

				else

				{

					$message="<img src=images/stop_nav.png width=25 height=25 align=absmiddle> We cannot log you into your account at this time. Please try again later.You are Blocked by the Administrator!";

				}

			}

		}

		else

		{

			$message="<img src=images/stop_nav.png width=25 height=25 align=absmiddle> We cannot log you into your account at this time. Please try again later.This is generally means your username or password is incorrect !";

		}

	}

	else

	{

		$message="<img src=images/stop_nav.png width=25 height=25 align=absmiddle> Required field cannot be left blank !";

	}

}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>OIL FILL</title>
<link href="css/styles.css" rel="stylesheet"  />
<link rel="canonical" href="http://www.explorekeralatours.com/CandF/index.php/" />
<script type="text/javascript">

  //  var u = "http://www.explorekeralatours.com/CandF/";

    if (self.parent.frames.length != 0) self.parent.location = u;

    if (self.location != u) self.location = u;

</script>
<script language="javascript">
function validate()
{
	var formlogin=document.login_frm;
	if(formlogin.username.value=='')
	{
	alert("Enter User Name");
	return false;
	}
	if(formlogin.password.value=='')
	{
	alert("Enter Password");
	return false;
	}
	else
	{
	return true;
	}
	
}
</script>
<style>
body {
	margin:0px;
	padding:0px;
	background-image:url(images/bg0.png);
	background-repeat:repeat;
	background-color:#e6e6e6;
}
body, h1, h2, h3, h4, h5, h6, p, ul, li, input, form, table, td, tr, a, ol, th, b, div, img, select, textarea {
	margin:0;
	padding:0;
	text-decoration:none;
	list-style:none;
	border:none;
	font-family:Arial, Helvetica, sans-serif;
}
.login-wrap {
	margin:0px;
	padding:0px;
}
.header {
	background-image:url(images/login-top.png);
	background-repeat:repeat-x;
	height:231px;
	padding-top:30px
}
.login-txt01 {
	color:#d8c250;
	font-size:36px;
	text-transform:uppercase;
	text-align:center;
	padding-top:40px;
}
.login-txt02 {
	color:#ffffff;
	font-size:20px;
	text-align:center;
	padding-top:10px;
}
.login-txt03 {
	color:#e5e3e3;
	font-size:13px;
	text-align:center;
	text-transform:uppercase;
}
.login-bx {
	background-image:url(images/login-bg.png);
	background-repeat:no-repeat;
	width:449px;
	height:280px;
	margin:-90px auto 0px auto;
}
.login-div {
	padding:20px;
	width:78%;
	margin:0 auto 17px auto;
}
.login-lbl {
	height:24px;
	background-image:url(images/bg01.png);
	border-top-left-radius:5px;
	border-bottom-left-radius:5px;
	width:99px;
	color:#fff;
	font-size:14px;
	padding:7px 0px 0px 10px;
	float:left;
}
.login-fld {
	height:24px;
	background-image:url(images/bg02.png);
	border-top-right-radius:5px;
	border-bottom-right-radius:5px;
	width:231px;
	color:#fff;
	font-size:14px;
	padding:7px 0px 0px 10px;
	float:right;
}
.login-div input[type="text"] {
	background:transparent;
	border:none;
	width:221px;
	padding:0px 5px 0px 0px;
}
.login-div input[type="password"] {
	background:transparent;
	border:none;
	width:221px;
	padding:0px 5px 0px 0px;
}
</style>
</head>

<body>

<div class="login-wrap">
  <div class="header" >
    <p class="login-txt01">login</p>
    <p class="login-txt02">OIL FILL</p>
    <p class="login-txt03"></p>
  </div>
  <form name="login_frm" method="post" action="index.php">
  <div class="login-bx">
    <!--<p style="text-align:center; padding-top:10px;"><img src="images/mukkadan-logo1.png" alt="logo" /></p>-->
    <div class="login-div">
      <div class="login-lbl">Username</div>
      <div class="login-fld">
        <input type="text" name="username" class="login_Text" />
      </div>
    </div>
    <div class="login-div">
      <div class="login-lbl">Password</div>
      <div class="login-fld">
        <input type="password" name="password" class="login_Text" >
      </div>
    </div>
    <p style="float:right; padding-right:49px;"><input type="submit" name="Login" value="Login"  onclick="return validate();" class="login_btn" /></p>
  </div>
  </form>
</div>


<!--<div class="cont">
<form name="login_frm" method="post" action="index.php">
  <div class="loginArea">
  <input type="text" name="username" class="username" />
  <input type="password" name="password" class="password" /> 
  <input type="submit" class="login" name="Login" value="Login" onclick="return validate();" />
   
  </div>
  </form>
 
 </div>-->
</body>
</html>
