Jump to content

invisible counter


Recommended Posts

Here what I use, this script counts universal users for me:
require ("db.php");
$date = date('d, M, Y, h: m'); // get currnet date
$userip = $_SERVER['REMOTE_ADDR']; //get user ip

$c_ip = $HTTP_COOKIE_VARS["user_ip"]; //set cookies to remeber user ip
setcookie("user_ip", $REMOTE_ADDR, time()+86400); // remember cookie for seconds -1 day

if($c_ip != $userip) {
  mysql_query("INSERT INTO count
  ('$date','$userip')"); // if remote address is not equal to cookied ip DO Count

To view it I just need to log in to my secure page and display the result:

require ("db.php");
$result = mysql_query("SELECT*FROM count WHERE number");
echo "<table border='1' bordercolor='#95B5C6'>
<th>User IP</th>
while($row = mysql_fetch_array($result))
  echo "<tr><td>";
  echo $row['date'];
  echo "</td><td>";
  echo $row['userip'];
  echo "</td><td>";
  echo $row['number'];
  echo "</td></tr>";
echo "</table>";
Link to comment
Share on other sites

This thread is more than a year old. Are you sure you have something important to add to it?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.