Advertisement
Guest User

Untitled

a guest
Jun 14th, 2015
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.39 KB | None | 0 0
  1. $htshist=file('/root/.hts/tvheadend/subscription.log');
  2. $htshistrev=array_reverse($htshist);
  3.  
  4. /*************************************************************
  5. * HTS history
  6. *************************************************************/
  7.  
  8. if ( $_GET["filter"] == "" )
  9. $filter="all";
  10. else
  11. {
  12. $filter=$_GET["filter"];
  13. $htshistorycount=50;
  14. }
  15.  
  16. print "<br><hr><form><font size=\"5\"><b><i>TVHeadEnd History ($filter)&nbsp;&nbsp;&nbsp;</i></font></b><input type=\"text\" name=\"filter\"></form>";
  17.  
  18. print "<br><TABLE BORDER=\"1\"><TR><TH>=ID=</TH><TH>======Date======</TH><TH>====</TH><TH>===User===</TH><TH>=====Client=====</TH><TH>=RemoteIP=</TH><TH>==Session==</TH><TH>===Channel===</TH><TH>=$
  19.  
  20. $count=0;
  21. foreach($htshistrev as $index=>$line)
  22. {
  23. $linexplode = explode('#', $line);
  24.  
  25. $date=$linexplode[0];
  26. $status=$linexplode[1];
  27. $user=$linexplode[2];
  28. $client=$linexplode[3];
  29. $hostname=$linexplode[4];
  30. $session=$linexplode[5];
  31. $id=$linexplode[6];
  32. $channel=$linexplode[7];
  33. $profile=$linexplode[8];
  34.  
  35. $duration=0;
  36.  
  37. if (($filter != "all")
  38. && ($user != $filter)
  39. && (stripos($channel, $filter) === false)
  40. )
  41. continue;
  42.  
  43. if (strpos($session, "Kodi") || strpos($session, "XBMC"))
  44. $session="Kodi";
  45.  
  46. if ( $status == "ON" )
  47. $status="<font color=\"green\"><b>ON</b></font>";
  48. else
  49. {
  50. $status="<font color=\"red\">OFF</font>";
  51.  
  52. for ($i=$index; $i<count($htshistrev); $i++)
  53. {
  54. $linexplode2 = explode('#', $htshistrev[$i]);
  55.  
  56. $date2=$linexplode2[0];
  57. $status2=$linexplode2[1];
  58. $id2=$linexplode2[6];
  59.  
  60. if ( ($id2 == $id) && ($status2 == "ON") )
  61. {
  62. $duration=strtotime($date)-strtotime($date2);
  63. break;
  64. }
  65. }
  66.  
  67. $status="<font color=\"red\"><b>OFF</b></font><br><font size=\"1\">(" .date('H:i:s', mktime(0, 0, $duration)) .")</font>";
  68. }
  69.  
  70. $user="<a href=\"index.php?filter=$user\">$user</a>";
  71. $channel="<a href=\"index.php?filter=$channel\">$channel</a>";
  72.  
  73. print "<TR><TD ALIGN=\"center\">" .intval($id) ."</TD ALIGN><TD ALIGN=\"center\">$date</TD ALIGN><TD ALIGN=\"center\">$status</TD>
  74. <TD ALIGN=\"center\"><i>$user</i></TD ALIGN><TD ALIGN=\"center\"><i>$client</i></TD ALIGN>
  75. <TD ALIGN=\"center\">$hostname</TD ALIGN><TD ALIGN=\"center\">$session/$id</TD ALIGN>
  76. <TD ALIGN=\"center\">$channel</TD ALIGN><TD ALIGN=\"center\">$profile</TD ALIGN>";
  77.  
  78. $count++;
  79.  
  80. $count++;
  81. if ($count == $htshistorycount)
  82. break;
  83. }
  84. print "</TABLE>";
  85.  
  86. if (!isset($_POST['morehtshistory']))
  87. {
  88. print "<TD ALIGN=\"center\">";
  89. print "<form action=\"" .$_SERVER['SCRIPT_NAME'] ."\" method=\"post\">";
  90. print "<input type=\"submit\" value=\"More\" style=\"height: 15px; width: 500px; font-size: 10px; text-align: center\">";
  91. print "<input type=\"hidden\" name=\"morehtshistory\">";
  92. print "</form>";
  93. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement