Co do samego licznika to już taki mam i działa zlicza mi kliknięcia w dany link(plik) , nie wiem tylko jak mam napisać te parę linijek kodu a dokładniej,
1. jak dodać znacznik czasu rozpoczęcia pobierania
2. Odczytuje go z dysku i wysyła do klienta
3. Na zakończenie pobierania uaktualnia znacznik czasu w bazie informujący o zakończeniu pobierania
to o czym pisałeś na wstępie.
Kod mojego licznika składa się z trzech plików config.php to połączenie z bazą, plik counter.php to
//1. include the configuration file
include("config.php");
//2. Get the id from the url and store it into a variable
$id = mysqli_real_escape_string($link, $_GET['id']);
//3. fetch the url and clicks from this banner
$clicks = mysqli_fetch_object(mysqli_query($link, "SELECT image,hd, download FROM wp_my_plugin WHERE id=".$id.""));
//4. increase clicks with 1
$new_click = $clicks->download+1;
//5. update this into the database, check if it was succesfull
if(mysqli_query($link, "UPDATE wp_my_plugin SET up_post_date=NOW(), download=".$new_click." WHERE id=".$id."")):
//6. redirect to the url
header("Location: ".$clicks->hd); else:
//6. else write to error log
endif;
trzeci plik index.php to
<?php
include("config.php");
//popular_video
$sql = mysqli_query($link, "SELECT id,image,post_date,MAX(download), title FROM wp_my_plugin GROUP BY post_date DESC LIMIT 10");
//new_video
//$sql = mysqli_query($link, "SELECT id,image,up_post_date,title FROM wp_my_plugin GROUP BY up_post_date DESC LIMIT 10");
//
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>banners index page</title>
<script type="text/javascript" src="js/jquery-1.6.1.min.js"></script>
<script type="text/javascript" src="js/jquery.waterwheelCarousel.min.js"></script>
<link rel="stylesheet" type="text/css" href="css/waterwheel-carousel.css" />
<script type="text/javascript">
$(document).ready(function () {
$("#waterwheel-carousel-vertical").waterwheelCarousel({
orientation: 'vertical',
startingItemSeparation: 100,
startingWaveSeparation: 40,
autoPlay: 2500
});
});
</script>
</head>
<body>
<div id="waterwheel-carousel-vertical">
<div class="carousel-controls">
<div class="carousel-prev"><a href="#">< move down</a></div>
<div class="carousel-next"><a href="#">> move up</a></div>
</div>
<div class="carousel-images">
<?php
while($result = mysqli_fetch_object($sql)):
?>
<a href="counter.php?id=
<?php echo $result->id; ?>">
<img src="
<?php echo $result->image; ?>" alt="
<?php echo $result->title; ?>" width="138" height="82"/>
</a>
<?php
endwhile;
?>
</div> </div></div><!-- end of container -->
</ul>
</div>
</body>
</html>