-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
179 lines (155 loc) · 5.04 KB
/
index.php
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<?php
session_start();
$username = $password = "";
$username_err = $password_err = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if (empty(trim($_POST["username"]))) {
$username_err = "Please enter username.";
} else {
$username = trim($_POST["username"]);
}
if (empty(trim($_POST["password"]))) {
$password_err = "Please enter your password.";
} else {
$password = trim($_POST["password"]);
}
if (empty($username_err) && empty($password_err)) {
$xml = simplexml_load_file('database/users.xml');
foreach ($xml->children() as $user) {
if ($user->username == $username && $user->password == $password) {
$_SESSION['username'] = $username;
header("location: pages/dashboard.php");
exit();
}
}
echo"<script>alert('Invalid Credentials')</script>";
$password_err = "Invalid username or password.";
}
}
?>
<!doctype html>
<html class="no-js" lang="pinoy ako pinoy, ipakita sa mundo kung ano ang kaya mo">
<head>
<?php include "includes/icon.html"?>
<title>Login Page</title>
<link rel="stylesheet" href="bootstrap/css/style.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/normalize.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/css/font-awesome.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/lykmapipo/[email protected]/css/themify-icons.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/pe-icon-7-stroke/dist/pe-icon-7-stroke.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/3.2.0/css/flag-icon.min.css">
<style>
html,
body {
height: 100%;
}
body.my-login-page {
background-color: #f7f9fb;
font-size: 14px;
}
.my-login-page .brand {
width: 90px;
height: 90px;
overflow: hidden;
border-radius: 50%;
margin: 40px auto;
box-shadow: 0 4px 8px rgba(0, 0, 0, .05);
position: relative;
z-index: 1;
}
.my-login-page .brand img {
width: 100%;
}
.my-login-page .card-wrapper {
width: 400px;
}
.my-login-page .card {
border-color: transparent;
box-shadow: 0 4px 8px rgba(0, 0, 0, .05);
}
.my-login-page .card.fat {
padding: 10px;
}
.my-login-page .card .card-title {
margin-bottom: 30px;
}
.my-login-page .form-control {
border-width: 2.3px;
}
.my-login-page .form-group label {
width: 100%;
}
.my-login-page .btn.btn-block {
padding: 12px 10px;
}
.my-login-page .footer {
margin: 40px 0;
color: #888;
text-align: center;
}
.btn{
background-color: #0d0b29;
}
@media screen and (max-width: 425px) {
.my-login-page .card-wrapper {
width: 90%;
margin: 0 auto;
}
}
@media screen and (max-width: 320px) {
.my-login-page .card.fat {
padding: 0;
}
.my-login-page .card.fat .card-body {
padding: 15px;
}
}
</style>
</head>
<body class="my-login-page">
<section class="h-100">
<div class="container h-100">
<div class="row justify-content-md-center h-100">
<div class="card-wrapper">
<div class="brand">
<img src="assets/icon.png" alt="logo">
</div>
<div class="card fat">
<div class="card-body">
<h4 class="card-title">Login</h4>
<!-- ================FORM===================== -->
<form method="POST" class="my-login-validation" novalidate="">
<div class="form-group">
<label for="email">Username</label>
<input id="email" type="text" class="form-control" name="username" value="" required autofocus>
<div class="invalid-feedback"> Email is invalid </div>
</div>
<div class="form-group">
<label for="password">Password <a href="forgot-password.php" class="float-right"> Forgot Password? </a>
</label>
<input id="password" type="password" class="form-control" name="password" required data-eye>
<div class="invalid-feedback"> Password is required </div>
</div>
<div class="form-group">
<div class="custom-checkbox custom-control">
<input type="checkbox" name="remember" id="remember" class="custom-control-input">
<label for="remember" class="custom-control-label">Remember Me</label>
</div>
</div>
<div class="form-group m-0">
<button type="submit" name="login" class="btn btn-block text-white"> Login </button>
</div>
<div class="mt-4 text-center"> Don't have an account? <a href="register.php">Create One</a>
</div>
</form>
<!-- ================FORM===================== -->
</div>
</div>
<div class="footer"> Allrights Reserved Copyright © 2024 — WST </div>
</div>
</div>
</div>
</section>
</body>
</html>