Browse code

Changed majority of files.

DoubleBastionAdmin authored on 30/11/2024 06:56:40
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,179 @@
1
+<!DOCTYPE html>
2
+<!--
3
+  Copyright (C) 2022, 2024  Double Bastion LLC
4
+
5
+  This file is part of Roundpin, which is licensed under the
6
+  GNU Affero General Public License Version 3.0. The license terms
7
+  are detailed in the "LICENSE.txt" file located in the root directory.
8
+
9
+  This is a modified version of the original file "index.html",
10
+  first modified in 2020. The copyright notice for the original
11
+  content follows:
12
+
13
+  Copyright (c) 2019 by Daniel Zawadzki (https://codepen.io/danzawadzki/pen/EgqKRr)
14
+  License: The MIT License
15
+-->
16
+
17
+<head>
18
+   <meta charset="utf-8">
19
+   <title>Roundpin</title>
20
+   <link rel="stylesheet" href="css/login.css"/>
21
+   <link rel="stylesheet" href="css/inter.min.css"/>
22
+   <script type="text/javascript" src="js/jquery-3.3.1.min.js"></script>
23
+   <script type="text/javascript" src="js/roundpin-login.js"></script>
24
+   <link rel="shortcut icon" type="image/svg" href="images/favicon.svg" />
25
+</head>
26
+<body>
27
+
28
+<div class="wrapper">
29
+  <div id="formContent">
30
+
31
+    <!-- Tabs Titles -->
32
+    <a href="login.php"><h2 id="signintab" class="active underlineHover">Log In</h2></a>
33
+    <a id="signupsec" href="src/roundpin-signup.php"><h2 id="signuptab" class="underlineHover">Sign Up</h2></a>
34
+
35
+    <!-- Icon -->
36
+    <div id="logosection">
37
+      <img src="images/login-logo.svg" id="login-logo" alt="Roundpin logo" />
38
+    </div>
39
+
40
+    <div id="submitmessage"></div>
41
+
42
+    <!-- Login Form -->
43
+    <form id="loginform" method="POST">
44
+      <div id="usernameLabel" class="fadeInSpec">Username</div>
45
+      <input type="text" id="loginname" name="loginname" placeholder="Username" />
46
+      <div id="passwordLabel" class="fadeInSpec">Password</div>
47
+      <input type="password" id="password" name="password" placeholder="Password"/>
48
+      <input type="submit" id="signinbutton" name="signinbutton" value="Log In"/>
49
+    </form>
50
+
51
+    <!-- Remind Passowrd -->
52
+    <div id="formFooter">
53
+      <a id="forgotpass" class="underlineHover" href="src/forgot-password.php">Forgot Password?</a>
54
+    </div>
55
+
56
+  </div>
57
+</div>
58
+
59
+<?php
60
+
61
+define('ACCESSCONST', TRUE);
62
+define('RESTRICTED', TRUE);
63
+
64
+require 'src/db-connect.php';
65
+
66
+// Extract the sign up parameter from 'src/install-signup-check.php' to activate or deactivate the 'Sign Up' tab
67
+if (is_file(dirname(__FILE__) . '/src/install-signup-check.php')) {
68
+
69
+    $setupfile = file(dirname(__FILE__) . '/src/install-signup-check.php');
70
+    $signup_check = 'false';
71
+
72
+    foreach ($setupfile as $keyfile => $valuefile) {
73
+         if ((strpos($valuefile, "\$signupcheck") !== false) && (strpos($valuefile, "//") === false)) {
74
+              $signup_init = explode("=", $valuefile);
75
+              $firsttwo_init = str_replace(" ","", $signup_init[0]);
76
+              $signup_sec = explode(";", $signup_init[1]);
77
+              $signup_check = str_replace(" ","", $signup_sec[0]);
78
+              break;
79
+         }
80
+    }
81
+
82
+    ?>
83
+    <script type="text/javascript">
84
+          var signupCheck = "<?php print_r($signup_check); ?>";
85
+    </script>
86
+    <?php
87
+
88
+
89
+ if (isset($_POST['signinbutton'])) {
90
+
91
+    $signinusername = $_POST['loginname'];
92
+    $signinpassword = $_POST['password'];
93
+
94
+    if ($_POST['loginname'] != '' && $_POST['password'] != '') {
95
+
96
+      // Get password for current user from database
97
+      $enabled = 1;
98
+      $sqlquery = $mysqli->prepare("SELECT username, password, registered, enabled FROM app_users WHERE BINARY username=? and enabled=?");
99
+      $sqlquery->bind_param("si", $signinusername, $enabled);
100
+      $sqlquery->execute();
101
+      $fetchdata = $sqlquery->get_result();
102
+      $fetchresult = $fetchdata->fetch_row();
103
+
104
+      if ($fetchresult != '') {
105
+
106
+	      $signinpassfromdb = $fetchresult[1];
107
+	      $registered = $fetchresult[2];
108
+	      $sqlquery->close();
109
+
110
+	      // Verify given password
111
+	      $signinpswdverify = password_verify($signinpassword, $signinpassfromdb);
112
+
113
+		if ($registered == '0') {
114
+		   ?>
115
+		   <script type="text/javascript">
116
+		       $("#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>");
117
+		       $("#submitmessage").css("color", "#AC1F23");
118
+		   </script>
119
+		   <?php
120
+		} elseif ($signinpswdverify && $registered == '1') {
121
+
122
+		    session_start();
123
+                    header('Set-Cookie: PHPSESSID= ' . session_id() . '; SameSite=strict; Secure=true; HttpOnly=true;');
124
+
125
+		    $_SESSION['loginname'] = $signinusername;
126
+		    $_SESSION['loggedtoroundpin'] = true;
127
+
128
+		    // Generate a random string to prevent direct access to different PHP files
129
+		    function random_str($length, $keyspace = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ') {
130
+		       $pieces = [];
131
+		       $max = mb_strlen($keyspace, '8bit') - 1;
132
+
133
+		       for ($i = 0; $i < $length; ++$i) {
134
+			    $pieces []= $keyspace[random_int(0, $max)];
135
+		       }
136
+		       return implode('', $pieces);
137
+		    }
138
+
139
+		    $_SESSION['validate_s_access'] = random_str(40);
140
+
141
+		    ?>
142
+                       <script type="text/javascript">
143
+                               window.open('https://' + window.location.host + '/index.php', '_self');
144
+                       </script>
145
+                    <?php
146
+
147
+		} else {
148
+		   ?>
149
+		   <script type="text/javascript">
150
+		       $("#submitmessage").append("<span>Incorrect username and/or password !</span>");
151
+		       $("#submitmessage").css("color", "#AC1F23");
152
+		   </script>
153
+		   <?php
154
+		  }
155
+      } else {
156
+		   ?>
157
+		   <script type="text/javascript">
158
+		       $("#submitmessage").append("<span>Incorrect username and/or password !</span>");
159
+		       $("#submitmessage").css("color", "#AC1F23");
160
+		   </script>
161
+		   <?php
162
+        }
163
+
164
+    } else {
165
+           ?>
166
+           <script type="text/javascript">
167
+               $("#submitmessage").append("<span>Please enter both your username and password!</span>");
168
+               $("#submitmessage").css("color", "#AC1F23");
169
+           </script>
170
+           <?php
171
+    }
172
+ }
173
+}
174
+
175
+?>
176
+
177
+</body>
178
+</html>
179
+