/[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

Diff of /inc/tracker.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by ravilov, Wed Sep 19 12:23:57 2001 UTC revision 1.3 by ravilov, Fri Sep 28 23:34:37 2001 UTC
# Line 2  Line 2 
2          $ref = $HTTP_SERVER_VARS["HTTP_REFERER"];          $ref = $HTTP_SERVER_VARS["HTTP_REFERER"];
3          $idx = strpos($ref, "?");          $idx = strpos($ref, "?");
4          if (!($idx === false)) $ref = substr($ref, 0, $idx);          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"];          $tgt = $HTTP_SERVER_VARS["SERVER_NAME"]."/".$HTTP_SERVER_VARS["REQUEST_URI"];
8          $idx = strpos($tgt, "?");          $idx = strpos($tgt, "?");
9          if (!($idx === false)) $tgt = substr($tgt, 0, $idx);          if (!($idx === false)) $tgt = substr($tgt, 0, $idx);
10          include("inc/conn.php");          $idx = strpos($tgt, "#");
11          $sth = $dbh->prepare("SELECT count FROM tracker WHERE (referer = '$ref') AND (target = '$tgt')");          if (!($idx === false)) $tgt = substr($tgt, 0, $idx);
12          $row = "";          $ref = ereg_replace('index\.([A-Za-z0-9]+)$', '', $ref);
13          if ($sth) {          $tgt = ereg_replace('index\.([A-Za-z0-9]+)$', '', $tgt);
14                  if ($sth->execute()) $row = $sth->fetchrow_array();          if ($ref && $tgt) {
15                  $sth->finish();                  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          }          }
         if ($row) $sql = "UPDATE tracker SET count = count + 1 WHERE (referer = '$ref') AND (target = '$tgt')";  
                 else $sql = "INSERT INTO tracker (referer, target, count) VALUES ('$ref', '$tgt', 1)";  
         $dbh->dbh_do($sql);  
         $dbh->disconnect();  
27  ?>  ?>

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.3

  ViewVC Help
Powered by ViewVC 1.1.26