-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnewUserFromAdmin2.php
More file actions
44 lines (33 loc) · 965 Bytes
/
newUserFromAdmin2.php
File metadata and controls
44 lines (33 loc) · 965 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
require "../phplib/genlibraries.php";
require "../phplib/admin.inc.php";
if($_POST){
//TODO check compulsory field
if (!$_POST['Email'] || !$_POST['pass1']){
$_SESSION['errorData']['Error'][] = "Email and password are compulsory fields";
redirect($_SERVER['HTTP_REFERER']);
}
$u = checkUserLoginExists(sanitizeString($_POST["Email"]));
if(!isSet($u)) {
//TODO check Email is email
// set password
$newArray = $_POST;
if (!$newArray['pass1']){
$newArray['pass1'] = generatePassword();
//$newArray['pass1'] = "mug_".$newArray['Surname'];
}
// diskQuota from GB to MB
$newArray['diskQuota'] = $newArray['diskQuota']*1024*1024*1024;
//create user
$r = createUserFromAdmin($newArray);
//return
redirect($_SERVER['HTTP_REFERER']);
//echo "1";
}else{
$_SESSION['errorData']['Error'][] = "User ".$_POST["Email"]." already exists";
redirect($_SERVER['HTTP_REFERER']);
}
}else{
redirect($GLOBALS['URL']);
}
?>