implemented hashbrown assignment.
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
.success,
|
||||
.error {
|
||||
padding: 30px;
|
||||
border: 3px solid black;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.success {
|
||||
background-color: green;
|
||||
}
|
||||
|
||||
.error {
|
||||
background-color: red;
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<title>Dummy Title</title>
|
||||
<link href="css/styles.css" type="text/css" rel="stylesheet">
|
||||
<script src="js/index.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Hello cruel world!</h1>
|
||||
<?php
|
||||
if (isset($_POST['username']) && isset($_POST['password'])) {
|
||||
if ($_POST['username'] == 'beavis' && $_POST['password'] == 'pass') {
|
||||
echo '
|
||||
<div class="success">
|
||||
<h3>Access Granted</h3>
|
||||
</div>
|
||||
';
|
||||
} else {
|
||||
echo '
|
||||
<div class="error">
|
||||
<h3>Access Denied</h3>
|
||||
</div>
|
||||
';
|
||||
echo form();
|
||||
}
|
||||
} else {
|
||||
echo form();
|
||||
}
|
||||
|
||||
function form()
|
||||
{
|
||||
return '
|
||||
<form method="post">
|
||||
<label for="username">Username:</label>
|
||||
<input id="username" name="username" required>
|
||||
|
||||
<label for="password">Password:</label>
|
||||
<input type="password" id="password" name="password" required>
|
||||
|
||||
<input type="submit" value="Log In">
|
||||
</form>
|
||||
';
|
||||
}
|
||||
?>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,43 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<title>Dummy Title</title>
|
||||
<link href="css/styles.css" type="text/css" rel="stylesheet">
|
||||
<script src="js/index.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Hello cruel world!</h1>
|
||||
<?php
|
||||
|
||||
$user = 'beavis';
|
||||
$pass = 'pass';
|
||||
|
||||
if (isset($_POST['username']) && isset($_POST['password'])) {
|
||||
if ($_POST['username'] == $user && $_POST['password'] == $pass)
|
||||
echo '<h1>Access Granted</h1>';
|
||||
else
|
||||
echo '<h1>Access Denied</h1>' . login_form();
|
||||
} else
|
||||
echo login_form();
|
||||
|
||||
function login_form()
|
||||
{
|
||||
$form = '
|
||||
<form method="post">
|
||||
<label for"username">Username:</label>
|
||||
<input id="username" name="username" required>
|
||||
|
||||
<label for="password">Password:</label>
|
||||
<input id="password" type="password" name="password" required>
|
||||
|
||||
<input type="submit">
|
||||
';
|
||||
|
||||
return $form;
|
||||
}
|
||||
?>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,35 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<title>Dummy Title</title>
|
||||
<link href="css/styles.css" type="text/css" rel="stylesheet">
|
||||
<script src="js/index.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Hello cruel world!</h1>
|
||||
<?php
|
||||
if (!empty($_POST)) {
|
||||
foreach ($_POST as $key => $value) {
|
||||
echo '<p>' . $value . '</p>';
|
||||
}
|
||||
} else {
|
||||
$form = '
|
||||
<form method="post">
|
||||
<input name="1">
|
||||
<input name="2">
|
||||
<input name="3">
|
||||
<input name="4">
|
||||
<input name="5">
|
||||
|
||||
<input type="submit">
|
||||
</form>
|
||||
';
|
||||
|
||||
echo $form;
|
||||
}
|
||||
?>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user