Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
Databases_Assesment
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gavin.white
Databases_Assesment
Commits
b62eda9f
Commit
b62eda9f
authored
Jan 19, 2024
by
gavin.white
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
ef2eb3e6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
98 additions
and
0 deletions
+98
-0
index.php
index.php
+98
-0
No files found.
index.php
0 → 100644
View file @
b62eda9f
<!DOCTYPE html>
<html>
<head>
<meta
charset=
"utf-8"
>
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge"
>
<title>
Login Page
</title>
<meta
name=
"description"
content=
""
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<link
rel=
"stylesheet"
href=
""
>
<link
href=
"https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css"
rel=
"stylesheet"
integrity=
"sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN"
crossorigin=
"anonymous"
>
<style>
body
{
background-color
:
#1d2630
;
}
.container
{
margin-top
:
300px
;
}
input
{
max-width
:
300px
;
min-width
:
300px
;
}
</style>
</head>
<body>
<div
class=
"container"
>
<header
class=
"d-flex justify-content-center my-4"
>
<h1
style=
"color: white;"
>
Manager Login
</h1>
</header>
<a
href=
"Customer.php"
class=
"btn btn-primary"
style=
"position: absolute; top: 50px; right: 50px;"
>
I am a customer
</a>
<?php
session_start
();
if
(
$_SERVER
[
"REQUEST_METHOD"
]
==
"POST"
){
// retrieve form data
$username
=
$_POST
[
'username'
];
$password
=
$_POST
[
'password'
];
// database connection
$host
=
"ysjcs.net"
;
$dbusername
=
"gavin.white"
;
$dbpassword
=
"F5EKQPXR"
;
$dbname
=
"gavinwhite_library"
;
$conn
=
new
mysqli
(
$host
,
$dbusername
,
$dbpassword
,
$dbname
);
if
(
$conn
->
connect_error
){
die
(
"Connection failed: "
.
$conn
->
connect_error
);
}
// Validate Login Details
$query
=
"SELECT * FROM Manager WHERE Username='
$username
' AND Password='
$password
'"
;
$result
=
$conn
->
query
(
$query
);
if
(
$result
->
num_rows
==
1
){
// login success
header
(
"Location: registration.php"
);
}
else
{
// login failed
$_SESSION
[
'last_query'
]
=
$query
;
$_SESSION
[
'last_result'
]
=
$result
;
header
(
"Location: error.php"
);
}
$conn
->
close
();
exit
();
}
?>
<div
class=
"row justify-content-center"
>
<div
class=
"col-md-6 col-md-offset-6"
align=
"center"
>
<form
action=
"index.php"
method=
"POST"
>
<input
type=
"text"
name=
"username"
class=
"form-control"
placeholder=
"Enter Username"
/><br
/>
<input
type=
"password"
name=
"password"
class=
"form-control"
placeholder=
"Enter Password"
/><br
/>
<input
type=
"submit"
value=
"Login"
class=
"btn btn-success"
>
</form>
</div>
</div>
</div>
<script
src=
"https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"
integrity=
"sha384-GLhlTQ8iE7NtL7MqQl6dApxQKTtw+Yx2L6i2Buq3SNAi1bSd4+e3q5Aq8aqq9a0Z"
crossorigin=
"anonymous"
async
defer
></script>
</body>
</html>
\ No newline at end of file
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