Guest User

Untitled

a guest
Oct 25th, 2013
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.69 KB | None | 0 0
  1. <?php
  2.                                        
  3.          $link = mysql_connect("localhost", "root", "")
  4.     or die("Could not connect");
  5.  
  6. $db = mysql_select_db("streams",$link)
  7.     or die("Could not select database");                               
  8. error_reporting(0);
  9.                          
  10. function api($channel)
  11. {
  12.     $json_file = @file_get_contents("http://api.justin.tv/api/stream/list.json?channel={$channel}", 0, null, null);
  13.     $json_array = json_decode($json_file, true);
  14.  
  15.  
  16.     if ($json_array[0]['name'] == "live_user_{$channel}")
  17.     {
  18.            
  19.             $channelTitle = $json_array[0]['channel']['title'];
  20.             $title = $json_array[0]['channel']['status'];
  21.             $game = $json_array[0]['meta_game'];
  22.             $img    = $json_array[0]['channel']['screen_cap_url_medium'];
  23.             $name = $json_array[0]['name'];
  24.             $name2 = "live_user_{$channel}";
  25.             $view ="stream_count_{$channel}";
  26.             $viewers = ($json_array[0]['channel_count']);
  27.             if($game == 'League of Legends')
  28.                     echo '
  29.  
  30. <style>
  31. summary::-webkit-details-marker {
  32.  display: none ;
  33. }
  34. </style>
  35.  <tr>
  36.  
  37.            <td><img  alt="stream pl league of legends" src="'.$img.'"></td>
  38.            <td>'.$channelTitle.'</td>
  39.            <td>'.$game.'</td>
  40.            <td>'.$viewers.'</td>
  41.           <td>
  42.            <details>
  43. <summary><a  class="btn btn-danger ">Oglądaj »</a></summary>
  44. <object width="100%" height="300px" bgcolor="#000000" data="http://www.twitch.tv/widgets/live_embed_player.swf?channel='.$channelTitle.'" id="live_embed_player_flash" type="application/x-shockwave-flash"><param value="true" name="allowFullScreen"><param value="always" name="allowScriptAccess"><param value="all" name="allowNetworking"><param value="http://www.twitch.tv/widgets/live_embed_player.swf" name="movie"><param value="hostname=www.twitch.tv&amp;channel='.$channelTitle.'&amp;auto_play=true&amp;start_volume=25" name="flashvars"></object>
  45. </details>
  46.            </td>
  47.          </tr>
  48.  
  49.  
  50.  
  51.  
  52.  
  53.    
  54.  
  55.                        
  56.                                 '  
  57.                                     ;          
  58.            
  59.             return array($channelTitle, $title, $game, $img, $name, $name2);
  60.     }
  61.         else echo '';
  62. }
  63.    
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72. $zpt = 'SELECT nazwa FROM stream';
  73. $wynik = mysql_query($zpt);
  74.  
  75.  
  76. While  ($wys = mysql_fetch_assoc($wynik))
  77.  {
  78.  
  79. $zm = $wys['nazwa'];
  80.  
  81. $tabl = array($zm);
  82.  
  83. $gracze = $zm;
  84. $kanaly = array('"'.$gracze.'"');
  85.  
  86.  
  87.  //tak ma wygladac ->  "robertxlee","therainman","phantoml0rd","athenelive","tsm_theoddone","Bischulol","dandinh","guardsmanbob","tsm_dyrus","nyjacky","vman7","salce","voyboy","cadburry"
  88.  $ile = count($kanaly);
  89. }
  90.  
  91.                         foreach ($kanaly as $co)
  92.                         {
  93.                             $info = api($co);
  94.                         }
  95.  
  96.                        
  97.                         ?>
Advertisement
Add Comment
Please, Sign In to add comment