Redirection script not working properly - and I know why

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
waradmin
Forum Contributor
Posts: 240
Joined: Fri Nov 04, 2005 2:57 pm

Redirection script not working properly - and I know why

Post by waradmin »

I am trying to create a simple redirect script. It works in may cases, except for if the URL being redirected to contains a ?. That fails because the script looks for a URL after index.php?u=SOMEURL but stops when it reaches another question mark.

IE:

Code: Select all

http://someurl.com/?u=http://www.gooogle.com
redirects just fine, however this fails:

Code: Select all

http://someurl.com/?u=http://www.takemehere.com/index.php?page=home&cash=MONEY!
Is there a way to only read what is after the first ? (ie the $_GET['u'] value) and capture the entire thing, and not stop at the next ? or & symbol? I feel noobish asking all these questions but I busted out the php books and found nada.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

Post Reply