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'])
21 'cookie_lifetime' => 86400,
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
);
37 $failmsg = "Incorrect login";
42 $failmsg = "Couldn't log you in: Missing credentials";
47 <!-- Latest compiled
and minified CSS
-->
48 <link rel
="stylesheet" href
="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css">
50 <!-- jQuery library
-->
51 <script src
="https://cdn.jsdelivr.net/npm/jquery@3.6.1/dist/jquery.slim.min.js"></script
>
54 <script src
="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js"></script
>
56 <!-- Latest compiled JavaScript
-->
57 <script src
="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.bundle.min.js"></script
>
59 <!-- Font Awesome icons
-->
60 <link rel
="stylesheet" href
="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.1/css/all.min.css">
62 <script src
="<?php echo BASE_URL; ?>js/unrealircd-admin.js"></script
>
63 <title
>UnrealIRCd Panel
</title
>
64 <link rel
="icon" type
="image/x-icon" href
="<?php echo BASE_URL; ?>img/favicon.ico">
65 <link href
="<?php echo BASE_URL; ?>css/unrealircd-admin.css" rel
="stylesheet">
66 </head
><div
class="text-center">
67 <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">
72 $
(document
).ready(function(){
73 $
("#loginModal").modal('show');
76 <body role
="document">
77 <div
class="container-fluid">
78 <form method
="post" action
="login.php">
79 <div
class="modal" id
="loginModal" data
-bs
-backdrop
="static" data
-bs
-keyboard
="false" tabindex
="-1" aria
-labelledby
="loginModal" aria
-hidden
="true">
80 <div
class="modal-dialog modal-dialog-centered">
81 <div
class="modal-content">
82 <div
class="modal-header" style
="margin: 0 auto;">
83 <h3
class="modal-title" id
="loginModaltitle"><img src
="<?php echo BASE_URL; ?>img/favicon.ico"> Log in to
use Admin Panel
</h3
>
85 <div
class="modal-body">
86 <div
class="form-group">
88 if (isset($failmsg)) Message
::Fail($failmsg);
90 Message
::Success("You have been logged out");
92 <label
for="username">Username
/ Nick
:</label
>
93 <input style
="width:90%;" type
="text" class="form-control" name
="username" id
="username" >
95 <div
class="form-group">
96 <label
for="password">Password
:</label
>
97 <input style
="width:90%;" type
="password" class="form-control" name
="password" id
="password">
100 <div
class="modal-footer">
101 <a
class="btn btn-secondary" href
="#">Cancel
</a
>
102 <button type
="submit" class="btn btn-primary">Log
-In
</button
>
108 <?php
require_once "../../footer.php";