3 require_once "../../common.php";
4 require_once "SQL/user.php";
7 if (!empty($_GET['logout']))
9 if (!isset($_SESSION['id']))
10 $failmsg = "Nothing to logout from";
18 if ($_POST['username'] && $_POST['password'])
23 $user = new SQLA_User($_POST['username']);
25 /* not being too informative with the login error in case of attackers */
28 $failmsg = "Incorrect login";
30 else if ($user->password_verify($_POST['password']))
32 $_SESSION['id'] = $user->id
;
33 header('Location: ' . BASE_URL
);
34 $user->add_meta("last_login", date("Y-m-d m:i:s"));
38 $failmsg = "Incorrect login";
43 $failmsg = "Couldn't log you in: Missing credentials";
48 <!-- Latest compiled
and minified CSS
-->
49 <link rel
="stylesheet" href
="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css">
51 <!-- jQuery library
-->
52 <script src
="https://cdn.jsdelivr.net/npm/jquery@3.6.1/dist/jquery.slim.min.js"></script
>
55 <script src
="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js"></script
>
57 <!-- Latest compiled JavaScript
-->
58 <script src
="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.bundle.min.js"></script
>
60 <!-- Font Awesome icons
-->
61 <link rel
="stylesheet" href
="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.1/css/all.min.css">
63 <script src
="<?php echo BASE_URL; ?>js/unrealircd-admin.js"></script
>
64 <title
>UnrealIRCd Panel
</title
>
65 <link rel
="icon" type
="image/x-icon" href
="<?php echo BASE_URL; ?>img/favicon.ico">
66 <link href
="<?php echo BASE_URL; ?>css/unrealircd-admin.css" rel
="stylesheet">
67 </head
><div
class="text-center">
68 <a href
="<?php echo BASE_URL; ?>plugins/sql_auth/login.php"><button type
="button" style
="margin:0; top:50%; position: absolute;" class="btn btn-primary" data
-bs
-toggle
="modal" data
-bs
-target
="#loginModaltitle">
73 $
(document
).ready(function(){
74 $
("#loginModal").modal('show');
77 <body role
="document">
78 <div
class="container-fluid">
79 <form method
="post" action
="login.php">
80 <div
class="modal" id
="loginModal" data
-bs
-backdrop
="static" data
-bs
-keyboard
="false" tabindex
="-1" aria
-labelledby
="loginModal" aria
-hidden
="true">
81 <div
class="modal-dialog modal-dialog-centered">
82 <div
class="modal-content">
83 <div
class="modal-header" style
="margin: 0 auto;">
84 <h3
class="modal-title" id
="loginModaltitle"><img src
="<?php echo BASE_URL; ?>img/favicon.ico"> Log in to
use Admin Panel
</h3
>
86 <div
class="modal-body">
87 <div
class="form-group">
89 if (isset($failmsg)) Message
::Fail($failmsg);
91 Message
::Success("You have been logged out");
93 <label
for="username">Username
/ Nick
:</label
>
94 <input style
="width:90%;" type
="text" class="form-control" name
="username" id
="username" >
96 <div
class="form-group">
97 <label
for="password">Password
:</label
>
98 <input style
="width:90%;" type
="password" class="form-control" name
="password" id
="password">
101 <div
class="modal-footer">
102 <a
class="btn btn-secondary" href
="#">Cancel
</a
>
103 <button type
="submit" class="btn btn-primary">Log
-In
</button
>
109 <?php
require_once "../../footer.php";