Crecket

Untitled

Feb 21st, 2015
284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.92 KB | None | 0 0
  1. function failedLogin(){
  2.     echo "test";
  3.     $lastip = $_SERVER['REMOTE_ADDR'];
  4.     $testname2 = mysqli_real_escape_string($con, $_POST['username']);
  5.     $testname = strtolower($testname2);
  6.     $sql= "SELECT attempted FROM failed_logins WHERE Username = '$testname'";
  7.     $result = $conn->query($sql);
  8.     $attempted = 1;
  9.     if (mysqli_num_rows($result) == 0) {
  10.         $sql = "INSERT INTO failed_logins (username, ip_address, attempted) VALUES ('$testname', '$lastip', '$attempted')";
  11.         $conn->query($sql);
  12.     }elseif (mysqli_num_rows($result) == 1) {
  13.         $sql = "UPDATE failed_logins SET attempted = '2' WHERE username = '$testname' AND ip_address = '$lastip'";
  14.         $conn->query($sql);
  15.     }elseif (mysqli_num_rows($result) == 2) {
  16.         $sql = "UPDATE failed_logins SET attempted = '3' WHERE username = '$testname' AND ip_address = '$lastip'";
  17.         $conn->query($sql);
  18.         $sql = "UPDATE users SET Locked = 'Yes' WHERE username = '$testname'";
  19.         $conn->query($sql);
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment