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:
Sean Joseph 2017-10-30 11:01:59 -04:00
parent 9a073edded
commit 2628cc8b80
10 changed files with 107 additions and 39 deletions

View File

@ -13,8 +13,7 @@ class AboutView extends View
public function page()
{
$body = <<<HTML
<div class="team">
<h1>Roster:</h1>
<div class="content">
<div class="card">
<h2>James Murray - Project Manager</h2>
<img src="assets/james_murray.jpg" height="1365" width="1372" alt="James Murray">

22
lib/MinutesView.php Normal file
View File

@ -0,0 +1,22 @@
<?php
require_once "View.php";
/**
* Created by PhpStorm.
* User: sean
* Date: 10/30/17
* Time: 10:37 AM
*/
class MinutesView extends View
{
public function page(){
$body = <<<HTML
HTML;
return $body;
}
}

View File

@ -6,7 +6,7 @@
* Date: 10/29/17
* Time: 6:59 PM
*/
class LoginController
class SecureLoginController
{
public function __construct($get, $post, $logins)
{

33
lib/SecureLoginView.php Normal file
View File

@ -0,0 +1,33 @@
<?php
require_once "View.php";
class SecureLoginView extends View
{
public function page()
{
$body = <<<HTML
<div class="content">
<div class="card">
<form action="../post/login.php" method="post">
<fieldset>
<p>
<label for="username">Username:</label>
<input type="text" id="username" name="username" placeholder="Username">
</p>
<p>
<label for="password">Password:</label>
<input type="password" id="password" name="password" placeholder="Password">
</p>
<p><input type="submit" name="Submit" value="Submit"></p>
</fieldset>
</form>
</div>
</div>
HTML;
return $body;
}
}

View File

@ -1,4 +1,5 @@
<?php
require_once "prelude.inc.php";
/**
* Created by PhpStorm.
@ -10,19 +11,18 @@ class View
{
public function __construct() {
$this->addNav("Home", "./");
$this->addNav("Progress", "./");
$this->addNav("Meet The Team", "./about.php");
$this->addNav("Home", ROOT);
$this->addNav("Meet The Team", ROOT . "about.php");
$this->addNav("Secure", ROOT ."secure");
$this->addNav("Course Site", "https://cse.msu.edu/~cse435/");
$this->addNav("Secure", "./secure");
}
public function head(){
$root = ROOT;
$html = <<<HTML
<meta charset="utf-8">
<meta charset="UTF-8">
<title>$this->title</title>
<link href="./style/default.css" rel="stylesheet" type="text/css">
<link href="{$root}style/default.css" rel="stylesheet" type="text/css">
HTML;
return $html;
@ -80,6 +80,6 @@ HTML;
}
private $links = array();
private $title = "Not Set!";
protected $title = "Not Set!";
}

View File

@ -7,9 +7,10 @@
*/
require_once "prelude.inc.php";
if(!$open){
if(!isset($_SESSION[LOGIN])){
header("Location: ../secure/index.php");
header("Location: " . ROOT . "secure/index.php");
}
}

View File

@ -7,9 +7,9 @@
*/
require_once "../lib/prelude.inc.php";
require_once "../lib/logins.inc.php";
require_once "../lib/LoginController.php";
require_once "../lib/SecureLoginController.php";
$controller = new LoginController($_GET,$_POST,$logins);
$controller = new SecureLoginController($_GET,$_POST,$logins);
if($controller->validLogin()){

View File

@ -1,28 +1,21 @@
<!DOCTYPE html>
<?php
require_once "../lib/prelude.inc.php";
require_once "../lib/SecureLoginView.php";
$view = new SecureLoginView();
$view->setTitle("Secure Pages Login");
?>
<html>
<head>
<meta charset="UTF-8">
<title>Secure Pages Login</title>
<link href="../style/default.css" type="text/css" rel="stylesheet">
<?php
echo $view->head();
?>
</head>
<body>
<h1>Secure Pages Login</h1>
<form action="../post/login.php" method="post">
<fieldset>
<legend>Login</legend>
<p>
<label for="username">Username:</label>
<input type="text" id="username" name="username" placeholder="Username">
</p>
<p>
<label for="password">Password:</label>
<input type="password" id="password" name="password" placeholder="Password">
</p>
<input type="submit" name="Submit" value="Submit">
</fieldset>
</form>
<?php
echo $view->header();
echo $view->page();
echo $view->footer();
?>
</body>
</html>

View File

@ -2,14 +2,21 @@
<?php
require_once "../lib/prelude.inc.php";
require_once "../lib/protected.inc.php";
require_once "../lib/MinutesView.php";
$view = new MinutesView();
$view->setTitle("Meeting Minutes");
?>
<html>
<head>
<meta charset="UTF-8">
<link href="../style/default.css" rel="stylesheet" type="text/css">
<title>Meeting Minutes</title>
<?php
echo $view->head();
?>
</head>
<body>
<h1>Meeting Minutes</h1>
<?php
echo $view->header();
echo $view->page();
echo $view->footer();
?>
</body>
</html>

View File

@ -30,6 +30,7 @@ body {
*/
body{
background: darkgreen;
font-family: Serif;
}
header {
@ -37,6 +38,7 @@ header {
background : rgba(255,255,255,1);
text-align: center;
line-height: 3em;
border-bottom: 20px solid gray;
}
header h1 {
@ -74,6 +76,7 @@ div.card img{
height:400px;
width:300px;
border:thick solid black;
border-radius: 10px;
display:block;
padding: 5px;
margin: auto;
@ -81,8 +84,8 @@ div.card img{
}
div.card p{
padding: 0 4em;
margin: 0.75em 0;
width: 400px;
margin: 0.75em auto;
}
div.card ul{
@ -91,9 +94,19 @@ div.card ul{
display: block;
}
div.team h1{
div.content h1{
font-size: 3em;
text-align: center;
margin: 0.75em 0;
color: white;
}
div.card form{
padding: 25px;
}
div.card form fieldset{
border: thin solid black;
text-align: center;
}