Jump to content


Photo

Php Redirecting Users


  • Please log in to reply
8 replies to this topic

#1 PC Nerd

PC Nerd
  • Members
  • PipPipPip
  • Advanced Member
  • 1,122 posts
  • LocationAustralia

Posted 29 June 2006 - 03:34 AM

hey guys


i 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.

#2 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 29 June 2006 - 04:10 AM



<?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 homepage
echo '<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>';
?>
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#3 Dville

Dville
  • Members
  • PipPipPip
  • Advanced Member
  • 88 posts

Posted 29 June 2006 - 04:39 AM

you could also use this. . .much smaller code, and imo a bit cleaner code

header("Location: http://www.example.com");


#4 PC Nerd

PC Nerd
  • Members
  • PipPipPip
  • Advanced Member
  • 1,122 posts
  • LocationAustralia

Posted 29 June 2006 - 04:43 AM

cool thanks

so wats the difference between location: and src = .......


Which one should i use???


Thanks again

#5 Dville

Dville
  • Members
  • PipPipPip
  • Advanced Member
  • 88 posts

Posted 29 June 2006 - 04:45 AM

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

#6 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 29 June 2006 - 04:51 AM

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.
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#7 Dville

Dville
  • Members
  • PipPipPip
  • Advanced Member
  • 88 posts

Posted 29 June 2006 - 05:08 AM

good point

sleep(5); // wait for five seconds
header("Location: http://www.example.com"); // redirects you to example.com

im still new to this myself, but the above code works with a pause :P

#8 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 29 June 2006 - 05:26 AM

[!--quoteo(post=389115:date=Jun 29 2006, 05:08 AM:name=Dville)--][div class=\'quotetop\']QUOTE(Dville @ Jun 29 2006, 05:08 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
good point

sleep(5); // wait for five seconds
header("Location: http://www.example.com"); // redirects you to example.com

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
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#9 PC Nerd

PC Nerd
  • Members
  • PipPipPip
  • Advanced Member
  • 1,122 posts
  • LocationAustralia

Posted 29 June 2006 - 05:49 AM

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users