Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $htshist=file('/root/.hts/tvheadend/subscription.log');
- $htshistrev=array_reverse($htshist);
- /*************************************************************
- * HTS history
- *************************************************************/
- if ( $_GET["filter"] == "" )
- $filter="all";
- else
- {
- $filter=$_GET["filter"];
- $htshistorycount=50;
- }
- print "<br><hr><form><font size=\"5\"><b><i>TVHeadEnd History ($filter) </i></font></b><input type=\"text\" name=\"filter\"></form>";
- 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>=$
- $count=0;
- foreach($htshistrev as $index=>$line)
- {
- $linexplode = explode('#', $line);
- $date=$linexplode[0];
- $status=$linexplode[1];
- $user=$linexplode[2];
- $client=$linexplode[3];
- $hostname=$linexplode[4];
- $session=$linexplode[5];
- $id=$linexplode[6];
- $channel=$linexplode[7];
- $profile=$linexplode[8];
- $duration=0;
- if (($filter != "all")
- && ($user != $filter)
- && (stripos($channel, $filter) === false)
- )
- continue;
- if (strpos($session, "Kodi") || strpos($session, "XBMC"))
- $session="Kodi";
- if ( $status == "ON" )
- $status="<font color=\"green\"><b>ON</b></font>";
- else
- {
- $status="<font color=\"red\">OFF</font>";
- for ($i=$index; $i<count($htshistrev); $i++)
- {
- $linexplode2 = explode('#', $htshistrev[$i]);
- $date2=$linexplode2[0];
- $status2=$linexplode2[1];
- $id2=$linexplode2[6];
- if ( ($id2 == $id) && ($status2 == "ON") )
- {
- $duration=strtotime($date)-strtotime($date2);
- break;
- }
- }
- $status="<font color=\"red\"><b>OFF</b></font><br><font size=\"1\">(" .date('H:i:s', mktime(0, 0, $duration)) .")</font>";
- }
- $user="<a href=\"index.php?filter=$user\">$user</a>";
- $channel="<a href=\"index.php?filter=$channel\">$channel</a>";
- print "<TR><TD ALIGN=\"center\">" .intval($id) ."</TD ALIGN><TD ALIGN=\"center\">$date</TD ALIGN><TD ALIGN=\"center\">$status</TD>
- <TD ALIGN=\"center\"><i>$user</i></TD ALIGN><TD ALIGN=\"center\"><i>$client</i></TD ALIGN>
- <TD ALIGN=\"center\">$hostname</TD ALIGN><TD ALIGN=\"center\">$session/$id</TD ALIGN>
- <TD ALIGN=\"center\">$channel</TD ALIGN><TD ALIGN=\"center\">$profile</TD ALIGN>";
- $count++;
- $count++;
- if ($count == $htshistorycount)
- break;
- }
- print "</TABLE>";
- if (!isset($_POST['morehtshistory']))
- {
- print "<TD ALIGN=\"center\">";
- print "<form action=\"" .$_SERVER['SCRIPT_NAME'] ."\" method=\"post\">";
- print "<input type=\"submit\" value=\"More\" style=\"height: 15px; width: 500px; font-size: 10px; text-align: center\">";
- print "<input type=\"hidden\" name=\"morehtshistory\">";
- print "</form>";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement