Jump to content

[SOLVED] Hidden Hit Counter


prcollin

Recommended Posts

I want to put a hit counter on my website that is only visible to the administrators.  Can i just do along the general lines of

 

if user == 'blah'

    counter.visible = 'true' Or how would you echo a visible counter?  I haven't worked that out yet lol

 

elseif user == 'blah1'

    counter.visible = 'true'

 

else

    counter.visible = 'false'

 

Ill post full code as soon as I generate it the idea just popped into my head and wanted to get your opinion on the best way to make it visible to only two users

Link to comment
https://forums.phpfreaks.com/topic/108840-solved-hidden-hit-counter/
Share on other sites

simplest way is to give each user level a numerical value in the db, so you can just do this:

(example code -- rework to suit your needs)

<?php
if ($_SESSION['user_level'] == "admin"){
//put your counter code here
}
?>

You don't need an else statement. If you want more than one user group to see it:

<?php
if ($_SESSION['user_level'] == "admin" || $_SESSION['user_level'] == "moderator"){
//put your counter code here
}
?>

Archived

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

×
×
  • 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.