This repository was archived by the owner on Sep 23, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathindex.php
More file actions
65 lines (56 loc) · 1.92 KB
/
index.php
File metadata and controls
65 lines (56 loc) · 1.92 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
60
61
62
63
64
65
<!-- Developed by NerdOfCode -->
<!Doctype html>
<?php
session_start();
if($_SESSION['status']=="1"){
header("Location: /options.php");
$_SESSION['logged_in']="1";
}
?>
<html>
<head>
<title>Admin Panel</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="newstyle.css">
</head>
<body>
<h1 style="text-align:center;">Admin Panel</h1><hr>
<form name="index" id="index" action="" method="post">
Username: <input type="text" name="UID" id="UID" required><br><br>
Password: <input type="password" name="passwd" id="passwd" required><br><br>
<input type="submit" value="Submit" onClick=""">
</form>
<script>
$(document).ready(function(){
$('#form').submit(function(){
$('#UID').fadeOut(500);
$('#passwd').fadeOut(500);
})
});
var input = document.getElementById('UID');
input.focus();
input.select();
</script>
<p class="footer"> <a href="/contributors.html" target="_blank">Contributors</a> | <a href="/LICENSE" target="_blank">License</a> | <a href="mailto:team@nerdofcode.com?subject=admin-panel" target="_blank">Contact</a></p>
</body>
<?php
include('user.php');
$user_name = $_POST['UID'];
$_SESSION['user']="$user_name";
$user_password = $_POST['passwd'];
$db = mysqli_connect('localhost',$user,$pass,$database) or die("Error connecting to MYSQL");
$query = "SELECT password FROM $table WHERE name = '$user_name'";
mysqli_query($db, $query) or die("<p class=\"text-align:center;\">Unable to access MYSQL</p>");
$result = mysqli_query($db, $query);
$row = mysqli_fetch_array($result);
$password=$row['password'];
if(password_verify($_POST['passwd'], $password)){
$_SESSION['status'] = "1";
header("Location: /options.php");
die();
}else if(!empty($user_name)){
echo "<p class=\"false\" style=\"color:red;text-align:center;\">INVALID</p>";
}
mysqli_close($db);
?>
</html>