|
Answer» I create some PHP pages with user LOGIN. All pages displayed only when a user is logged. Otherwise all pages redirected to Logon page.
After logon, the user name will be displayed on all pages.
That all are created and worked fine.
Now I want, REFRESH the user status(logged or not logged) in all pages for a particular interval.
Incase a user logged out from any one page then I want to inform all other opened pages that the user logged out.
In PHP, we can get user info using SESSION OBJECT. But I can't use it for every interval.
There is any way to get? Please tell me.I don't think that what you a trying to do would be able to be without the pages reloading every few seconds. I myself use php in My Website and have never seen any examples online where the page checks little bits of itself against what users are doing. It would be far easier if you had a note "Users Logged In when this page was loaded: User1, User2, SomeUser, TheOtherUser, Etc" Then if they click to a different page, the website generates a different list.
Thanks Bones92.
I don't know that is possible in PHP.
But I see on some websites.
They publish rating or vote results in homepage. They conduct the rating or vote in a new window only. After rating, it closes current window and results refreshed in that home page.
I don't know what language is used by them. But there is a possibility available.So I want the same in my PHP pages.The only way to do that is by constantly refreshing the page. The way that the web server sends your web browser the HTML is stateless, meaning that it sends the text and then closes the connection. After the page has been loaded, the only way for the web browser to receive new data is to open another connection and request it.
So basically, create a PHP script that will display only the information you want to be constantly refreshed (a list of online users, if I've read correctly). Then, use javascript on the pages you want to display that to SET a timer that will occur every X seconds that will use AJAX to refresh the info in the element that's going to display it all.OK Spasm. I understand your words that explained the concept.Now I try to implement. But I am Beginner in PHP. So I need a little reference in PHP.
If you can tell me the any website(closer to your words) to REFER PHP and AJAX.
|