removed htaccess in favor of a custom authentication. Most pages are linking to the secure login screen now. I added a minutes page to keep the meeting minutes. Successful logins.
59 lines
1.4 KiB
PHP
59 lines
1.4 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Created by PhpStorm.
|
|
* User: sean
|
|
* Date: 10/29/17
|
|
* Time: 6:59 PM
|
|
*/
|
|
class LoginController
|
|
{
|
|
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
|
|
} |