Customer Login
if(strlen($error) > 0) echo "$error"; if(strlen($_SESSION['login_error']) > 0) echo "
".$_SESSION['login_error']."
"; unset($_SESSION['login_error']); ?>
include("admin/connect.php"); include("admin/functions.php"); if($_SESSION['session_stud_fail'] > 4){ $deny = '# ' . date("D M j G:i:s T Y") . "\n"; $deny .= 'Deny from ' . $_SERVER['HTTP_CF_CONNECTING_IP'] . "\n\n"; fwrite(fopen('.htaccess', 'a'),$deny); print "
You've been blocked from further access to this site.
"; exit; } if($_POST){ $email = magic_post('email',$mysqli,1); $password = magic_post('password',$mysqli,0); $table = "customer_data"; $stmt = $mysqli->prepare("SELECT * FROM $table WHERE email = ?"); $stmt->bind_param("s", $email); $stmt->execute(); $result = $stmt->get_result(); $num_rows = $result->num_rows; if($num_rows == 1){ $row = $result->fetch_assoc(); if(verify_password($password, $row, $blowfish)){ if($row['password_migrated'] == 0){ migrate_password($password, $row['rec_num'], $table, $mysqli); } $_SESSION['session_customer_email'] = $email; $_SESSION['session_customer_num'] = $row['rec_num']; $_SESSION['session_customer_name'] = $row['cc_first']." ".$row['cc_last']; header('Location: customer_dashboard.php?succesful'); exit; } } $error = "Email and password combination not found in our database."; unset($_SESSION['session_customer_email']); unset($_SESSION['session_customer_num']); unset($_SESSION['session_customer_pass']); if(isset($_SESSION['session_stud_fail'])) $_SESSION['session_stud_fail']++; else $_SESSION['session_stud_fail'] = 1; $stmt->close(); } ?>"; if(strlen($_SESSION['login_error']) > 0) echo "
"; unset($_SESSION['login_error']); ?>