-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.php
More file actions
53 lines (42 loc) · 1.28 KB
/
index.php
File metadata and controls
53 lines (42 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
/**
* <index.php>
* This is the file that needs to execute
* This file contains all the three parts of the MVC pattern
* MVC is the subdirectory/folder where all the files are placed
*----------------------------------------------------------
* @author Muhammad Anwar Hussain<anwar_hussain.01@yahoo.com>
* Created on: 25th May 2019
*----------------------------------------------------------
*/
require_once __DIR__.'/../MVC/controller.php';
require_once __DIR__.'/../MVC/model.php';
print<<<__USER
<h2 style="color:gray;"> Your Access In Auditorium: </h2>
<form method='POST' action='$_SERVER[PHP_SELF]'>
<label for='username'>User Name:
<input type="text" name='username'>
</label>
<label for='password'>User Password:
<input type="text" name='password'>
</label>
<input type='submit' value='Submit'>
</form>
__USER;
// get the input from client/user through route/http
if ($_SERVER['REQUEST_METHOD']=='POST')
{
[$username, $password] = filterRequest($_POST);
// send the filtered data to the model
// receive the response from the model
$response = retreatResponse($username, $password);
// format the response
$color = 'green';
if ($response == 'denied')
{
$color = 'red';
}
// display the response to the client/user
include(__DIR__.'/../MVC/view.php');
}
?>