ob_start(); ob_clean(); session_start(); include '../dilg/cnt/join.php'; include 'global-values.php'; include 'global-functions.php'; extract($_REQUEST); $Current_Date = date('Y-m-d'); if($Submit=='Login') { $encrypted_password = encryptIt( $Password ); $chk_valid_user = mysql_query("select * from users where username = '$UserName'"); mysql_num_rows($chk_valid_user); if(mysql_num_rows($chk_valid_user) > 0) { $valid_user_res = mysql_fetch_object($chk_valid_user); $msg = ''; $user_type = $valid_user_res->user_type; $company_id = $valid_user_res->company_id; $password = $valid_user_res->password; $status = $valid_user_res->status; $is_deleted = $valid_user_res->is_deleted; if($password != $encrypted_password) $msg = "Password is wrong!!!"; if($status == 0) $msg = "Account deactivated! Kindly contact your admin to reactivate!!!"; if($is_deleted == 1) $msg = "Account Deleted! Kindly contact your admin to reactivate!!!"; if($msg=='') { $_SESSION['USER_ID'] = $valid_user_res->id; $_SESSION['USER_TYPE'] = $valid_user_res->user_type; $_SESSION['USER_NAME'] = $valid_user_res->name; header('Location:home.php'); } } else { $msg = "Not a valid user or username is wrong!!!"; } } ?>