Forum Moderators: open
This is all hypothetical so far but here goes.
Completing a process on page 1 redirects visitor to page two, passing a variable.
That part's easy enough, *but*...
in order to prevent visitor from bookmarking page two I want to:
a) make page two expire if the variable has been used before so that the page cannot be displayed again (a nice custom 'page expired' page would be nice here - but not sure how to go about that either just yet)
b) make page two inaccessible if a variable isn't present at all or if the variable isn't a valid one - i.e. generated by page one.
I know I can specify a referring URL for page two but that's not going to cut it - is it?
Thanks in advance :)
I haven't done exactly this but heres an idea;
Using javascript -
Page one.
Set a cookie that expires end of session. (or not if you want)
Page two.
Check for the cookie - if not present redirect to somewhere.
Make javascript read the content from a page.content.js file so that turning javascript off dosen't get round it.
There are lots of other ways to get around this method, but it will stop most people.
Other caveats
- needs cookies and javascript or no content shown.
- the content txt file - you could stick some basic encoding in that the javascript decodes based on referrer url.
Now if this was server side there are a thousand ways to do this ;)
I like sugarkane's idea (Thanks sugarkane and gethan) of using cookies to the extent that it's quick and simple... but using cookies is something I'd rather avoid.
I did wonder if there was a server-side solution and I think I'd like to go that route so if you have any suggestions of the best method I'd appreciate it.
I'd have no problems (I don't think) with setting up either a cgi or PHP application.
Any suggestions?
I was looking for a way to prevent someone from revisiting a page from which a paid-for product is obtained by completing a form and receiving it attached to an autoresponder.
The help I got from everyone who replied was great (thank you everyone!), a few individual things worked but I didn't quite ever end up with what I was looking for when I put it all together.
Here's what I ended up doing when I started from scratch.
Visitor clicks through a sales link and pays with credit card
The 'get your widget here' page is written in PHP. The receipt number, which is passed from the 'give us your credit card number' page, is extracted from the URL using JavaScript and checked for matching entries in a mySQL database.
If no match is found where there IS a receipt number, all is well and the PHP page displays a very short form which when submitted, enters the new receipt number into the database and then sends email to the vendor who autoresponds with the purchased item.
If a receipt number is not found, PHP displays 'sorry, you have to purchase' section.
If a receipt number is found that matches one already in the database, PHP displays 'sorry, our records show that you've already received your widget'.
The only thing missing is that the PHP page can't tell if the receipt number is a VALID one if it's not present in the database... I may have to just risk it and see how it goes.
Hope that's of interest to someone :)