PC Nerd Posted June 29, 2006 Share Posted June 29, 2006 hey guysi want to send users to another page i understand this can be done with header('location: .........'how can i put a delay on this. eg relocate after 10 sec, so that i can display info on where the user is going before they go..any help would be much appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/13174-php-redirecting-users/ Share on other sites More sharing options...
redarrow Posted June 29, 2006 Share Posted June 29, 2006 <?php// refresh / redirect to an internal web page// ------------------------------------------header( 'refresh: 5; url=/webdsn/' );echo '<h1>You will be re-directed in 5 seconds...</h1>';// refresh / redirect to an internal web page// ------------------------------------------header( 'refresh: 3; url=/' ); # redirects to our homepageecho '<h1>You will be re-directed in 3 seconds...</h1>';// refresh / redirect to an external web page// ------------------------------------------header( 'refresh: 0; url=http://www.example.net' );echo '<h1>You won\'t know what hit you!</h1>';?> Quote Link to comment https://forums.phpfreaks.com/topic/13174-php-redirecting-users/#findComment-50665 Share on other sites More sharing options...
Dville Posted June 29, 2006 Share Posted June 29, 2006 you could also use this. . .much smaller code, and imo a bit cleaner code[code]header("Location: http://www.example.com");[/code] Quote Link to comment https://forums.phpfreaks.com/topic/13174-php-redirecting-users/#findComment-50674 Share on other sites More sharing options...
PC Nerd Posted June 29, 2006 Author Share Posted June 29, 2006 cool thanksso wats the difference between location: and src = .......Which one should i use???Thanks again Quote Link to comment https://forums.phpfreaks.com/topic/13174-php-redirecting-users/#findComment-50675 Share on other sites More sharing options...
Dville Posted June 29, 2006 Share Posted June 29, 2006 I use the one I pasted above. . .i assume his code works too, so it doesnt matter which one you use. . .which ever one looks better to you.you could even do a iinie, meanie, minie, moe about it. lol Quote Link to comment https://forums.phpfreaks.com/topic/13174-php-redirecting-users/#findComment-50676 Share on other sites More sharing options...
redarrow Posted June 29, 2006 Share Posted June 29, 2006 Dville the user ask for a 10 sec delay can you exsplain how yours delays cheers........................Dville code is for redirecting only.the code i posted is for redirecting set via a time ok like 10 sec set via the refresh rate............good luck. Quote Link to comment https://forums.phpfreaks.com/topic/13174-php-redirecting-users/#findComment-50678 Share on other sites More sharing options...
Dville Posted June 29, 2006 Share Posted June 29, 2006 good point[code]sleep(5); // wait for five secondsheader("Location: http://www.example.com"); // redirects you to example.com[/code]im still new to this myself, but the above code works with a pause :p Quote Link to comment https://forums.phpfreaks.com/topic/13174-php-redirecting-users/#findComment-50685 Share on other sites More sharing options...
redarrow Posted June 29, 2006 Share Posted June 29, 2006 [!--quoteo(post=389115:date=Jun 29 2006, 05:08 AM:name=Dville)--][div class=\'quotetop\']QUOTE(Dville @ Jun 29 2006, 05:08 AM) [snapback]389115[/snapback][/div][div class=\'quotemain\'][!--quotec--]good point[code]sleep(5); // wait for five secondsheader("Location: http://www.example.com"); // redirects you to example.com[/code]im still new to this myself, but the above code works with a pause :p[/quote]sleep is not part of header but corect flashee lol Quote Link to comment https://forums.phpfreaks.com/topic/13174-php-redirecting-users/#findComment-50690 Share on other sites More sharing options...
PC Nerd Posted June 29, 2006 Author Share Posted June 29, 2006 Thanks Now i want to do a login page. Once the page opens it is sent login info. From there it connects to a databse, creates cookies and then relocates. If i use the header...... will the script still run through the db connect etc.?????thanks for your previous replys, they'r rally halping Quote Link to comment https://forums.phpfreaks.com/topic/13174-php-redirecting-users/#findComment-50699 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.