473,321 Members | 1,778 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

Disbaling Leaving the Page

46
I don't mean disabling leaving the site entirely, forcing the user to remain at my god forsaken mess for the rest of eternity. But instead just disabling going to any other part of my site (until certain requirements are met). Is there any way to do this securely without putting a check for the requirements at the beginning of each page?

-Sake
Jan 29 '08 #1
3 1391
harshmaul
490 Expert 256MB
Depending on the requirements you could fill in the session with different values until all of the requirements are met.

For example if you require three pages to be visited before going on to another page,.. increment a session variable $_SESSION['pagecount'] by one. and then on the other page check this value.

There is probably a better idea involving signing up and checking database values. but it depends on what the criteria are.
Jan 29 '08 #2
sake
46
well its more or less a puzzle type of thing, so you have to win the puzzle before continuing anywhere. I already have the code to check whether or not they've won, and i guess i could just check for that on each page.
Jan 30 '08 #3
harshmaul
490 Expert 256MB
As soon as you work out whether they've won or not stick a variable in the session or cookies stating that.

Or if they have to log in to do the puzzle assign a value somwhere (depending on your DB structure) to say that the puzzle was done.

the session approach...

put this on pages you want to lock if the user hasn't completed the puzzle.
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. session_start();
  3. if (!IsSet($_SESSION['puzzle'])){
  4.     header("location:index.php");
  5. }
  6. ?>
Assign the value similar to this...
Expand|Select|Wrap|Line Numbers
  1. $_SESSION['puzzle'] = 1;
Jan 30 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Rich | last post by:
Hello, I want to create a cookie that will expire in a few mintues after a user leaves my page so that they can return without having to login again if they were only gone for a few minutes. I...
1
by: Karuppasamy | last post by:
Hi In Windows Application (C#), on RightMouse Button click in a Textbox, a Popup menu with Cut / Copy / Paste is appearing. How to disable this behaviour. I dont want to allow the user to copy...
3
by: Dag Sunde | last post by:
Both refreshing (by pressing F5 or otherwise) a page, and navigating away from a page leads to onUnload() triggering. Is it possible to determine if the user is leaving the page for another, or...
8
by: Zvonko | last post by:
Hi! Is it possible to capture an event when user leaves the page and execute some code? Not when he closes the window. Any ideas?
1
by: Rich | last post by:
Hello, I want to create a cookie that will expire in a few mintues after a user leaves my page so that they can return without having to login again if they were only gone for a few minutes. I...
3
by: Anburaja | last post by:
Hi, I want to get confirmation before leaving a page. If the selects Yes i want to leave the page else i want to retain the page in the browser. i tried with <body onbeforeunload="return...
3
by: =?Utf-8?B?Q2hyaXMgUm9kZW4=?= | last post by:
I am working on an ASP.NET application utilizing .NET 3.5. One page is using a multi-view with 10 views. UpdatePanels are used to navigate from one view to another. There are hundreds of fields and...
1
by: Anonymous | last post by:
Which is the correct approach to disable buttons when leaving an aspnet page? Currently I have the following html, which disables buttons when pressing F5 in FireFox, which ofcourse can occur...
4
by: daveh551 | last post by:
Okay, I feel like this is probably a stupid question, but... I have accessed sites that are pushing some scam that, when you go to leave the page it will pop up a box saying, "No, don't go, let...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.