SHARE
TWEET

[WBB4 Connect] funktion.php

Nico65 Aug 26th, 2014 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. use wcf\system\session\SessionHandler;
  3.  
  4. $db_wbb4_host           = '';//wbb4 mysql ip
  5. $db_wbb4_user           = '';//wbb4 mysql user
  6. $db_wbb4_pass           = '';//wbb4 mysql pass
  7. $db_wbb4_database       = '';//wbb4 mysql datenbank
  8. $wbb4_link = mysql_connect($db_wbb4_host,$db_wbb4_user,$db_wbb4_pass,true) or die('Unable to establish a DB connection');
  9. mysql_select_db($db_wbb4_database,$wbb4_link);
  10.  
  11. class SAMPWBB4
  12. {
  13.         public static function Create($name,$pw,$email)
  14.         {
  15.                 require_once('../wbb4/global.php');
  16.                 require_once('../wbb4/wcf/lib/data/user/UserAction.class.php');
  17.                 $data=array("username"=>$name, "password"=>$pw, "email"=>$email);
  18.                 $action = new wcf\data\user\UserAction(array(), 'create', array('data' => $data));
  19.                 $returnValues = $action->executeAction();
  20.                 $user = $returnValues['returnValues'];
  21.                 echo $user;
  22.         }
  23.         public static function BanUser($userID,$name,$reason,$banname)
  24.         {
  25.                 require_once('../wbb4/global.php');
  26.                 require_once('../wbb4/wcf/lib/data/user/UserAction.class.php');
  27.                 $userIDs = array($userID);
  28.                 $groupIDs = array(1,3,14,15);
  29.                 $action = new wcf\data\user\UserAction($userIDs, 'addToGroups', array('groups' => $groupIDs,'addDefaultGroups' => false, 'deleteOldGroups' => true));
  30.                 $action->executeAction();
  31.                 $sql = "UPDATE wcf1_user SET userOnlineGroupID = '15', rankID = '16', banned = '1', banReason= '".$name." - ".$reason." (Von ".$banname.")' WHERE userID= '".$userID."'";//Benutzer bannen
  32.                 $result = mysql_query($sql);
  33.                 SessionHandler::resetSessions($userIDs);
  34.         }
  35.         public static function UnBanUser($userID)
  36.         {
  37.                 $sql = "UPDATE wcf1_user SET banned = '0' WHERE userID= '".$userID."'";//Benutzer entbannen
  38.                 $result = mysql_query($sql);
  39.         }
  40.         public static function Update($userID,$TeamLevel,$userName)
  41.         {
  42.                 require_once('../wbb4/global.php');
  43.                 require_once('../wbb4/wcf/lib/data/user/UserAction.class.php');
  44.                 $userIDs = array($userID);
  45.                 //
  46.                 $groupIDs = array(1,3,14);
  47.                 $action = new wcf\data\user\UserAction($userIDs, 'addToGroups', array('groups' => $groupIDs,'addDefaultGroups' => false, 'deleteOldGroups' => true));
  48.                 $action->executeAction();
  49.                 $sql = "UPDATE wcf1_user SET userOnlineGroupID = '14',rankID = '14',username = '".$userName."' WHERE userID= '".$userID."'";
  50.                 $result = mysql_query($sql);
  51.                 if($TeamLevel == 1 || $TeamLevel == 2)
  52.                 {
  53.                         $groupIDs = array(8);
  54.                         $action = new wcf\data\user\UserAction($userIDs, 'addToGroups', array('groups' => $groupIDs,'addDefaultGroups' => false, 'deleteOldGroups' => false));
  55.                         $action->executeAction();
  56.                         $sql = "UPDATE wcf1_user SET userOnlineGroupID = '8',rankID = '11' WHERE userID= '".$userID."'";
  57.                         $result = mysql_query($sql);
  58.                 }
  59.                 elseif($TeamLevel == 3)
  60.                 {
  61.                         $groupIDs = array(9);
  62.                         $action = new wcf\data\user\UserAction($userIDs, 'addToGroups', array('groups' => $groupIDs,'addDefaultGroups' => false, 'deleteOldGroups' => false));
  63.                         $action->executeAction();
  64.                         $sql = "UPDATE wcf1_user SET userOnlineGroupID = '9',rankID = '12' WHERE userID= '".$userID."'";
  65.                         $result = mysql_query($sql);
  66.                 }
  67.                 elseif($TeamLevel == 4)
  68.                 {
  69.                         $groupIDs = array(10);
  70.                         $action = new wcf\data\user\UserAction($userIDs, 'addToGroups', array('groups' => $groupIDs,'addDefaultGroups' => false, 'deleteOldGroups' => false));
  71.                         $action->executeAction();
  72.                         $sql = "UPDATE wcf1_user SET userOnlineGroupID = '10',rankID = '13' WHERE userID= '".$userID."'";
  73.                         $result = mysql_query($sql);
  74.                 }
  75.                 elseif($TeamLevel == 5)
  76.                 {
  77.                         $groupIDs = array(7);
  78.                         $action = new wcf\data\user\UserAction($userIDs, 'addToGroups', array('groups' => $groupIDs,'addDefaultGroups' => false, 'deleteOldGroups' => false));
  79.                         $action->executeAction();
  80.                         $sql = "UPDATE wcf1_user SET userOnlineGroupID = '7',rankID = '10' WHERE userID= '".$userID."'";
  81.                         $result = mysql_query($sql);
  82.                 }
  83.                 SessionHandler::resetSessions($userIDs);
  84.                 self::Update($userID,$TeamLevel,$userName);
  85.         }
  86. }
  87. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top