diff options
author | Adam Frisby | 2007-07-11 08:10:25 +0000 |
---|---|---|
committer | Adam Frisby | 2007-07-11 08:10:25 +0000 |
commit | e2ff441e31328e60c8bb1d4bb32fa4ac64f91978 (patch) | |
tree | 8405b6cef57b66a58f31a24c859846085d0b81f7 /share/php/generateUserFunction.php | |
parent | * Wiping trunk in prep for Sugilite (diff) | |
parent | * Applying dalien's patches from bug#177 and #179 (diff) | |
download | opensim-SC-e2ff441e31328e60c8bb1d4bb32fa4ac64f91978.zip opensim-SC-e2ff441e31328e60c8bb1d4bb32fa4ac64f91978.tar.gz opensim-SC-e2ff441e31328e60c8bb1d4bb32fa4ac64f91978.tar.bz2 opensim-SC-e2ff441e31328e60c8bb1d4bb32fa4ac64f91978.tar.xz |
* Bringing Sugilite in to trunk
Diffstat (limited to '')
-rw-r--r-- | share/php/generateUserFunction.php | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/share/php/generateUserFunction.php b/share/php/generateUserFunction.php new file mode 100644 index 0000000..52ebc9f --- /dev/null +++ b/share/php/generateUserFunction.php | |||
@@ -0,0 +1,46 @@ | |||
1 | <?php | ||
2 | // GenerateUser (v1.0) | ||
3 | // Creates a new user account, and returns it into an associative array. | ||
4 | // -- | ||
5 | // $firstname - The users firstname | ||
6 | // $lastname - The users lastname | ||
7 | // $password - the users password | ||
8 | // $home - the regionhandle of the users home location | ||
9 | // -- | ||
10 | function generateUser($firstname,$lastname,$password,$home) { | ||
11 | $user = array(); | ||
12 | $user['UUID'] = sprintf( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x', | ||
13 | mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), | ||
14 | mt_rand( 0, 0x0fff ) | 0x4000, | ||
15 | mt_rand( 0, 0x3fff ) | 0x8000, | ||
16 | mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ) ); | ||
17 | $user['username'] = $firstname; | ||
18 | $user['lastname'] = $lastname; | ||
19 | |||
20 | $user['passwordSalt'] = md5(microtime() . mt_rand(0,0xffff)); | ||
21 | $user['passwordHash'] = md5(md5($password) . ":" . $user['passwordSalt']); | ||
22 | |||
23 | $user['homeRegion'] = $home; | ||
24 | $user['homeLocationX'] = 128; | ||
25 | $user['homeLocationY'] = 128; | ||
26 | $user['homeLocationZ'] = 128; | ||
27 | $user['homeLookAtX'] = 15; | ||
28 | $user['homeLookAtY'] = 15; | ||
29 | $user['homeLookAtZ'] = 15; | ||
30 | |||
31 | $user['created'] = time(); | ||
32 | $user['lastLogin'] = 0; | ||
33 | |||
34 | $user['userInventoryURI'] = "http://inventory.server.tld:8004/"; | ||
35 | $user['userAssetURI'] = "http://asset.server.tld:8003/"; | ||
36 | |||
37 | $user['profileCanDoMask'] = 0; | ||
38 | $user['profileWantDoMask'] = 0; | ||
39 | $user['profileAboutText'] = "I am a user."; | ||
40 | $user['profileFirstText'] = "Stuff."; | ||
41 | $user['profileImage'] = sprintf( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x', 0, 0, 0, 0, 0, 0, 0, 0 ); | ||
42 | $user['profileFirstImage'] = sprintf( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x', 0, 0, 0, 0, 0, 0, 0, 0 ); | ||
43 | |||
44 | return $user; | ||
45 | } | ||
46 | ?> \ No newline at end of file | ||