Jump to content


Users visited today and what they were on?


2 replies to this topic

#1 Josh.

    Young Padawan

  • Members
  • Pip
  • 45 posts
  • Gender:Male
  • Location:<? print("StockyBeatz.net") ?>
  • Interests:Web design and the usual 14 year old stuff

Posted 20 March 2007 - 02:46 PM

Just wondering how this would be done i only know basic php. I have this code:

<?php

 

require_once 'config.php'; // Include config file.

require_once 'hit.php'; // Record the hits to this page

 

$selectHits = mysql_query("SELECT * FROM `stats` WHERE `date` = '" . $time . "' GROUP BY `ip`") or die(mysql_error()); // Select stats from today

  

$uniqueToday = mysql_num_rows($selectHits); // Count uniques today

$hitsToday = mysql_result(mysql_query("SELECT SUM(`hits`) as total FROM `stats` WHERE `date` = '" . $time . "' GROUP BY `date`"), 0, "total"); // Count total hits today

 

$totalUHits = mysql_result(mysql_query("SELECT COUNT(`hits`) FROM `stats`"), 0); // Count total unique hits

$totalHits = mysql_result(mysql_query("SELECT SUM(`hits`) as total FROM `stats`"), 0, "total"); // Count total hits

 

$diff = time() - 300;

$countOnline = mysql_query("SELECT * FROM `stats` WHERE `online` > '" . $diff . "'") or die(mysql_error());

$countOnline = mysql_num_rows($countOnline);

 

 

?>

 

<!-- Echo stats below -->

Total Hits: <?php echo $totalHits ?><br />

Hits Today: <?php echo $hitsToday ?><br />

and im wondering like a list would be done saying what the user has been on and what time.. like the one featured here: http://katz.ws/on/usersonline.php (non advertisement puposes)

#2 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 22 March 2007 - 01:38 PM

What i would do is use a csv-like file, or maybe even a database, and simply store a timestamp followed by the id of the page that the user visited. Then parse the file to see where the user has been.

Have you tried looking through the user information and stats section of the php coding category here?

#3 Josh.

    Young Padawan

  • Members
  • Pip
  • 45 posts
  • Gender:Male
  • Location:&lt;? print("StockyBeatz.net") ?&gt;
  • Interests:Web design and the usual 14 year old stuff

Posted 24 March 2007 - 02:24 PM

Yeah i have looked.. the one on Katz has a link on the bottom to the script but the site isnt working ^_^





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users