Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Community Board > Mysidia Adoptables Official Announcement

Notices

Closed Thread
 
Thread Tools Display Modes
  #1  
Old 11-23-2012, 04:36 PM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 161,586
Abronsyth is on a distinguished road
Default

Okay, here's the abstract_usercreator.php:
PHP Code:
<?php

abstract class UserCreator implements Creator{
  
// The abstract factory class UserCreator
  
  
abstract public function create();
  abstract public function 
massproduce();
  
  public static function 
logincheck(){
     global 
$mysidia;
    
     
//Check for cookie
     
if(!$mysidia->cookies->getcookies("mysuid") or !$mysidia->cookies->getcookies("myssession")) return FALSE;
     else{
        
$uid secure($mysidia->cookies->getcookies("mysuid"));
        
$session secure($mysidia->cookies->getcookies("myssession"));

        
//Run login operation
        
$luser $mysidia->db->select("users", array("uid""session"), "uid = '{$uid}'")->fetchObject();
        
$luid=$luser->uid;
        
$lsess=$luser->session;
        
        if(
$uid == $luid and $session == $lsess) return TRUE;
        else{
            if(isset(
$_COOKIE['mysuid'])) setcookie("mysuid"$uidtime() - 10);
            if(isset(
$_COOKIE['myssession'])) setcookie("myssession"$sessiontime() - 10);
            return 
FALSE;
        }
     }
     
// End of login check
  
}
  
  protected function 
getusergroup($userinfo){
     global 
$mysidia;
     
$whereclause = (is_numeric($userinfo))?"uid ='{$userinfo}'":"username ='{$userinfo}'";
     
$usergroup $mysidia->db->select("users", array("usergroup"), $whereclause)->fetchColumn();
     if(empty(
$usergroup)) throw new Exception('Invalid Usergroup, cannot instantiate user object');
     return 
$usergroup;
  }
  
  protected function 
getgroupcategory(){
     global 
$mysidia;
     
$category $mysidia->db->select("groups", array("category"), "uid ='{$uid}'")->fetchColumn();
     if(empty(
$category)) throw new Exception('Invalid Usergroup Category, cannot instantiate user object');
     return 
$category;     
  }
  
  protected function 
getidentity(){
     
$spiderip = array();
     if(
in_array($_SERVER['REMOTE_ADDR'], $spiderip)) $identity "Spider";
     else 
$identity "Guest";
     return 
$identity;
  }
  
}
?>
And here's the class_membercreator.php:
PHP Code:
<?php

class MemberCreator extends UserCreator{
  
// The abstract factory class UserCreator
  
protected $userinfo;
  protected 
$usergroup;
  protected 
$user;
   
  public function 
__construct($userinfo){
     if(empty(
$userinfo)) throw new Exception('User id or Username does not exist...');
     
$this->userinfo $userinfo;
     
$this->usergroup $this->getgroupid();
  }

  public function 
getgroupid(){
     global 
$mysidia;
     
$whereclause $whereclause = (is_numeric($this->userinfo))?"uid ='{$this->userinfo}'":"username ='{$this->userinfo}'";
     
$gid $mysidia->db->select("users", array("usergroup"), $whereclause)->fetchColumn();
     return 
$gid;
  }

  public function 
getgroupcategory(){
     
// This feature will be fully implemented in Mys v1.3.3 or v1.3.4.
     
if($this->usergroup == or $this->usergroup == 2) return "Admin";
     elseif(
$this->usergroup == or $this->usergroup == 6) return "Mod";
     elseif(
$this->usergroup == 3) return "Registered";
     elseif(
$this->usergroup == 5) return "Banned";
     else throw new 
Exception('Cannot recognize usergroup category for this user, he/she may be a guest, a bot, or else...');
  }

  public function 
create(){
     
$category $this->getgroupcategory();
     switch(
$category){
        case 
"Admin":
           
$this->user $this->create_admin();
           break;
        case 
"Mod":
           
$this->user $this->create_mod();
           break;
        case 
"Banned":
           
$this->user $this->create_banned();
           break;           
        default:
           
$this->user $this->create_member();                   
     }
     return 
$this->user;     
  }
  
  public function 
massproduce(){
     return 
FALSE;
  }
    
  private function 
create_admin(){
     return new 
Admin($this->userinfo);
  }
  
  private function 
create_mod(){
     return new 
Mod($this->userinfo);
  }
  
  private function 
create_member(){
     return new 
Member($this->userinfo);
  }
  
  private function 
create_banned(){
     return new 
Banned($this->userinfo);
  }
}
?>
(Sometimes I feel like it's just my job to find as many errors as possible...most of them being my fault for some reason XD)
__________________
My Mods Site (1.3.4, 2020 Mods)
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mysidia Adoptables v1.3.3[Security Release] Hall of Famer Mysidia Adoptables Official Announcement 122 05-18-2013 04:02 PM
Mysidia Adoptables v1.3.0[Security Release] Hall of Famer Mysidia Adoptables Official Announcement 180 04-01-2012 10:16 PM
Mysidia Adoptables v1.2.0[Security Release] Hall of Famer Mysidia Adoptables Official Announcement 21 03-22-2011 04:13 PM
Mysidia Adoptables v1.1.4[Security Release] Hall of Famer Mysidia Adoptables Official Announcement 15 01-28-2011 11:48 AM
Mysidia Adoptables v1.1.3[Security Release] Hall of Famer Mysidia Adoptables Official Announcement 27 01-26-2011 02:59 PM


All times are GMT -5. The time now is 04:22 PM.

Currently Active Users: 11148 (0 members and 11148 guests)
Threads: 4,081, Posts: 32,032, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636