ok.. here is the code. Works with V3.X of jw player (as V4 changed things and its has to be done with javascript) which will be later. It will actually count the number of views of the videos (when someone actually presses play)
You can use this by using the callback option of jw player V3.X and add it in the code for when people embed it into their webpage.
Add at the end of the embedded code &callback="
www.example.com/recordactivity.php"
recordactivity.php
<?php
include_once ("classes/config.php");
include_once ("classes/settings.php");
extract($_POST, EXTR_PREFIX_SAME, "post_");
if ($state == "start")
{
preg_match("/(.*)\/uploads\/(.*).flv(.*)/", $file, $matches);
$video_id = mysql_real_escape_string($matches[2]);
$query = "SELECT * FROM videos WHERE video_id = '$video_id' AND approved = 'yes'";
$result = mysql_query($query) or die();
while ($row = mysql_fetch_assoc($result)){
$indexer = $row['indexer'];
$number_of_views = $row['number_of_views'];
}
$number_of_views = $number_of_views + 1;
$query = "UPDATE videos set number_of_views = $number_of_views WHERE indexer = $indexer";
$result = mysql_query($query);
}
?>