Jump to content

Archived

This topic is now archived and is closed to further replies.

techker

invisible counter

Recommended Posts

hey guys is it possible to make an invisible counter that only the admin could access it thru an admin panel?

Share this post


Link to post
Share on other sites
yes, you can easly do that, also you could try some simple counter, such as [url=http://www.flash-counter.com]http://www.flash-counter.com[/url]

Share this post


Link to post
Share on other sites
Here what I use, this script counts universal users for me:
[code]<?php
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)
VALUES
  ('$date','$userip')"); // if remote address is not equal to cookied ip DO Count
  }
mysql_close($con);
?>[/code]

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

[code]<?php
require ("db.php");
$result = mysql_query("SELECT*FROM count WHERE number");
echo "<table border='1' bordercolor='#95B5C6'>
<tr>
<th>Date</th>
<th>User IP</th>
<th>Number</th>
</tr>";
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>";
mysql_close($con);
?>[/code]

Share this post


Link to post
Share on other sites
Save file one as eg counter.php

Then on the pages you want counted, put this: [code]include("counter.php");[/code]

Share this post


Link to post
Share on other sites

×

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.