Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function failedLogin(){
- echo "test";
- $lastip = $_SERVER['REMOTE_ADDR'];
- $testname2 = mysqli_real_escape_string($con, $_POST['username']);
- $testname = strtolower($testname2);
- $sql= "SELECT attempted FROM failed_logins WHERE Username = '$testname'";
- $result = $conn->query($sql);
- $attempted = 1;
- if (mysqli_num_rows($result) == 0) {
- $sql = "INSERT INTO failed_logins (username, ip_address, attempted) VALUES ('$testname', '$lastip', '$attempted')";
- $conn->query($sql);
- }elseif (mysqli_num_rows($result) == 1) {
- $sql = "UPDATE failed_logins SET attempted = '2' WHERE username = '$testname' AND ip_address = '$lastip'";
- $conn->query($sql);
- }elseif (mysqli_num_rows($result) == 2) {
- $sql = "UPDATE failed_logins SET attempted = '3' WHERE username = '$testname' AND ip_address = '$lastip'";
- $conn->query($sql);
- $sql = "UPDATE users SET Locked = 'Yes' WHERE username = '$testname'";
- $conn->query($sql);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment