![]() |
![]() |
![]() |
|||||
![]() |
![]() |
![]() |
![]() |
![]() |
|||
| Welcome
to Tech Support Forum home to more then 136,000 problems solved. Issues
have included: Spyware, Malware, Virus Issues, Windows, Microsoft,
Linux, Networking, Security, Hardware, and Gaming Getting your
problem solved is as easy as: 1. Registering for a free account 2. Asking your question 3. Receiving an answer Registered members: * See fewer ads. * And much more..
|
| Want to know how to post a question? click here | Having problems with spyware and pop-ups? First Steps |
|
|||||||
| Web Design & Programming Discussion of web design, and server-side & client-side scripting |
![]() |
|
|
Thread Tools |
|
|
#2 (permalink) |
|
Registered User
|
I dont think apache holds referers in logs except for on some errors. But here is a php script I wrote that count unique hits that you can use.
Code:
<?php
// get name of current page
$script = $_SERVER['PHP_SELF'];
// break the array in directories and the script name
$all = explode('/',$script);
//get name of page
$spot = count($all) -1;
$script = $all[$spot];
$ip = $_SERVER['REMOTE_ADDR'];
// query to check for whether the page is in the table or not
$link = "SELECT * FROM hits WHERE script='$script'";
$res = mysql_query($link) or die(mysql_error());
$total = mysql_num_rows($res);
$row = mysql_fetch_assoc($res);
// if its not then add it with one hit
if ($total == 0)
{
$add = "INSERT INTO hits VALUES('$script','1','$ip')";
$addit = mysql_query($add) or die(mysql_error());
}
else
{
// if it is and its not from an ip thats already hit it then add it
$ips = $row['ips'];
if (!strstr($ips,$ip))
{
$newtotal = $row['total'] + 1;
$ips .= $ip;
$update = mysql_query("UPDATE hits SET total='$newtotal',ips='$ips' WHERE script='$script'") or die(mysql_error());
}
}
?>
Code:
<?php
$stats = "CREATE TABLE `hits` (
`script` TEXT NOT NULL,
`total` INT ( 11 ),
`ips` TEXT NOT NULL );";
$table = mysql_query($stats) or die(mysql_error());
?>
<?php include("stats.php"); ?>
__________________
My new homepage: Last edited by tgo : 11-08-2005 at 03:11 PM. |
|
|
|
|
|
#5 (permalink) |
|
Be Free
|
no, apache also writes access.log which tells where they came from...
192.168.1.1 - - [08/Nov/2005:20:02:49 -0600] "GET /testphp.php HTTP/1.1" 200 171 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1... that's quite helpful in locating where there from and what their doing...
__________________
Suicide Command in Linux : rm -rf / ;) AIM:TheLoneWolf071@aim.com--If You Need Help, Don't Hesitate... |
|
|
|
|
|
#6 (permalink) |
|
Tech, Networking Forums
Join Date: Apr 2005
Location: 1265 Lombardi Ave.
Posts: 1,005
OS: All of the above
|
Why not just use Awstats.
http://awstats.sourceforge.net/ |
|
|
|
|
|
#7 (permalink) |
|
Registered User
Join Date: Nov 2005
Posts: 4
OS: XP
|
Hi,
I am using Awstats and it works great except that some info is missing i.e. : browser type OS referer search criteria My question is how can I configure APache 2.0 in such a way that it does log these data. Rene |
|
|
|
|
|
#8 (permalink) |
|
Be Free
|
again, the apache access log file tells you all that info...
192.168.1.1 - - [08/Nov/2005:20:02:49 -0600] "GET /testphp.php HTTP/1.1" 200 171 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1... -- That's Telling You What OS, What Browser, It Tells You what they access and what criteria they enter. it's very good at what it does... /var/log/apache/access.log or /var/log/apache2/access.log
__________________
Suicide Command in Linux : rm -rf / ;) AIM:TheLoneWolf071@aim.com--If You Need Help, Don't Hesitate... |
|
|
|
|
|
#9 (permalink) | |
|
Tech, Networking Forums
Join Date: Apr 2005
Location: 1265 Lombardi Ave.
Posts: 1,005
OS: All of the above
|
Quote:
|
|
|
|
|
![]() |
| Thread Tools | |
|
|