PDA

View Full Version : PHP page refresh


nucleartraffic
01-28-03, 02:09
Hi, I need help with page refresh. My question is how do i stop someone from refreshing a certain page in PHP. Can this be done? Or can it be redirected to the same PHP page? Any help would be appreciated.

Thanks,
Jason

bcyde
01-28-03, 10:52
Can you provide a little more info? What specifically are you trying to do? Are you using forms, sessions, etc? What would cause the page to be different after refreshing?

-b

nucleartraffic
01-28-03, 11:26
It's for one of my traffic exchanges. Sorry, I meant it should be redirected to a different page not the same page. After a user has been credited I would like them to have to click the next button and not be able to refresh the page. Just trying to stop automatic refreshing programs from working on my exchange.

Thanks,
Jason

bcyde
01-28-03, 11:43
Hmm, just go with a session variable test then. It should be simple enough. Here's a quick, easy example.

session_start();
if ($_SESSION['visit'] == true )
{
header("Location: http://www.example.com/"); //your redirect URL
}
else
{
$_SESSION['visit'] = true;
//display your normal page here
}

nucleartraffic
01-28-03, 16:00
Didn't work the way i wanted it to. Thank you anyway. I need it to go to a certain page when the user refreshes the page?

Thanks,
Jason

bcyde
01-28-03, 17:56
Hmmm... maybe I'm not understanding correctly.
As I understand it you were asking that on the first visit to the page (in the browser session) the user goes to one page and then if he refreshes it goes to another page. This is what my example was based off of.

Did you want something more permanent where the user only visits once ever (even after closing the browser) and from then on gets forwarded to a different page. If so you may want to try and use cookies instead of sessions.

-b

nucleartraffic
01-29-03, 03:43
Yah i think i will try using cookies. Thanks for your help :)

aaaaaa
11-06-06, 01:47
Is there a way where you can refresh a page without using cookies and header?

aaaaaa
11-06-06, 01:50
hi is there a way where i can refresh a page with a php code without using cookies and also header? this is what i mean the checkbox is in another function and then when i click it it will go to another function and then the page will be automatically refreshed.. is there a way tnx guys