felladrin / online-visitors-counter

Real-time online visitors counter using Ajax, PHP PDO and SQLite.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is it possible to hide admin activity ?

mrzeeshanplus opened this issue · comments

Mean admin page block in popup where users are

The easiest way to do this is not including <script src='path/to/ovc/counter.js'></script> on your admin pages. You can easily do this with php, like:

$currentUrl = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
// Only include the OVC script if the current page does not contains the 'admin' substring:
if (strpos($currentUrl, 'admin') === false)
{
    echo "<script src='path/to/ovc/counter.js'></script>";
}

On which php file should I put this? In side file manager there are many php file

Well, didn't you add the <script src='path/to/ovc/counter.js'></script> line, in one single file when installing Online Visitors Counter? Or have you added manually to every page?

If you added in a single file and that file is a '.php', then that's the place where you'll replace that line by the php code mentioned.

Hm, on a quick look, I can see you could add a script to question2answer using http://docs.question2answer.org/plugins/layers/.
Follow their instructions and you should end with something like this:

    function head_script()
    {
        if ($this->template != 'admin') // check it's not an admin page
            $this->content['script'][]='<SCRIPT src="'.
            qa_html(QA_HTML_THEME_LAYER_URLTOROOT.'ovc/counter.js').
            '" TYPE="text/javascript"></SCRIPT>';

        qa_html_theme_base::head_script();
    }

This page isn’t working
electronics2electrical.com is currently unable to handle this request.
HTTP ERROR 500

I see, But it's a too much specific problem related to question2answer software. I'm afraid I can't help you any further.

Its okay thanks for your help... I have shared your code in community

You're welcome! Good luck!