*
* @author Double Bastion LLC
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this program. If not, see .
*
*/
define('RESTRICTED', TRUE);
// Extract the sign up parameter from 'install-signup-check.php' to activate or deactivate the 'Sign Up' tab
if (is_file(dirname(__FILE__) . '/install-signup-check.php')) {
$setupfile = file(dirname(__FILE__) . '/install-signup-check.php');
$signup_check = 'false';
foreach ($setupfile as $keyfile => $valuefile) {
if ((strpos($valuefile, "\$signupcheck") !== false) && (strpos($valuefile, "//") === false)) {
$signup_init = explode("=", $valuefile);
$firsttwo_init = str_replace(" ","", $signup_init[0]);
$signup_sec = explode(";", $signup_init[1]);
$signup_check = str_replace(" ","", $signup_sec[0]);
break;
}
}
if ($signup_check == 'true') {
// Generate a random string to prevent direct access to 'register-user.php'
function random_str($length, $keyspace = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ') {
$pieces = [];
$max = mb_strlen($keyspace, '8bit') - 1;
for ($i = 0; $i < $length; ++$i) {
$pieces []= $keyspace[random_int(0, $max)];
}
return implode('', $pieces);
}
$token = random_str(40);
session_start();
$_SESSION['validate_access'] = $token;
?>