* Added /trunk/share

* Imported SQL files to /share/sql
* Added a PHP function file to generate new users in /share/php
zircon^2
Adam Frisby 2007-05-31 19:02:28 +00:00
parent d3c4ff66a7
commit 931adbcc43
7 changed files with 166 additions and 0 deletions

View File

@ -0,0 +1,46 @@
<?php
// GenerateUser (v1.0)
// Creates a new user account, and returns it into an associative array.
// --
// $firstname - The users firstname
// $lastname - The users lastname
// $password - the users password
// $home - the regionhandle of the users home location
// --
function generateUser($firstname,$lastname,$password,$home) {
$user = array();
$user['UUID'] = sprintf( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ),
mt_rand( 0, 0x0fff ) | 0x4000,
mt_rand( 0, 0x3fff ) | 0x8000,
mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ) );
$user['username'] = $firstname;
$user['lastname'] = $lastname;
$user['passwordSalt'] = md5(microtime() . mt_rand(0,0xffff));
$user['passwordHash'] = md5(md5($password) . ":" . $user['passwordSalt']);
$user['homeRegion'] = $home;
$user['homeLocationX'] = 128;
$user['homeLocationY'] = 128;
$user['homeLocationZ'] = 128;
$user['homeLookAtX'] = 15;
$user['homeLookAtY'] = 15;
$user['homeLookAtZ'] = 15;
$user['created'] = time();
$user['lastLogin'] = 0;
$user['userInventoryURI'] = "http://inventory.server.tld:8004/";
$user['userAssetURI'] = "http://asset.server.tld:8003/";
$user['profileCanDoMask'] = 0;
$user['profileWantDoMask'] = 0;
$user['profileAboutText'] = "I am a user.";
$user['profileFirstText'] = "Stuff.";
$user['profileImage'] = sprintf( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x', 0, 0, 0, 0, 0, 0, 0, 0 );
$user['profileFirstImage'] = sprintf( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x', 0, 0, 0, 0, 0, 0, 0, 0 );
return $user;
}
?>

View File

@ -0,0 +1,24 @@
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for agents
-- ----------------------------
CREATE TABLE `agents` (
`UUID` varchar(36) NOT NULL,
`sessionID` varchar(36) NOT NULL,
`secureSessionID` varchar(36) NOT NULL,
`agentIP` varchar(16) NOT NULL,
`agentPort` int(11) NOT NULL,
`agentOnline` tinyint(4) NOT NULL,
`loginTime` int(11) NOT NULL,
`logoutTime` int(11) NOT NULL,
`currentRegion` varchar(36) NOT NULL,
`currentHandle` bigint(20) unsigned NOT NULL,
`currentPos` varchar(64) NOT NULL,
PRIMARY KEY (`UUID`),
UNIQUE KEY `session` (`sessionID`),
UNIQUE KEY `ssession` (`secureSessionID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records
-- ----------------------------

View File

@ -0,0 +1,9 @@
CREATE TABLE `inventoryfolders` (
`folderID` varchar(36) NOT NULL default '',
`agentID` varchar(36) default NULL,
`parentFolderID` varchar(36) default NULL,
`folderName` varchar(64) default NULL,
PRIMARY KEY (`folderID`),
KEY `owner` (`agentID`),
KEY `parent` (`parentFolderID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -0,0 +1,14 @@
CREATE TABLE `inventoryitems` (
`inventoryID` varchar(36) NOT NULL default '',
`assetID` varchar(36) default NULL,
`type` int(11) default NULL,
`parentFolderID` varchar(36) default NULL,
`avatarID` varchar(36) default NULL,
`inventoryName` varchar(64) default NULL,
`inventoryDescription` varchar(64) default NULL,
`inventoryNextPermissions` int(10) unsigned default NULL,
`inventoryCurrentPermissions` int(10) unsigned default NULL,
PRIMARY KEY (`inventoryID`),
KEY `owner` (`avatarID`),
KEY `folder` (`parentFolderID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

10
share/sql/mysql-logs.sql Normal file
View File

@ -0,0 +1,10 @@
CREATE TABLE `logs` (
`logID` int(10) unsigned NOT NULL auto_increment,
`target` varchar(36) default NULL,
`server` varchar(64) default NULL,
`method` varchar(64) default NULL,
`arguments` varchar(255) default NULL,
`priority` int(11) default NULL,
`message` text,
PRIMARY KEY (`logID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8

View File

@ -0,0 +1,29 @@
CREATE TABLE `regions` (
`uuid` varchar(36) NOT NULL,
`regionHandle` bigint(20) unsigned NOT NULL,
`regionName` varchar(32) default NULL,
`regionRecvKey` varchar(128) default NULL,
`regionSendKey` varchar(128) default NULL,
`regionSecret` varchar(128) default NULL,
`regionDataURI` varchar(255) default NULL,
`serverIP` varchar(16) default NULL,
`serverPort` int(10) unsigned default NULL,
`serverURI` varchar(255) default NULL,
`locX` int(10) unsigned default NULL,
`locY` int(10) unsigned default NULL,
`locZ` int(10) unsigned default NULL,
`eastOverrideHandle` bigint(20) unsigned default NULL,
`westOverrideHandle` bigint(20) unsigned default NULL,
`southOverrideHandle` bigint(20) unsigned default NULL,
`northOverrideHandle` bigint(20) unsigned default NULL,
`regionAssetURI` varchar(255) default NULL,
`regionAssetRecvKey` varchar(128) default NULL,
`regionAssetSendKey` varchar(128) default NULL,
`regionUserURI` varchar(255) default NULL,
`regionUserRecvKey` varchar(128) default NULL,
`regionUserSendKey` varchar(128) default NULL, `regionMapTexture` varchar(36) default NULL,
PRIMARY KEY (`uuid`),
KEY `regionName` (`regionName`),
KEY `regionHandle` (`regionHandle`),
KEY `overrideHandles` (`eastOverrideHandle`,`westOverrideHandle`,`southOverrideHandle`,`northOverrideHandle`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED

34
share/sql/mysql-users.sql Normal file
View File

@ -0,0 +1,34 @@
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for users
-- ----------------------------
CREATE TABLE `users` (
`UUID` varchar(36) NOT NULL default '',
`username` varchar(32) NOT NULL,
`lastname` varchar(32) NOT NULL,
`passwordHash` varchar(32) NOT NULL,
`passwordSalt` varchar(32) NOT NULL,
`homeRegion` bigint(20) unsigned default NULL,
`homeLocationX` float default NULL,
`homeLocationY` float default NULL,
`homeLocationZ` float default NULL,
`homeLookAtX` float default NULL,
`homeLookAtY` float default NULL,
`homeLookAtZ` float default NULL,
`created` int(11) NOT NULL,
`lastLogin` int(11) NOT NULL,
`userInventoryURI` varchar(255) default NULL,
`userAssetURI` varchar(255) default NULL,
`profileCanDoMask` int(10) unsigned default NULL,
`profileWantDoMask` int(10) unsigned default NULL,
`profileAboutText` text,
`profileFirstText` text,
`profileImage` varchar(36) default NULL,
`profileFirstImage` varchar(36) default NULL,
PRIMARY KEY (`UUID`),
UNIQUE KEY `usernames` (`username`,`lastname`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records
-- ----------------------------