Yeah, quite a number of issues and ways to tackle them.
I'll hit a few:
1 - Page refresh: A simple META refresh or one line of javascript should be fine. Here's a quick link on the META:
http://webdesign.about.com/cs/metatags/a/aa080300a.htm
2 - Only show the last 5 unique entries:
PHP Code:
<?php
$my_array = file("http://www.fpfr.com/calls/call.csv");
$my_array = array_unique($my_array);
$new_array = array_splice($my_array, count($my_array)-5, 5);
echo 'Old Array:<hr>';
echo '<pre>'; print_r($my_array); echo '</pre>';
echo '<hr>New Array:';
echo '<pre>'; print_r($new_array); echo '</pre>';
?>
Obviously you want to use some kind of looping logic [foreach/etc.] on the $new_array var, but you get the point.
3 - Expiring messages after 10 minutes. Several options come to mind:
- Insert the data into mysql and give it a timestamp. Then you just query for entries that are greater than 10 minutes
Although in this case, I probably wouldn't try to use mysql at first. I'm not sure how big that CSV file gets, but there were only around 30 rows (26 unique) at 12:42am. If you don't foresee the file getting that big, then forget about the 10 minute expiration for now. It should be easy enough to work in later. (you could always parse the date/time in the message since it seems to be in a consistent format then filter based on current time vs that time.)
Another option might be to show the latest entries first. (i assume this is for someone watching the page) If so then you can just run the array through
array_reverse() before displaying.
-r