Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- * This will be the class for all user interaction with the website like
- * login, register, user profiles, and so forth, there will be other classes
- * for other things like groups, regions, money, land, and soon the market one.
- *
- * in here there will be the following classes to be used.
- * register
- * profileshow
- * profileupdate
- * signin
- *
- */
- class user{
- protected $db;
- public function __construct($db) {
- $this->db = $db;
- }
- public function login($firstname,$lastname,$password)
- {
- $r = '';
- try
- {
- $sqluser = "SELECT * FROM `UserAccounts` WHERE `FirstName` = '$firstname' AND `LastName` = '$lastname'";
- $name = $this->db->query($sqluser);
- foreach($name as $row1)
- {
- $useruuid = $row1['PrincipalID'];
- $r = true;
- }
- } catch (vNoRowsException $e) {
- $r = false;
- }
- if($r == true)
- {
- $sqlauth = "SELECT * FROM `auth` WHERE `UUID` = '$useruuid'";
- $auth = $this->db->query($sqlauth);
- foreach($auth as $row2)
- {
- $dbpassword = $row2['passwordHash'];
- $dbsalt = $row2['passwordSalt'];
- }
- $password = md5(md5($password).":".$dbsalt); ;
- if($password == $dbpassword)
- {
- $success == true;
- }
- elseif($password != $dbpassword)
- {
- $succsess = false;
- }
- $status = "Success";
- }elseif($r == false);
- {
- $status = 'Failed';
- }
- $message = "this is bad";
- $array = array($status,$message,$useruuid,$password,$dbpassword,$dbsalt,$r);
- return $array;
- // check the db for user account.
- // check the password for the account.
- // check user account for being active and such
- // if all ok get details and send to login
- // if failed then send why
- }
- public function register($firstName,$lastName,$email,$password,$avatar)
- {
- $this->db->query('BEGIN');
- /*
- * This is the uuid's for the system clothes items and such
- */
- // may just do a while $i < n) .....
- $uuid1 = uuid::generate();
- /*
- * This is the standard info that will be put in generally user accounts
- */
- $serviceURLs = 'HomeURI=http%3a%2f%2flogin.openvirtuallife.com%3a8002%2f InventoryServerURI=http%3a%2f%2flogin.openvirtuallife.com%3a8002%2f AssetServerURI=http%3a%2f%2flogin.openvirtuallife.com%3a8002%2f ProfileServerURI=http%3a%2f%2flogin.openvirtuallife.com%3a8002%2f FriendsServerURI=http%3a%2f%2flogin.openvirtuallife.com%3a8002%2f IMServerURI=http%3a%2f%2flogin.openvirtuallife.com%3a8002%2f GroupsServerURI=http%3a%2f%2flogin.openvirtuallife.com%3a8002%2f GatekeeperURI=http%3a%2f%2flogin.openvirtuallife.com%3a8002';
- $scopeID = uuid::zero();
- $active = 0;
- $userFlags = "-1";
- $userLevel = 0;
- $created = time(); // unix time stamp
- $avatarFirstName = $firstName;
- $avatarLastName= $lastName;
- $avatarEmail = $email;
- $avatarUUID = $uuid1;
- // do here the db insertt file.
- $uasql = "INSERT INTO `UserAccounts` (`PrincipalID`, `ScopeID`, `FirstName`,"
- . " `LastName`, `Email`, `ServiceURLs`, `Created`, `UserLevel`, `UserFlags`, `UserTitle`, `active`) VALUES "
- . "('$avatarUUID','$scopeID','$avatarFirstName','$avatarLastName','$avatarEmail','$serviceURLs'"
- . ",'$created','$userLevel','$userFlags','','$active')";
- $this->db->execute($uasql);
- /*
- * auth details
- */
- $passwordSalt = md5(uuid::generate());
- $avatarPassword = md5(md5($password).';'.$passwordSalt); // need to do the config for thee password changing.
- $avatarID = $avatarUUID;
- // do the $db inserts now
- $authsql = "";
- $this->db-execute($authsql);
- /*
- * this is the inventory folders
- */
- // do the $db instert.
- /*
- * $avatar will be done later this will be a picked system for male/female and different types
- */
- $avatar = $avatar;
- $this->db->query('COMMIT');
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement