/[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.2 - (show annotations)
Tue Sep 25 15:38:04 2001 UTC (22 years, 8 months ago) by ravilov
Branch: MAIN
Changes since 1.1: +14 -10 lines
Major changes. Too numeruous to mention all here.

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

  ViewVC Help
Powered by ViewVC 1.1.26