Advertisement
Guest User

Untitled

a guest
Jul 12th, 2016
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.35 KB | None | 0 0
  1. <?PHP
  2.  
  3. /*-------USTAWIENIA------*/
  4. $ts3_ip = 'localhost';
  5. $ts3_queryport = 10011;
  6. $ts3_user = 'serveradmin';
  7. $ts3_pass = 'RdBeoeZO';
  8. $ts3_port = 9987;
  9. $ts3_defaultchannel = 2;
  10. $ts3_channel_password = Null;
  11. $name = "BOT TS3";
  12. $czas = 2;  /*  co ile sekund ma aktualizować kanały
  13.                 możesz wpisać 60*ilość minut, bądź 3600*ilość godzin
  14.             */ 
  15.  
  16. //$youtube[] = array("nazwa kanału","ID KANAŁU YOUTUBE", ID KANAŁU TEAMSPEAK);
  17. $youtube[] = array("EwaFarnaVEVO","UCSebDIT3FRWq5lUV61UT6JQ",1);
  18. /*----------------------*/
  19.  
  20. #Include ts3admin.class.php
  21. require("src/ts3admin.class.php");
  22.  
  23. #build a new ts3admin object
  24. $tsAdmin = new ts3admin($ts3_ip, $ts3_queryport);
  25. echo "<pre>";
  26. if($tsAdmin->getElement('success', $tsAdmin->connect())) {
  27.     #login as serveradmin
  28.     $tsAdmin->login($ts3_user, $ts3_pass);
  29.    
  30.     #select teamspeakserver
  31.     $tsAdmin->selectServer($ts3_port);
  32.     //while (1){
  33.         $tsAdmin->setName($name);
  34.         $tsAdmin->clientMovedbid(1, $ts3_defaultchannel, $ts3_channel_password);
  35.        
  36.         sleep($czas);
  37.         foreach($youtube as $yter){
  38.             $page = "http://151.80.111.114/subscribeyoutube.php?id=".$yter[1];
  39.             $page = file_get_contents($page);
  40.             $page = json_decode($page, true);
  41.             //$data = "channel_description=viewCount".$page['viewCount'];
  42.             $data_channelname = $yter[0]." (".$page['subscriberCount'].")";
  43.             $data_channeldesc = "[url=https://www.youtube.com/channel/".$yter[1]."]".$yter[0]."[/url] \nSubskrybcji: ".$page['subscriberCount']."\nWyświetleń: ".$page['viewCount']."\nIlość filmów na kanale: ".$page['videoCount'];
  44.            
  45.             $aktualne = $tsAdmin->channelInfo($yter[2]);
  46.             $aktualnanazwa = $aktualne['data']['channel_name'];
  47.             $aktualnydesc = $aktualne['data']['channel_description'];
  48.             echo "akt: ".$aktualnydesc."\n";
  49.             echo "now: ".$data_channeldesc."\n";
  50.             if($data_channeldesc != $aktualnydesc)
  51.             {
  52.                 $data['channel_description'] = $data_channeldesc;
  53.                 if($data_channelname != $aktualnanazwa)$data['channel_name'] = $data_channelname;
  54.                 else unset($data['channel_name']);
  55.                 $tsAdmin->channelEdit(1, $data);
  56.             }
  57.         }
  58.     //}
  59.    
  60. }else{
  61.     echo 'Connection could not be established.';
  62. }
  63. echo "</pre>";
  64. /**
  65.  * This code retuns all errors from the debugLog
  66.  */
  67. if(count($tsAdmin->getDebugLog()) > 0) {
  68.     foreach($tsAdmin->getDebugLog() as $logEntry) {
  69.         echo '<script>alert("'.$logEntry.'");</script>';
  70.     }
  71. }
  72. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement