Page 1 of 1

Getting previous page url

Posted: Thu Dec 11, 2008 4:43 am
by hvolvo
hi,
i am having a page on which i check if the user is logged in. if the user is logged in i save some details in the db and display a link for the user. on clicking this link a pdf/html page is opened.
Now when the user preses the back button of the browser, he is taken back to the same page, where it checks that the user is logged in and again saves details to the db.
I tried using HTTP_REFERER to check if the url of the link and that of the previous page is same, but HTTP_REFERER does not give me the link of the pdf since the user is using back button.
Is there a way to get the url of the previous page in this case :?:
i dont want to disable the browser button or anything

Thanking in advance.

Re: Getting previous page url

Posted: Thu Dec 11, 2008 9:42 am
by Reviresco
If I understand the question correctly, you just want to check to see if the user's logged in? Then setting a cookie or a $_SESSION variable would be the easiest way.

Re: Getting previous page url

Posted: Thu Dec 11, 2008 9:42 pm
by hvolvo
The saving part works fine.. my problem is that the saving details in database is happening twice.
once if the user is already logged in and the second time, when he goes to the next page by clicking the link and tries to return back using the browser back button.
i don't want the saving of details happening the second time.
i ope i have made my self clear.

Re: Getting previous page url

Posted: Fri Dec 12, 2008 12:32 am
by Chris Corbyn
Can't you just check if these "details" you save to the DB have already been saved? That seems like the most bulletproof fix.