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,116 @@
1
+<?php
2
+
3
+/**
4
+ * @copyright 2024 Double Bastion LLC <www.doublebastion.com>
5
+ *
6
+ * @author Double Bastion LLC
7
+ *
8
+ * @license GNU AGPL version 3 or any later version
9
+ *
10
+ * This program is free software; you can redistribute it and/or
11
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
12
+ * License as published by the Free Software Foundation; either
13
+ * version 3 of the License, or any later version.
14
+ *
15
+ * This program is distributed in the hope that it will be useful,
16
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
19
+ *
20
+ * You should have received a copy of the GNU Affero General Public
21
+ * License along with this program.  If not, see <http://www.gnu.org/licenses/>.
22
+ *
23
+ */
24
+
25
+define('RESTRICTED', TRUE);
26
+
27
+// Extract the sign up parameter from 'install-signup-check.php' to activate or deactivate the 'Sign Up' tab
28
+if (is_file(dirname(__FILE__) . '/install-signup-check.php')) {
29
+
30
+    $setupfile = file(dirname(__FILE__) . '/install-signup-check.php');
31
+
32
+    $signup_check = 'false';
33
+    foreach ($setupfile as $keyfile => $valuefile) {
34
+         if ((strpos($valuefile, "\$signupcheck") !== false) && (strpos($valuefile, "//") === false)) {
35
+              $signup_init = explode("=", $valuefile);
36
+              $firsttwo_init = str_replace(" ","", $signup_init[0]);
37
+              $signup_sec = explode(";", $signup_init[1]);
38
+              $signup_check = str_replace(" ","", $signup_sec[0]);
39
+              break;
40
+         }
41
+    }
42
+
43
+    if ($signup_check == 'true') {
44
+
45
+       // Generate a random string to prevent direct access to 'register-user.php'
46
+       function random_str($length, $keyspace = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ') {
47
+           $pieces = [];
48
+           $max = mb_strlen($keyspace, '8bit') - 1;
49
+
50
+           for ($i = 0; $i < $length; ++$i) {
51
+               $pieces []= $keyspace[random_int(0, $max)];
52
+           }
53
+           return implode('', $pieces);
54
+       }
55
+
56
+       $token = random_str(40);
57
+
58
+       session_start();
59
+
60
+       $_SESSION['validate_access'] = $token;
61
+
62
+       ?>
63
+       <script type="text/javascript">
64
+         var signupCheck = "<?php print_r($signup_check); ?>";
65
+         var validateToken = "<?php print_r($_SESSION['validate_access']); ?>";
66
+       </script>
67
+
68
+	<!doctype html>
69
+	<head>
70
+	   <meta charset="utf-8">
71
+	   <title>RED SCARF Suite Panel</title>
72
+	   <link rel="stylesheet" href="assets/css/login-style.css"/>
73
+	   <script type="text/javascript" src="assets/js/jquery-3.3.1.min.js"></script>
74
+	   <script type="text/javascript" src="assets/js/panel-signup.js"></script>
75
+	   <link rel="shortcut icon" type="image/png" href="images/favicon.png" />
76
+	</head>
77
+	<body>
78
+
79
+	  <div class="wrapper">
80
+	  <div id="formContent">
81
+	    <!-- Tabs Titles -->
82
+	    <a href="panel-login.php"><h2 id="signintab" class="underlineHover">Log In</h2></a>
83
+	    <a id="signupsec" href="panel-signup.php"><h2 id="signuptab" class="active underlineHover">Sign Up</h2></a>
84
+
85
+	    <!-- Icon -->
86
+	    <div id="logosection">
87
+	      <img src="images/red-scarf-suite-panel_logo_login.svg" id="panel-logo" alt="RED SCARF Suite Panel logo" />
88
+	    </div>
89
+
90
+	    <div id="submitmessage"></div>
91
+
92
+	    <!-- Signup fields -->
93
+	      <input type="text" id="emailaddress" name="emailaddress" placeholder="email address" />
94
+	      <input type="text" id="login" name="login" placeholder="username" />
95
+	      <input type="password" id="password" name="password" placeholder="password (Eg.: d?t5&c!9b~2yq4)" title="At least 10 characters, including at least one letter, one
96
+		     digit and one special character" />
97
+	      <select id="selectrole" name="selectrole"><option class="selectoption" value="" disabled="disabled" selected="selected">select your role</option><option class="selectoption" value="admin">Admin</option><option class="selectoption" value="superadmin">Superadmin</option></select>
98
+	      <input type="submit" id="signupbutton" name="signupbutton" value="Sign Up" />
99
+
100
+	      <!-- Remind Passowrd -->
101
+	      <div id="formFooter">
102
+		<a id="forgotpass" class="underlineHover" href="forgot-password.php">Forgot Password?</a>
103
+	      </div>
104
+	  </div>
105
+	</div>
106
+
107
+	</body>
108
+	</html>
109
+
110
+    <?php
111
+
112
+    } else { header("Location: panel-login.php"); }
113
+
114
+} else { header("Location: panel-login.php"); }
115
+
116
+?>
0 117
\ No newline at end of file