36 lines
No EOL
1 KiB
PHP
36 lines
No EOL
1 KiB
PHP
<?php
|
|
|
|
if(!defined("COMMON"))
|
|
require("Common.php");
|
|
|
|
$js = getJsonizedInput();
|
|
|
|
$first = $js['first'];
|
|
$last = $js['last'];
|
|
$password = $js['password'];
|
|
$ID = gen_uuid();
|
|
|
|
$level = $js['level'];
|
|
$title = $js['title'];
|
|
$email = $js['email'];
|
|
|
|
// Make salt
|
|
$salt = md5(time().":".md5(time().":".gen_uuid()));
|
|
$pwhash = md5($password.":".$salt);
|
|
|
|
$clientKey = $js['clientKey'];
|
|
if($clientKey == CLIENTPSK) {
|
|
// Perform registration
|
|
$DB = get_DB();
|
|
$DB->query("INSERT INTO `auth` (UUID, passwordHash, passwordSalt, webLoginKey, accountType) VALUES ('$ID', '$pwhash', '$salt', '".NULLKEY."', 'UserAccount');");
|
|
|
|
$DB->query("INSERT INTO `UserAccounts` (PrincipalID, ScopeID, FirstName, LastName, Email, ServiceURLs, Created, UserLevel, UserFlags, UserTitle, active) VALUES ('$ID', '".NULLKEY."', '$first', '$last', '$email', '', '".time()."', '$level', '0', '$title', '0');");
|
|
|
|
die(json_encode(array("done"=>true, "type"=> "S2CSimpleReply")));
|
|
|
|
}else {
|
|
|
|
die(json_encode(array("done"=>false, "type"=> "S2CSimpleReply")));
|
|
}
|
|
|
|
?>
|