Browse code

Created repository.

DoubleBastionAdmin authored on 29/11/2024 03:10:08
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,154 @@
1
+<!doctype html>
2
+<!--
3
+ * @copyright 2024 Double Bastion LLC <www.doublebastion.com>
4
+ *
5
+ * @author Double Bastion LLC
6
+ *
7
+ * @license GNU AGPL version 3 or any later version
8
+ *
9
+ * This program is free software; you can redistribute it and/or
10
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
11
+ * License as published by the Free Software Foundation; either
12
+ * version 3 of the License, or any later version.
13
+ *
14
+ * This program is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
18
+ *
19
+ * You should have received a copy of the GNU Affero General Public
20
+ * License along with this program.  If not, see <http://www.gnu.org/licenses/>.
21
+-->
22
+
23
+<head>
24
+   <meta charset="utf-8">
25
+   <title>RED SCARF Suite Panel</title>
26
+   <link rel="stylesheet" href="assets/css/login-style.css"/>
27
+   <script type="text/javascript" src="assets/js/jquery-3.3.1.min.js"></script>
28
+   <script type="text/javascript" src="assets/js/panel-login.js"></script>
29
+   <link rel="shortcut icon" type="image/png" href="images/favicon.png" />
30
+</head>
31
+<body>
32
+
33
+  <div class="wrapper">
34
+  <div id="formContent">
35
+    <!-- Tabs Titles -->
36
+    <a href="panel-login.php"><h2 id="signintab" class="active underlineHover">Log In</h2></a>
37
+    <a id="signupsec" href="panel-signup.php"><h2 id="signuptab" class="underlineHover">Sign Up</h2></a>
38
+
39
+    <!-- Icon -->
40
+    <div id="logosection">
41
+      <img src="images/red-scarf-suite-panel_logo_login.svg" id="panel-logo" alt="RED SCARF Suite Panel logo" />
42
+    </div>
43
+
44
+    <div id="submitmessage"></div>
45
+
46
+    <!-- Login Form -->
47
+    <form id="loginform" method="POST">
48
+      <input type="text" id="login" name="login" placeholder="username">
49
+      <input type="password" id="password" name="password" placeholder="password">
50
+      <input type="submit" id="signinbutton" name="signinbutton" value="Log In">
51
+    </form>
52
+
53
+    <!-- Remind Passowrd -->
54
+    <div id="formFooter">
55
+      <a id="forgotpass" class="underlineHover" href="forgot-password.php">Forgot Password?</a>
56
+    </div>
57
+
58
+  </div>
59
+</div>
60
+
61
+<?php
62
+
63
+define('ACCESSCONST', TRUE);
64
+
65
+define('RESTRICTED', TRUE);
66
+
67
+require 'db-connect.php';
68
+
69
+
70
+// Extract the sign up parameter from 'install-signup-check.php' to activate or deactivate the 'Sign Up' tab
71
+if (is_file(dirname(__FILE__) . '/install-signup-check.php')) {
72
+
73
+    $setupfile = file(dirname(__FILE__) . '/install-signup-check.php');
74
+    $signup_check = 'false';
75
+
76
+    foreach ($setupfile as $keyfile => $valuefile) {
77
+         if ((strpos($valuefile, "\$signupcheck") !== false) && (strpos($valuefile, "//") === false)) {
78
+              $signup_init = explode("=", $valuefile);
79
+              $firsttwo_init = str_replace(" ","", $signup_init[0]);
80
+              $signup_sec = explode(";", $signup_init[1]);
81
+              $signup_check = str_replace(" ","", $signup_sec[0]);
82
+              break;
83
+         }
84
+    }
85
+
86
+    ?>
87
+    <script type="text/javascript">
88
+         var signupCheck = "<?php print_r($signup_check); ?>";
89
+    </script>
90
+    <?php
91
+
92
+
93
+ if(isset($_POST['signinbutton'])) {
94
+
95
+    $signinusername = $_POST['login'];
96
+    $signinpassword = $_POST['password'];
97
+
98
+    if ($_POST['login'] != '' && $_POST['password'] != '') {
99
+
100
+      // Get the password for the current user from the database
101
+      $sqlquery = $mysqli->prepare("SELECT userrole, username, password, registered FROM panelusers WHERE BINARY username=?");
102
+      $sqlquery->bind_param("s", $signinusername);
103
+      $sqlquery->execute();
104
+      $fetchdata = $sqlquery->get_result();
105
+      $fetchresult = $fetchdata->fetch_row();
106
+      $userrole = $fetchresult[0];
107
+      $signinpassfromdb = $fetchresult[2];
108
+      $registered = $fetchresult[3];
109
+      $sqlquery->close();
110
+
111
+      // Verify the given password
112
+      $signinpswdverify = password_verify($signinpassword, $signinpassfromdb);
113
+
114
+        if ($registered == '0') {
115
+           ?>
116
+           <script type="text/javascript">
117
+               $("#submitmessage").append("<span>Your account hasn't been activated yet. Please check your email account used at registration and click on the activation link to activate your account !</span>");
118
+               $("#submitmessage").css("color", "#AC1F23");
119
+           </script>
120
+           <?php
121
+        } elseif ($signinpswdverify && $registered == '1') {
122
+
123
+            session_start();
124
+            $_SESSION['userrole'] = $userrole;
125
+            $_SESSION['login'] = $signinusername;
126
+            $_SESSION['loggedtorspanel'] = true;
127
+            header("Location: index.php");
128
+
129
+        } else {
130
+           ?>
131
+           <script type="text/javascript">
132
+               $("#submitmessage").append("<span>Username and/or password incorrect !</span>");
133
+               $("#submitmessage").css("color", "#AC1F23");
134
+           </script>
135
+           <?php
136
+          }
137
+
138
+    } else {
139
+           ?>
140
+           <script type="text/javascript">
141
+               $("#submitmessage").append("<span>Please enter both your username and password !</span>");
142
+               $("#submitmessage").css("color", "#AC1F23");
143
+           </script>
144
+           <?php
145
+      }
146
+ }
147
+
148
+}
149
+
150
+?>
151
+
152
+</body>
153
+</html>
154
+