forked from FNNDSC/chrisreloaded
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadduser.php
96 lines (74 loc) · 2.42 KB
/
adduser.php
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<?php
/**
*
* sSSs .S S. .S_sSSs .S sSSs
* d%%SP .SS SS. .SS~YS%%b .SS d%%SP
* d%S' S%S S%S S%S `S%b S%S d%S'
* S%S S%S S%S S%S S%S S%S S%|
* S&S S%S SSSS%S S%S d* S S&S S&S
* S&S S&S SSS&S S&S .S* S S&S Y&Ss
* S&S S&S S&S S&S_sdSSS S&S `S&&S
* S&S S&S S&S S&S~YSY%b S&S `S*S
* S*b S*S S*S S*S `S%b S*S l*S
* S*S. S*S S*S S*S S%S S*S .S*P
* SSSbs S*S S*S S*S S&S S*S sSS*S
* YSSP SSS S*S S*S SSS S*S YSS'
* SP SP SP
* Y Y Y
*
* R E L O A D E D
*
* (c) 2012 Fetal-Neonatal Neuroimaging & Developmental Science Center
* Boston Children's Hospital
*
* http://childrenshospital.org/FNNDSC/
*
*/
// we define a valid entry point
define('__CHRIS_ENTRY_POINT__', 666);
//define('CHRIS_CONFIG_DEBUG', true);
// include the configuration
require_once ('config.inc.php');
// include the template class
require_once (joinPaths(CHRIS_CONTROLLER_FOLDER, 'security.controller.php'));
require_once (joinPaths(CHRIS_CONTROLLER_FOLDER, 'data.controller.php'));
require_once (joinPaths(CHRIS_CONTROLLER_FOLDER, 'feed.controller.php'));
require_once (joinPaths(CHRIS_CONTROLLER_FOLDER, 'user.controller.php'));
// validate the credentials
if (!SecurityC::login()) {
// invalid credentials
// destroy the session
session_destroy();
die("Access denied.");
}
// now we have the user_id, make sure it is 0
if ($_SESSION['userid'] != 0) {
die("Access denied.");
}
// now the logic
if (isset($_POST['doit'])) {
if ($_POST["password"] != $_POST["password2"]) {
die("Passwords don't match!");
}
UserC::create($_POST['username'], crypt($_POST['password']), $_POST['email']);
die("User added.");
}
?>
<html>
<head><title>Add a ChRIS user</title></head>
<body>
<form action="" method="POST">
<input type="hidden" name="doit" value="yes">
Username: <input type="text" name="username">
<br>
Password: <input type="password" name="password">
<br>
Password (again): <input type="password" name="password2">
<br>
E-Mail: <input type="text" name="email">
<br>
<input type="submit" value="Add user">
</form>
</body>
</html>