-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2409.php
More file actions
59 lines (56 loc) · 2.58 KB
/
2409.php
File metadata and controls
59 lines (56 loc) · 2.58 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
52
53
54
55
56
57
58
59
<?php
if (isset($_POST['submitLogin'])) {
// echo 'Form is submitted';
// validate form fields are not null in case js is off
if (! empty($_POST['username'])) {
// echo 'validate now';
// filter inputs
$username = filter_input(INPUT_POST, 'username', FILTER_SANITIZE_SPECIAL_CHARS);
// echo $username;
}
if (! empty($_POST['password'])) {
$password = filter_input(INPUT_POST, 'password', FILTER_SANITIZE_SPECIAL_CHARS);
// echo $password;
}
if ($username == 'demo' && $password == '12345') {
echo '<div class="container" style="color:blue;">Welcome my Boy!</div>';
} else {
echo '<div class="container" style="color:red;">Wrong Credentails!</div>';
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Basic PHP form</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/css/bootstrap.min.css" rel="stylesheet"
crossorigin="anonymous">
</head>
<body>
<div class="container">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<div class="form-group mb-3">
<label for="inputUserName" class="form-label">UserName</label>
<input type="text" class="form-control" name="username" id="inputUserName"
aria-describedby="UserNameHelp" placeholder="Your username" required>
<small id="UserNameHelp" class="form-text text-muted">We'll never share your data with anyone else.
</small>
</div>
<div class="form-group mb-3">
<label for="inputUserPassword" class="form-label">Password</label>
<input type="password" class="form-control" name="password" id="inputUserPassword" placeholder=""
maxlength="10" minlength="3" required>
</div>
<button type="submit" class="btn btn-primary" name="submitLogin">Submit</button>
</form>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.8/dist/umd/popper.min.js"
integrity="sha384-I7E8VVD/ismYTF4hNIPjVp/Zjvgyol6VFvRkX/vR+Vc4jQkC+hVqc2pM8ODewa9r" crossorigin="anonymous">
</script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/js/bootstrap.min.js"
integrity="sha384-G/EV+4j2dNv+tEPo3++6LCgdCROaejBqfUeNjuKAiuXbjrxilcCdDz6ZAVfHWe1Y" crossorigin="anonymous">
</script>
</div>
</body>
</html>