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 8412037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T00:34:32+00:00 2026-06-10T00:34:32+00:00

I have a site that logs a user in and does a db lookup

  • 0

I have a site that logs a user in and does a db lookup to see if the user has acknowledged that they have read a file. If they have not they are sent to a page with links to the files which need to be read. Once they read the file and click the acknowledge link the php script adds this file name along with user name to a table named read. What I want to do is stop the user from navigating away from this page if they have not acknowledged that they read the files. How would I use the javascript onunload function and do an ajax request to check if they have read the files that need to be read. I am new to ajax so any help would be appreciated.

  • 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-06-10T00:34:34+00:00Added an answer on June 10, 2026 at 12:34 am

    Best way to handle this is PHP, not JS. Too easy to get around it if you depend on JS:

    1) when loading the user data into the session, check if they acknowledged it or not.

    2) add a condition to fire on every page load (same place in the code where you check if they are logged in) in php that will redirect them to that page unless they have acknowledged it.

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

Sidebar

Related Questions

I have a site that has a /sites/default/files/ directory where user content is typically
We have a website (foo.com) that does online training. A user logs in, then
I have a site that has an Rss feed, and this feed is consumed
I have a PHP / Javascript page that automatically logs a user into different
I have a site which has an area that requires authentication. Right now I
I have a dynamic php (Yii framework based) site. User has to login to
I have a site I am developing and it has a table that stores
I'm creating a script that logs a user into a site. Everything works but
I have a site that i want to redirect all requests accept for 1
I have a site that allows download or streaming of mp3 files. All the

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.