Ok, here is the solution using XML HTTP Request.
Edit include/slideshow.inc.php
Add
var x1;
x1 = createRequestObject();
function createRequestObject() {
var x = false;
try {
x = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
x = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
x = false;
}
}
if (!x && typeof XMLHttpRequest != "undefined") {
x = new XMLHttpRequest();
}
return x;
}
function addHit(pid) {
x1.open('get','addHit.php?pid='+pid);
x1.onreadystatechange = function() {
if (x1.readyState == 4) {
return (x1.responseText);
}
}
x1.send(null);
}
just after
<script language="JavaScript" type="text/JavaScript">
then Add
var Pid = new Array()
just After
var Pic = new Array() // don't touch this
Add
echo "Pid[$i] = '" . $picture['pid'] . "'\n";
just after
echo "Pic[$i] = '" . $picture_url . "'\n";
then Replace
if (xIE4Up){
document.images.SlideShow.filters.blendTrans.Play()
}
with
if (xIE4Up){
document.images.SlideShow.filters.blendTrans.Play()
}
addHit(Pid[j])
Then create a new file addHit.php having the following code. Place this file in your coppermine folder.
<?php
define('IN_COPPERMINE', true);
require('include/init.inc.php');
if (isset($_GET['pid'])) {
// Add 1 to hit counter
$pid = (int)$_GET['pid'];
if (!in_array($pid, $USER['liv']) && isset($HTTP_COOKIE_VARS[$CONFIG['cookie_name'] . '_data'])) {
add_hit($pid);
if (count($USER['liv']) > 4) array_shift($USER['liv']);
array_push($USER['liv'], $pid);
user_save_profile();
}
}
?>
This should work.
Note: The hit will be counted for only those images which have been served.
Abbas