Preventing browser from going back

I have a page that allows a user to specified a user name and password to genrate a free account on a system. The free account is an incentive for the user to fillout a survey.

Question 1: How do I prevent users from going directly to the free account page without filling the survey (in case they know the URL).

Question 2: How do I prevent the user from using the Back button to create multiple account.
moonriseAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

MaxVTCommented:
This is probably too little info for an answer... will do for a comment, tho'

Prevent : use cookies. Set the cookie after the survey is
filled and check it on entry. The same applies for pressing "back" - the user can press Back, but the cookie is already set
and the survey says "Sorry... Can only be done once."
0
moonriseAuthor Commented:
That sounds like a good idea but this survey wil actually be done at a public kiosk. Would that be a problem since the same PC must be allowed to run the survey again and again. Thank you.
0
TTomCommented:
The cookie solution will not work on a public kiosk (unfortunately).

If your server is IIS, you can probably create an active server page application which would do what you would like.

Other than that, you are probably looking at some sort of CGI script.

Tom
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

moonriseAuthor Commented:
CGIs are OK, I already use them but I am not sure what needs to be done in the CGI to do that. I am actually using ISAPI DLLs developed in Delphi.
0
TTomCommented:
Pretty much what you need to do is to create something that "maintains state".  That's why I suggested IIS/ASP.

Not sure how you would do this with CGI, but for question 1, you need to check the "referrer" page to be sure it's coming from your login page.  This is a server side variable, and a CGI script should be able to pick it up.  If the page request is not coming from your login page, redirect the request to the login page.

As far as question 2 goes, I am sure you can come up with something which will stop an immediate return to the login page, but how do you stop someone from surfing around for a couple of pages and coming back?  Again that's why I was looking at IIS.  If a session is established in IIS, you can test for a variable which will exist for a defined amount of time and refuse any requests in that time period.

Don't know if this is helpful.  Just trying to point you in the right direction.

Tom
0
jhurstCommented:
1) The second page needs to be generated by a cgi rather than just html.  The cgi can cxhecjk the HTTP_REFERER and ensure that it is called from the page that asks your questions.

2) The simplest way to disable back is to use a
<meta http-equiv="refresh" content="0; url=http://thepageyouwant">
You generate a page containing the above line, this then immediately transfers to thepageyowant.  Now, if the user hits back, he/she gets to the page with the refresh again and so is re-sent to your page.

In fact 2) is such a pain for many that they do a content="1; " not 0 so that there is a delay, giving people a chance to hit the back.  In your case you will use this annoying feature.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.