The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Threaded View

Checking a location encode is safe

I've created two functions to use on a site that uses a "send to" variable (like you go to a logged in only page, which sends you to the log in page with a get variable of whatever that other page, so when you log in it sends you to the original page).

But i want to create a function that will validate the 'sendto' value as safe.

Not sure which way to go about it ? What's most effective ?

If it's with regular expressions i'm completely useless at them.
Would it be effective and just as fast to explode the whole thing and check each part bit by bit than to create one complex regular expression for it ?

Basicly i want to make sure there's no domain for anything on the page bit, and no file extention, then no dodgy stuff in the rest, and that it's all formed properly etc.

thanks ! : )

PS if you have any tips on improving the encode / decode functions that'd be wonderful ! ^^