Finish making account registration possible
This commit is contained in:
parent
f37af74687
commit
fb6928cb30
9 changed files with 375 additions and 40 deletions
36
php/Register.php
Normal file
36
php/Register.php
Normal file
|
@ -0,0 +1,36 @@
|
|||
<?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', '1');");
|
||||
|
||||
die(json_encode(array("done"=>true, "type"=> "S2CSimpleReply")));
|
||||
|
||||
}else {
|
||||
|
||||
die(json_encode(array("done"=>false, "type"=> "S2CSimpleReply")));
|
||||
}
|
||||
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue