Jump to content


Photo

invisible counter


  • Please log in to reply
8 replies to this topic

#1 techker

techker
  • Members
  • PipPipPip
  • Advanced Member
  • 748 posts

Posted 10 October 2006 - 01:51 PM

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

#2 Gruzin

Gruzin
  • Members
  • PipPipPip
  • Advanced Member
  • 448 posts
  • LocationGeorgia

Posted 10 October 2006 - 01:54 PM

yes, you can easly do that, also you could try some simple counter, such as http://www.flash-counter.com
I don't need your script, I'll try to write it myself

#3 techker

techker
  • Members
  • PipPipPip
  • Advanced Member
  • 748 posts

Posted 10 October 2006 - 01:57 PM

i have the counter but im worduring how to hide it and access it agiain?

#4 Gruzin

Gruzin
  • Members
  • PipPipPip
  • Advanced Member
  • 448 posts
  • LocationGeorgia

Posted 10 October 2006 - 02:03 PM

Here what I use, this script counts universal users for me:
<?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);
?>

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

<?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);
?>

I don't need your script, I'll try to write it myself

#5 techker

techker
  • Members
  • PipPipPip
  • Advanced Member
  • 748 posts

Posted 10 October 2006 - 02:06 PM

so i put the first code in one page and the other in a seprate page .



#6 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 10 October 2006 - 02:13 PM

Yes.

#7 techker

techker
  • Members
  • PipPipPip
  • Advanced Member
  • 748 posts

Posted 10 October 2006 - 02:19 PM

but how does it know witch page i want to count?

#8 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 10 October 2006 - 02:29 PM

Save file one as eg counter.php

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


#9 techker

techker
  • Members
  • PipPipPip
  • Advanced Member
  • 748 posts

Posted 10 October 2006 - 03:34 PM

i get errors?were is db.php?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users