Title: Admin Ticket Activity
Version: 1.0
Author: Aaron Lee
Demo: NA
Download: NA
Website: NA
Short description: Displays the activity of the
ticket within a given time. Original Source:
http://fundisom.com/phparadise/php/info ... ine#code13
*************************************/
As usual, I modified someone else's code.
Place the following in you admin_ticket.php file.
Between;
Code: Select all
<!-- HR -->
<p> </p>
Code: Select all
<?php
require_once('inc/footer.inc.php');
Code: Select all
<div align="center">
<?php
function counter_write($filename, $filecontent, $mode='w')
{
if($fp = @fopen($filename,$mode))
{
fwrite($fp, stripslashes($filecontent));
fclose($fp);
return true;
}else{
return false;
}
}
function counter_count($filename, $ip, $timeframe=600)
{
$counterstr = time().'|'.$ip.'|'."\n";
$counter = array($ip=>1);
$hits = 1;
$counterdata = file($filename);
$number = count($counterdata);
for($i = 0; $i < $number; $i++)
{
$userdata = explode('|',$counterdata[$i]);
if($userdata[0] > time()-$timeframe)
{
$counter[$userdata[1]]++;
$hits++;
$counterstr .= $counterdata[$i];
}
}
counter_write($filename, $counterstr);
return $hits.' hit'.($hits > 1 ? 's' : '').' by '.count($counter).' user'.(count($counter) > 1 ? 's' : '').' in the last '.($timeframe/60).' minutes.';
}
echo "Ticket Activity: ";
echo counter_count('counter'.$trackingID.'.txt', $_SERVER['REMOTE_ADDR']);
?>
</div>
It may help you to know if another admin has viewed the ticket within the last ?? mins.