session_start();
include 'headers.php';
echo "
";
include 'scripts.php';
db_connect();
//post variables
$username = $_POST['username'];
$agent_code=$username;
$auns=md5($username);
$password = md5($_POST['password']);
$agent_code = $username;
//start login scripts
if (isset($_POST['Submit']))
{
//see if the code the user typed matched the generated code
if (strtoupper($_POST['code']) == $_SESSION['code'])
{
//verified the login status and continue
$LoginQuery = "select * from tb_agent_reg where agent_id = '".$username."' and pass = '".$password."'";
$loginOk = false;
$LoginQueryResult = mysql_query($LoginQuery);
//Check username and password information
$row = mysql_fetch_array($LoginQueryResult);
if (!$row)
{
$Error = 'Sorry, you DO NOT have Permission to view this Page!!!';
}
else
{
$_SESSION['agent_logged'] = $_POST['username'];
$_SESSION['agent_password'] = md5($_POST['password']);
$_SESSION['agent_fullname'] = $row['fullname'];
$_SESSION['agent_code'] = $row['agent_id'];
//Get D Login Status
$_SESSION['login_status'] = $row['login_status'];
//get previously used last login b4 update with d new one
$_SESSION['prev_last_login'] = $row['last_login'];
//test if last login is null
if (($row['last_login']) == "")
{
$login_time = date('h:i A');
$login_date = get_date();
$last_logins = $login_date.' , '.$login_time;
$_SESSION['prev_last_login'] = $last_logins ;
}
else
{
$_SESSION['prev_last_login'] = $row['last_login'];
}
$_SESSION['agent_login'] = "OK";
$_SESSION['processor'] = $_POST['username'];
//update the user reg with last login Date & Time
$login_time = date('h:i A');
$login_date = get_date();
$last_logins = $login_date.' , '.$login_time;
$P = $_SESSION['agent_logged'];
$sqlupdate = "UPDATE tb_agent_reg SET last_login='$last_logins' "."WHERE agent_id = '$P'";
//load agent profile window
if (!(mysql_query($sqlupdate)))
{
die(mysql_error());
}
else
{
/*//update the user login status
$status = 'Login';
$P = $_SESSION['agent_logged'];
$sqlupdate1 = "UPDATE tb_agent_reg SET login_status='$status' "."WHERE agent_id = '$P'";
//load agent profile window
if (!(mysql_query($sqlupdate1)))
{
die(mysql_error());
}*/
header("location: Agents_profile.php?ai_d=$password&aun=$auns&as_f=$password.$auns");
}
}
}
else
{
$Error = 'You have entered the Wrong Security Code. Please, try again';
}
}
?>
Agents Login Access |
||
©
echo $footerNote; ?> Insurvisa.com . All rights reserved Powered by Access Solutions |
||