/[health_html]/inc/tracker.php
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /inc/tracker.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations)
Fri Sep 28 23:34:37 2001 UTC (17 years, 7 months ago) by ravilov
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +6 -2 lines
Added some new pages to PLIVAmed. Some bugfixes.

1 <?php
2 $ref = $HTTP_SERVER_VARS["HTTP_REFERER"];
3 $idx = strpos($ref, "?");
4 if (!($idx === false)) $ref = substr($ref, 0, $idx);
5 $idx = strpos($ref, "#");
6 if (!($idx === false)) $ref = substr($ref, 0, $idx);
7 $tgt = $HTTP_SERVER_VARS["SERVER_NAME"]."/".$HTTP_SERVER_VARS["REQUEST_URI"];
8 $idx = strpos($tgt, "?");
9 if (!($idx === false)) $tgt = substr($tgt, 0, $idx);
10 $idx = strpos($tgt, "#");
11 if (!($idx === false)) $tgt = substr($tgt, 0, $idx);
12 $ref = ereg_replace('index\.([A-Za-z0-9]+)$', '', $ref);
13 $tgt = ereg_replace('index\.([A-Za-z0-9]+)$', '', $tgt);
14 if ($ref && $tgt) {
15 include("inc/conn.php");
16 $sth = $dbh->prepare("SELECT count FROM tracker WHERE (referer = '$ref') AND (target = '$tgt')");
17 $row = "";
18 if ($sth) {
19 if ($sth->execute()) $row = $sth->fetchrow_array();
20 $sth->finish();
21 }
22 if ($row) $sql = "UPDATE tracker SET count = count + 1, t_change = NOW() WHERE (referer = '$ref') AND (target = '$tgt')";
23 else $sql = "INSERT INTO tracker (referer, target, count, time, t_change) VALUES ('$ref', '$tgt', 1, NOW(), NOW())";
24 $dbh->dbh_do($sql);
25 $dbh->disconnect();
26 }
27 ?>

  ViewVC Help
Powered by ViewVC 1.1.26