Page 1 of 1

Re: forcing a user off

Posted: Fri Aug 14, 2009 3:40 pm
by jackpf
You'd have to use ajax or something similiar to constantly check if the admin is logged on.

This sounds a bit odd though....
I personally wouldn't use a website that kicked me off when someone else went offline :|

Re: forcing a user off

Posted: Fri Aug 14, 2009 4:47 pm
by McInfo
Store the fact that the admin is logged in or not in a central location like a database or a file. When someone sends a request, check whether the admin is logged in based on the stored value. If not, use a control structure to display something different or call header() to send a Location header to redirect the user.

Edit: This post was recovered from search engine cache.

Re: forcing a user off

Posted: Fri Aug 14, 2009 5:06 pm
by McInfo
You can't edit it. == You can't make changes. == You can't change its behavior.

Edit: This post was recovered from search engine cache.

Re: forcing a user off

Posted: Fri Aug 14, 2009 5:38 pm
by McInfo
The admin's logged-in status is probably stored in the board's database. You can access the database from your own PHP script without modifying the board's code. You can use AJAX, as jackpf said, to poll the PHP script from the HTML page that contains the <iframe>. If the admin is logged out (or a certain amount of time has passed since the admin's last action), use Javascript to change the browser location or refresh the page.

Javascript to redirect to page2.php:

Code: Select all

window.location.href = './page2.php';
Also check the logged-in status each time the page with the <iframe> loads.

You can't really prevent anyone from accessing the board without modifying the board's code. Someone can just look at the <iframe>'s src attribute to find the real URL.

Another solution that would be immune to the <iframe> problems is to create a PHP script to act as a proxy for the board. All requests and responses would be filtered through the proxy script.

Edit: This post was recovered from search engine cache.

Re: forcing a user off

Posted: Fri Aug 14, 2009 8:11 pm
by McInfo
Do you at least know the admin's username and password?

Edit: This post was recovered from search engine cache.

Re: forcing a user off

Posted: Fri Aug 14, 2009 9:53 pm
by McInfo
You need to think of your page as a man-in-the-middle. You need to know who the admin users are and keep track of whether they are currently using the page. If no admin has accessed the page for a given period of time, don't show the <iframe> to anyone.

An alternative to AJAX is to use a hidden <iframe> whose source is a PHP script on your server. The <iframe> is updated periodically using Javascript's setInterval() method. The PHP script would be used to keep track of the admin's logged-in status and notify other users when the admin is no longer connected.

Edit: This post was recovered from search engine cache.