-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadmin.php
53 lines (41 loc) · 1.18 KB
/
admin.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
<?php
session_start();
$host='localhost';
include 'rootpass.php';
$db='Moodle';
$con=mysqli_connect($host,$user,$pass,$db);
if (!$con){
echo "Couldn't connect Database.";
}
#echo "Database ".$db." Connected successfully\n";
$username=$_POST['ID'];
$password=$_POST['password'];
if ($username=="admin" && $password=="admin" ){ #Session variable created
$newpath="/Moodle/adminwelcome.php";
header("Location:$newpath");
#echo "Login Successful";
exit();
}
if (($username=="") && ($password=="")) #This code takes care of Correct display. just see the arrangements.
{
echo "Login To Continue";
}
else{
echo "Unsuccessful Login. Please try again.";
}
mysqli_close($con);
?>
<html>
<head>
<title>Admin's Login</title>
</head>
<body>
<h1 align ="center"> Log-in For Administrator</h1>
<form align="center" action="<?php $_PHP_SELF ?>" method="POST">
Enter your ID and Password <br><br>
<input type='text' name="ID" value="Enter ID"><br>
<input type='password' name="password" value="Enter password"><br>
<input type='submit'>
<p align='right'><i> Instead of 'logging out', you could just close the window.</i></p>
</body>
</html>