function blockBrowser() { include "usefullInformation.php"; $browser = new usefullInformation(); if ($browser->getBrowser($browser->getUserAgentString()) === "Internet Explorer 9") { die("Features of this website aren't supported in Internet Explorer 9. Please upgrade your browser."); } }
<!DOCTYPE html> <html> <head> <?php include "includes/dependencies.php"; include "php/database.php"; ?> <?php if (isset($_SESSION["username"])) { ?> <title>My Account</title> <?php $usefulInformation = new usefullInformation(); ?> <script type="text/javascript"> function init(username){ $.ajax({ type:"post", url:"php/getUserDetails.php", data:"username="******"#admintab").hide(); var TheDetails = jQuery.parseJSON(data); $("#welcome").html("Hey, "+TheDetails.firstname); $("#username").html(TheDetails.username); $("#firstname").val(TheDetails.firstname); $("#surname").val(TheDetails.surname); $("#username").val(TheDetails.username); $("#email").val(TheDetails.email_address); $("#editusername").val(TheDetails.username);
<?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)) {