Advertisement
Guest User

Untitled

a guest
Jun 18th, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.65 KB | None | 0 0
  1.                 $channels = array("26" => "Northern Coalition",
  2.                 "22" => "Best Friends Forever",
  3.                 "20" => "Burning Napalm",
  4.                 "17" => "D00M",
  5.                 "16" => "Digital Fury Corporation",
  6.                 "24" => "Fleet Commanders",
  7.                 "21" => "Infamous Mob",
  8.                 "25" => "Leadership",
  9.                 "18" => "Rionnag Alba",
  10.                 "19" => "Spartan Industries",
  11.                 "23" => "The Wretched",
  12.                 "27" => "Super Capitals",
  13.                 "28" => "Capitals");
  14.  
  15.                 //Select groups that the user is in
  16.                 $grp = "SELECT id_group, additional_groups FROM smf_members WHERE (member_name = '$username' OR real_name = '$username')";
  17.                 $grp2 = mysql_query($grp);
  18.                 $grp3 = mysql_fetch_assoc($grp2);
  19.  
  20.                 $idgrp = $grp3['id_group'];
  21.                 $adgrp = $grp3['additional_groups'];
  22.  
  23.                 $groups = array($idgrp);
  24.                 $adgrp = explode(",", $adgrp);
  25.  
  26.                 foreach ($adgrp as $group){
  27.                          if ($group == "null")
  28.                                 continue;
  29.                         $groups[] = $group;
  30.                 }
  31.  
  32.                 $groups = array_unique($groups);
  33.  
  34.                 foreach ($groups as $id){
  35.                         // Need to get the corresponding channel name in $channels, for the $id in this foreach.
  36.                         // So $channel below can become the correct name
  37.                         $check = "SELECT * FROM ejabberdusers WHERE username = '$username' AND password = '$password'";
  38.                         $check2 = mysql_query($check);
  39.                         $check3 = mysql_fetch_assoc($check2);
  40.                         $chan = $check3['group'];
  41.  
  42.                         if ($chan != $channel){
  43.                                 $add = "/sbin/ejabberdctl srg-user-add ".$username2." ".$domain." \\\"".$channel."\\\" ".$domain."";
  44.                                 if(exec($add)) { $this->logg("FAILED at adding ".$username2." to ".$channel.""); } else { $this->logg("SUCCESS at adding ".$username2." to ".$channel.""); }
  45.                         } else {
  46.                                 $this->logg("".$username2." is already added to the ".$channel." channel");
  47.                         }
  48.  
  49.                         //Mark user as registered, and insert info about him/her to the database
  50.                         $add = "INSERT INTO ejabberdusers (`username`,`password`,`added`,`group`) VALUES ('".$username2."', '".$password."', '0', '".$channel."')";
  51.                         mysql_query($add);
  52.                 }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement