Initial Admin user should receive a ref-code aswell
This commit is contained in:
parent
b8d3378b02
commit
f03869efb0
|
@ -269,8 +269,8 @@ if (isset($_POST['createUser'])) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$random = generateRandomString();
|
||||||
$query1 = "INSERT INTO `" . getEnvironmentValue("DB_DATABASE") . "`.`users` (`name`, `role`, `credits`, `server_limit`, `pterodactyl_id`, `email`, `password`, `created_at`) VALUES ('$name', 'admin', '250', '1', '$pteroID', '$mail', '$pass', CURRENT_TIMESTAMP)";
|
$query1 = "INSERT INTO `" . getEnvironmentValue("DB_DATABASE") . "`.`users` (`name`, `role`, `credits`, `server_limit`, `pterodactyl_id`, `email`, `password`, `created_at`, `referral_code`) VALUES ('$name', 'admin', '250', '1', '$pteroID', '$mail', '$pass', CURRENT_TIMESTAMP, '$random')";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -139,3 +139,14 @@ function wh_log($log_msg)
|
||||||
// if you don't add `FILE_APPEND`, the file will be erased each time you add a log
|
// if you don't add `FILE_APPEND`, the file will be erased each time you add a log
|
||||||
file_put_contents($log_file_data, "[" . date('h:i:s') . "] " . $log_msg . "\n", FILE_APPEND);
|
file_put_contents($log_file_data, "[" . date('h:i:s') . "] " . $log_msg . "\n", FILE_APPEND);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function generateRandomString($length = 8) {
|
||||||
|
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||||
|
$charactersLength = strlen($characters);
|
||||||
|
$randomString = '';
|
||||||
|
for ($i = 0; $i < $length; $i++) {
|
||||||
|
$randomString .= $characters[rand(0, $charactersLength - 1)];
|
||||||
|
}
|
||||||
|
return $randomString;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue