function login() { $controllerAuthentication = new ControllerAuthentication(); $auth = $controllerAuthentication->login($_POST['username'], md5($_POST['password'])); if ($auth != null) { $_SESSION['name'] = $auth->name; header("Location: home.php"); } else { echo "<script>alert('Invalid Username/Password.');</script>"; } }
<?php require_once 'header.php'; $controller = new ControllerAuthentication(); $extras = new Extras(); $authentication_id = $extras->decryptQuery1(KEY_SALT, $_SERVER['QUERY_STRING']); $user = $controller->getAccessUserByAuthenticationId($authentication_id); if ($authentication_id != null) { if (isset($_POST['submit'])) { $itm = new Authentication(); $itm->authentication_id = $user->authentication_id; $itm->name = trim(strip_tags($_POST['name'])); $itm->username = $user->username; $pass = trim(strip_tags($_POST['password'])); $password_confirm = trim(strip_tags($_POST['password_confirm'])); $password_current = trim(strip_tags($_POST['password_current'])); $itm->password = md5($pass); if (strlen($pass) < 8) { echo "<script >alert('Password field must be atleast 8 alphanumeric characters.');</script>"; } else { if ($user->password != md5($password_current)) { echo "<script >alert('Current password does not match.');</script>"; } else { if ($pass != $password_confirm) { echo "<script >alert('Password does not match.');</script>"; } else { $controller->updateAccessUser($itm); echo "<script type='text/javascript'>location.href='admin_access.php';</script>"; } } }
<?php require_once 'header.php'; $controller = new ControllerAuthentication(); if (isset($_POST['submit'])) { if (!$controller->checkUsername($_POST['username'])) { $itm = new Authentication(); $itm->name = trim(strip_tags($_POST['name'])); $itm->username = trim(strip_tags($_POST['username'])); $pass = trim(strip_tags($_POST['password'])); $password_confirm = trim(strip_tags($_POST['password_confirm'])); $itm->password = md5($pass); if (strlen($pass) < 8) { echo "<script >alert('Password field must be atleast 8 alphanumeric characters.');</script>"; } else { if ($pass != $password_confirm) { echo "<script >alert('Password does not match.');</script>"; } else { $controller->insertAccessUser($itm); echo "<script type='text/javascript'>location.href='admin_access.php';</script>"; } } } else { echo "<script >alert('Username already taken.');</script>"; } } ?> <!DOCTYPE html> <html lang="en"><head>
<?php session_start(); $_SESSION['name'] = ""; require 'controllers/ControllerAuthentication.php'; $controller = new ControllerAuthentication(); if (isset($_POST['submit'])) { $auth = $controller->login($_POST['username'], md5($_POST['password'])); if ($auth != null) { $_SESSION['name'] = $auth->name; // header("Location:home.php"); echo "<script type='text/javascript'>location.href='home.php';</script>"; } else { echo "<script>alert('Invalid Username/Password.');</script>"; } } ?> <!DOCTYPE html> <html lang="en"><head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content=""> <meta name="author" content=""> <link rel="shortcut icon" href="http://getbootstrap.com/assets/ico/favicon.ico"> <title>RealEstate Finder Signin</title>
<?php require 'header.php'; $controller = new ControllerAuthentication(); $users = $controller->getAccessUser(); if (!empty($_SERVER['QUERY_STRING'])) { $extras = new Extras(); $params = $extras->decryptQuery2(KEY_SALT, $_SERVER['QUERY_STRING']); $user_id = $params[0]; $deny_access = $params[1] == 0 ? 1 : 0; if ($params != null && $params[1] == "deleted") { $controller->deleteAccessUser($user_id, 1); echo "<script type='text/javascript'>location.href='admin_access.php';</script>"; } else { if ($params != null && $deny_access >= 0) { $controller->denyUserAccess($user_id, $deny_access); echo "<script type='text/javascript'>location.href='admin_access.php';</script>"; } else { echo "<script type='text/javascript'>location.href='403.php';</script>"; } } } $search_criteria = ""; if (isset($_POST['button_search'])) { $search_criteria = trim(strip_tags($_POST['search'])); $users = $controller->getAccessUsersBySearching($search_criteria); } ?> <!DOCTYPE html>
function updateAdminUserAccess($auth_id, $deny_access) { $controller = new ControllerAuthentication(); $controller->denyAccessUser($auth_id, $deny_access); echo "<script type='text/javascript'>location.href='admin_access.php';</script>"; }