Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
KLUGLUG
Blood Service Portal
Commits
16d28c92
Commit
16d28c92
authored
Oct 26, 2019
by
Ajayguru Madu
Browse files
Upload New File
parent
a44e7146
Changes
1
Hide whitespace changes
Inline
Side-by-side
admin/login.php
0 → 100644
View file @
16d28c92
<!DOCTYPE html>
<html>
<head>
<meta
charset=
"utf-8"
>
<title>
Login
</title>
<link
rel=
"stylesheet"
href=
"css/style.css"
/>
</head>
<body>
<?php
require
(
'db.php'
);
session_start
();
// If form submitted, insert values into the database.
if
(
isset
(
$_POST
[
'username'
])){
$username
=
stripslashes
(
$_REQUEST
[
'username'
]);
// removes backslashes
$username
=
mysqli_real_escape_string
(
$con
,
$username
);
//escapes special characters in a string
$password
=
stripslashes
(
$_REQUEST
[
'password'
]);
$password
=
mysqli_real_escape_string
(
$con
,
$password
);
//Checking is user existing in the database or not
$query
=
"SELECT * FROM `admins` WHERE username='
$username
' and password='
$password
'"
;
$result
=
mysqli_query
(
$con
,
$query
)
or
die
(
mysqli_error
());
$rows
=
mysqli_num_rows
(
$result
);
if
(
$rows
==
1
){
$_SESSION
[
'username'
]
=
$username
;
header
(
"Location: index.php"
);
// Redirect user to index.php
}
else
{
echo
"<div class='form'><h3>Username/password is incorrect.</h3><br/>Click here to <a href='login.php'>Login</a></div>"
;
}
}
else
{
?>
<div
class=
"form"
>
<h1>
Log In
</h1>
<form
action=
""
method=
"post"
name=
"login"
>
<input
type=
"text"
name=
"username"
placeholder=
"Username"
required
/>
<input
type=
"password"
name=
"password"
placeholder=
"Password"
required
/>
<input
name=
"submit"
type=
"submit"
value=
"Login"
/>
</form>
<p><b>
Not registered yet? Contact your Regional Officer
</b></p>
</div>
<?php
}
?>
</body>
</html>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment