Refactored a div class tag to be more general.

Added site style to the secure pages. Renamed LoginController
to SecureLoginController.
This commit is contained in:
2017-10-30 11:01:59 -04:00
parent 9a073edded
commit 2628cc8b80
10 changed files with 107 additions and 39 deletions

View File

@@ -0,0 +1,59 @@
<?php
/**
* Created by PhpStorm.
* User: sean
* Date: 10/29/17
* Time: 6:59 PM
*/
class SecureLoginController
{
public function __construct($get, $post, $logins)
{
$this->get = $get;
$this->post = $post;
$this->logins = $logins;
if(isset($post['username'])){
$username = $post['username'];
if(array_key_exists($username,$logins)){
if(isset($post['password'])) {
$hash = hash("sha256", $post['password']);
if ($hash == $logins[$username]) {
$this->success = true;
$this->redirect = "secure/minutes.php";
}
else{
$this->redirect = "secure/index.php";
}
}
else{
$this->redirect = "secure/index.php";
}
}
else{
$this->redirect = "secure/index.php";
}
}
else{
$this->redirect = "secure/index.php";
}
}
public function getRedirect(){
return $this->redirect;
}
public function validLogin(){
return $this->success;
}
private $get; //Get data
private $post; //Post data
private $logins; //Login data
private $success = false; // successful login flag
private $redirect; //Redirect location
}