?> </td> </tr> <tr> <td>Your Web Browser</td> <td><?php echo $usefulInformation->getBrowser($usefulInformation->getUserAgentString()); ?> </td> </tr> <tr> <td>Your IP Address</td> <td> <?php echo $usefulInformation->getIPAddress(false); ?> </td> </tr> <tr> <td>Your Operating System</td> <td><?php echo $usefulInformation->getOS($usefulInformation->getUserAgentString()); ?> </td> </tr> <tr> <td>My Screen Resolution</td> <td><div id="res">f</div></td> </tr> </tbody>
<?php session_start(); include "database.php"; include "usefullInformation.php"; if (isset($_POST["username"])) { $information = new usefullInformation(); $username = preg_replace("#[^a-z0-9 ]#i", "", $_POST["username"]); $password = preg_replace("#[^a-z0-9!?\$]#i", "", $_POST["password"]); $ip = $information->getIPAddress(); $OS = $information->getOS($information->getUserAgentString()); $d = date("d/m/o H:i:s"); $type = "Login Error"; $browser = $information->getBrowser($information->getUserAgentString()); if (empty($username) && empty($password)) { echo "A username and password is required! This error has been recorded"; $message = "No username or password entered"; $error = $database->prepare("INSERT INTO `logs` (type,ip,logged_date,browser,operating_system,messages) VALUES (:type,:ip,:d,:browser,:os,:m)"); $error->execute(array(":type" => $type, ":ip" => $ip, ":d" => $d, ":browser" => $browser, ":os" => $OS, ":m" => $message)); } else { $query = $database->prepare("SELECT * FROM `users` WHERE username=:username"); $query->execute(array(":username" => $username)); if ($query->rowCount() > 0) { while ($r = $query->fetch(PDO::FETCH_OBJ)) { if ($r->username !== $username) { echo $username . " Doesn't exist. This error has been recorded"; $message = "Incorrect username entered"; $error = $database->prepare("INSERT INTO `logs` (type,ip,logged_date,browser,operating_system,messages) VALUES (:type,:ip,:d,:browser,:os,:m)"); $error->execute(array(":type" => $type, ":ip" => $ip, ":d" => $d, ":browser" => $browser, ":os" => $OS, ":m" => $message)); } else { if ($r->password === md5($password)) {