|
6 | 6 | header("Location: /options.php"); |
7 | 7 | $_SESSION['logged_in']="1"; |
8 | 8 | } |
9 | | - |
10 | | - |
11 | | - |
12 | 9 | ?> |
13 | 10 | <html> |
14 | 11 | <head> |
15 | 12 | <title>Admin Panel</title> |
16 | 13 | <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> |
17 | | - <link rel="stylesheet" type="text/css" href="style.css"> |
| 14 | + <link rel="stylesheet" type="text/css" href="newstyle.css"> |
18 | 15 | </head> |
19 | 16 | <body> |
20 | 17 | <h1 style="text-align:center;">Admin Panel</h1><hr> |
21 | | - <form name="form" id="form" action="" method="post" > |
| 18 | + <form name="index" id="index" action="" method="post"> |
22 | 19 | Username: <input type="text" name="UID" id="UID" required><br><br> |
23 | 20 | Password: <input type="password" name="passwd" id="passwd" required><br><br> |
24 | | - <input type="submit" value="Submit" onClick=""> |
| 21 | + <input type="submit" value="Submit" onClick="""> |
25 | 22 | </form> |
26 | 23 |
|
27 | 24 | <script> |
28 | 25 | $(document).ready(function(){ |
29 | 26 | $('#form').submit(function(){ |
30 | | - $('#UID').fadeOut(); |
31 | | - $('#passwd').fadeOut(); |
| 27 | + $('#UID').fadeOut(500); |
| 28 | + $('#passwd').fadeOut(500); |
32 | 29 | }) |
33 | | - |
34 | 30 | }); |
| 31 | + |
| 32 | +var input = document.getElementById('UID'); |
| 33 | +input.focus(); |
| 34 | +input.select(); |
| 35 | + |
35 | 36 | </script> |
36 | | - |
| 37 | +<p class="footer">By: <a href="https://github.com/NerdOfCode" target="_blank"><b>NerdOf</b>Code</a>, <a href="https://github.com/NerdOfLinux" target="_blank"><b>NerdOf</b>Linux</a> | <a href="https://github.com/NerdOfCode/admin-panel/blob/master/LICENSE">License</a></p> |
37 | 38 | </body> |
38 | 39 |
|
39 | 40 | <?php |
40 | 41 | include('user.php'); |
41 | 42 | $user_name = $_POST['UID']; |
| 43 | +$_SESSION['user']="$user_name"; |
42 | 44 | $user_password = $_POST['passwd']; |
43 | 45 | $db = mysqli_connect('localhost',$user,$pass,$database) or die("Error connecting to MYSQL"); |
44 | 46 | $query = "SELECT password FROM $table WHERE name = '$user_name'"; |
45 | | -mysqli_query($db, $query) or die("Unable to access MYSQL"); |
| 47 | +mysqli_query($db, $query) or die("<p class=\"text-align:center;\">Unable to access MYSQL</p>"); |
46 | 48 | $result = mysqli_query($db, $query); |
47 | 49 | $row = mysqli_fetch_array($result); |
48 | 50 | $password=$row['password']; |
49 | 51 | if(password_verify($_POST['passwd'], $password)){ |
50 | 52 | $_SESSION['status'] = "1"; |
51 | 53 | header("Location: /options.php"); |
52 | 54 | die(); |
53 | | -}else{ |
54 | | - echo "An error has occured... Please try again later"; |
55 | | - $_SESSION['status'] = "0"; |
| 55 | +}else if(!empty($user_name)){ |
| 56 | + echo "<p class=\"false\" style=\"color:red;text-align:center;\">INVALID</p>"; |
56 | 57 | } |
57 | 58 | mysqli_close($db); |
58 | 59 |
|
|
0 commit comments