aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/share/php/generateUserFunction.php
diff options
context:
space:
mode:
authorAdam Frisby2007-05-31 19:02:28 +0000
committerAdam Frisby2007-05-31 19:02:28 +0000
commit931adbcc43cc894d707f5671afa30c2f3edce7c5 (patch)
tree584796581d0c42f3960d0e2300d01dd070df5ffd /share/php/generateUserFunction.php
parent* Completed reading of inventory in Manager. (still needs to be hooked up via... (diff)
downloadopensim-SC_OLD-931adbcc43cc894d707f5671afa30c2f3edce7c5.zip
opensim-SC_OLD-931adbcc43cc894d707f5671afa30c2f3edce7c5.tar.gz
opensim-SC_OLD-931adbcc43cc894d707f5671afa30c2f3edce7c5.tar.bz2
opensim-SC_OLD-931adbcc43cc894d707f5671afa30c2f3edce7c5.tar.xz
* Added /trunk/share
* Imported SQL files to /share/sql * Added a PHP function file to generate new users in /share/php
Diffstat (limited to '')
-rw-r--r--share/php/generateUserFunction.php46
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