include("admin/classes/initial.php");
include("admin/classes/config.php");
if ($_REQUEST['action']=="dologin") {
$error=0;
$Email = strtolower(trim($_POST['Email']));
$Password = trim($_POST['Password']);
if ($Email=="") {
$error_string .= "Enter your valid email address
";
$error=1;
}
if (strlen($Password)==0) {
$error_string .= "Enter valid passsword to login.
";
$error=1;
}
if ($error==1) {
$error = '{"status":"validation_failed", "message":"'.$error_string.'"}';
die($error);
}else {
/*
if ($_SESSION['MASTER_TRY_LASTCAPTURED']!="") {
$datetime_1 = gmdate("Y-m-d H:i:s");
$datetime_2 = $_SESSION['MASTER_TRY_LASTCAPTURED'];
$start_datetime = new DateTime($datetime_1);
$diff = $start_datetime->diff(new DateTime($datetime_2));
if ($diff->i > 2) {
$_SESSION['MASTER_TRY']="";
$_SESSION['MASTER_TRY_LASTCAPTURED']="";
echo '{"status":"tryagain","message":"Now you can try again"}';die();
}else {
echo '{"status":"tryagain","message":"Please wait for 5 minute before you try again."}';die();
}
}
if ($_SESSION['MASTER_TRY']=="") {
$_SESSION['MASTER_TRY']=0;
}
$_SESSION['MASTER_TRY'] = $_SESSION['MASTER_TRY']+1;
if ($_SESSION['MASTER_TRY']=="5") {
$_SESSION['MASTER_TRY_LASTCAPTURED'] = gmdate("Y-m-d H:i:s");
$error = '{"status":"over_try", "message":"I apologize for the multiple unsuccessful attempts.
You can attempt to log in again in 5 minutes."}';
die($error);
}
*/
$chkrsq = mysqli_query($con,"select * from members where Email='".mysqli_real_escape_string($con,$Email)."' and Password='".mysqli_real_escape_string($con,md5($Password))."'");
if (mysqli_num_rows($chkrsq)==0) {
$error = '{"status":"invalid_login", "message":"Sorry, you have entered invalid credentials."}';
die($error);
}else {
$chkrs = mysqli_fetch_assoc($chkrsq);
if ($chkrs['Status']!="1") {
$error = '{"status":"invalid_login", "message":"Sorry, your account is still not verified by admin.
Please try again later."}';
die($error);
}
$_SESSION['MASTER_ID'] = $chkrs['MemberId'];
$_SESSION['MASTER_NAME'] = $chkrs['FirstName'] . " " . $chkrs['LastName'];
$_SESSION['MASTER_EMAIL'] = $chkrs['Email'];
$_SESSION['MASTER_SESSION_STARTED'] = gmdate("Y-m-d H:i:s");
$error = '{"status":"success", "message":"Login successful!"}';
die($error);
}
}
}
?>
Login to you PROJECT_TITLE Account