Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7008577
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:45:12+00:00 2026-05-27T21:45:12+00:00

I have site for example www.mysite.com, with a simple login system. I use PHP

  • 0

I have site for example http://www.mysite.com, with a simple login system. I use PHP and MYSQL. In session I have:

$_SESSION['user_id']

Is possible to check if the user currently has the page www.mysite.com/test.php open?

I can use also jQuery and Ajax, but how?

In database I have for example:

Users:
id | username | is_on_test
1  | admin    | 0
2  | user     | 1

If user is on test.php I would like have in database in column is_on_test value 1, if isn’t on test.php then should be 0.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T21:45:13+00:00Added an answer on May 27, 2026 at 9:45 pm

    call an ajax script every 20 or 30 secs or whatever frequency u like.
    TEST.PHP

    // fire below insertion to database
    if (there exist any row of current logged in user on <table>)
        update <table> set time_stamp = Now() where user_id = $_SESSION['userid'] 
    else
        insert into <table> (id,time_stamp) VALUES ($_SESSION['userid'],Now())
    

    to display users list on ADMIN.PHP

    //fire below query for displaying users 
    select * from <table> where time_stamp in between 'Now()-20' and 'Now()+20'
    

    make sure that the insertion / updation queries for insert / update timestamp in every ( 20 sec or whatever) interval

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So, I have at site where I want pages such as; www.example.com/shop/index.php (or any
I have a site that sits in a directory on a domain: http://www.example.com/site/ I
Let's say I have a site with multiple links as follows: www.example.com/product/1 www.example.com/product/2 www.example.com/product/3
I have a PHP5/Zend Framework 1.8.1 web site which is located at: http://www.example.com/foo The
I have 2 site: example.com and exampletwo.com I want that when a user login
I have just installed CentOS, Apache and PHP. When I visit my site http://example.com/myapp/
I currently have three websites all running from the same DB example websites: www.mysite.com
I have a asp.net site www.example.com on a Microsoft server. I also have a
I have a search page located at http://www.example.com/search_result.php , and I'm mod_rewriting it to
Say I have a site on http://example.com . I would really like allowing bots

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.