We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
Statistics
Topic Started: Jun 12 2005, 01:45 AM (347 Views)
commander-ZNS
Member
[ *  *  *  * ]
I need a script for my site where it shows

Total Unique Hits:
Total Hits:
Todays Total Hits:
Todays Unique Hits;
Users Online:

I looked ever where but I can't find one that has those things all together. I got one that has everything except for users online. If you want the script its in the bottom. Can you please edit it so it has Users Online in it.

Code:
 
<style type="text/css">
<!--
.style1 {color: #FFFFFF}
-->
</style>
<body>
<span class="style1"><font face="Verdana" size="1">
<?php
// Our log file;
$counter = "includes/stats/stats.txt";

// Date logging;
$today = getdate();
$month = $today[month];
$mday = $today[mday];
$year = $today[year];
$current_date = $mday . $month . $year;


// Log visit;
$fp = fopen($counter, "a");
$line = $REMOTE_ADDR . "|" . $mday . $month . $year . "\n";
$size = strlen($line);
fputs($fp, $line, $size);
fclose($fp);

// Read log file into array;
$contents = file($counter);

// Total hits;
$total_hits = sizeof($contents);

// Total hosts;
$total_hosts = array();
for ($i=0;$i<sizeof($contents);$i++) {
$entry = explode("|", $contents[$i]);
array_push($total_hosts, $entry[0]);
}
$total_hosts_size = sizeof(array_unique($total_hosts));

// Daily hits;
$daily_hits = array();
for ($i=0;$i<sizeof($contents);$i++) {
$entry = explode("|", $contents[$i]);
if ($current_date == chop($entry[1])) {
 array_push($daily_hits, $entry[0]);
}
}
$daily_hits_size = sizeof($daily_hits);

// Daily hosts;
$daily_hosts = array();
for ($i=0;$i<sizeof($contents);$i++) {
$entry = explode("|", $contents[$i]);
if ($current_date == chop($entry[1])) {
 array_push($daily_hosts, $entry[0]);
}
}
$daily_hosts_size = sizeof(array_unique($daily_hosts));

?>
<? echo "
<b>Page hits: </b> " . $total_hits . "<br><br>
<b>Unique hits: </b> " . $total_hosts_size . "<br><br>
<b>Todays Page hits: </b> " . $daily_hits_size . "<br><br>
<b>Todays unique hits: </b>" . $daily_hosts_size;
?>
</span>
Offline Profile Quote Post Goto Top
 
Chaos King
Member
[ * ]
I got this off http://www.pixel-designz.net

Create a file called peepsonline.php and place this code in there

Code:
 
<?
$remote = $_SERVER["REMOTE_ADDR"];
$file = "peepsonline.txt";
$timeoutsecs = 30;
$timestamp = time();
$timeout = ($timestamp-$timeoutsecs);
$fp = fopen("$file", "a+");
$write = $remote."||".$timestamp."\n";
fwrite($fp, $write);
fclose($fp);
$online_array = array();
$file_array = file($file);
foreach($file_array as $newdata){
list($ip, $time) = explode("||", $newdata);
if($time >= $timeout){
array_push($online_array, $ip);
}
}
$online_array = array_unique($online_array);
$online = count($online_array);
if($online == "1"){
echo "Peeps Online: $online";
}else{
echo "Peeps Online: $online";
}
?>


Now, create a txt (text) file called peepsonline.txt and CHMOD that file to 777
<?php inlclude "peepsonline.php"; ?> where ever you would like
Use to show this file, please notice that this is changable to where ever you see bold.

Hoped that helped.
Offline Profile Quote Post Goto Top
 
Jory
Member Avatar
Member
[ *  *  *  *  *  * ]
Chaos King
June 15, 2005 08:50 AM

<?php inlclude "peepsonline.php"; ?> where ever you would like


Should be

Chaos King
June 15, 2005 08:50 AM

<?php include "peepsonline.php"; ?> where ever you would like



On his own request:

Rory is being silly :rolleyes:
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Technology Chat · Next Topic »
Add Reply