PDA

View Full Version : Is there a php or vbulletin function that will


amykhar
08-18-2005, 08:11 PM
strip any character out of a string that can't be in a url?

Amy

Marco van Herwaarden
08-18-2005, 08:16 PM
html_specialcharacters? or do you want to have them really removed?

Zero Tolerance
08-18-2005, 09:09 PM
I think she means strip any character of a string that would cause it to be invalid URL, i'd personally just bash the string against a function to check the string is a valid URL in the first place.

- Zero Tolerance

amykhar
08-19-2005, 12:48 AM
What I'm trying to do is remove spaces and punctuation and anything goofy from a string that would make it mess up a url if I were to put the string in a url.

I know I can use eregi, but figured there might be a standard function designed for this.

For example, given "Amy's Wonderful Userpage Hack", it would return, AmysWonderfulUserpageHack

no apostrophes and no spaces.

Amy

AN-net
08-19-2005, 01:41 AM
i thought i saw once in functions_newpost.php(3.0.x) something about sanitize url>_>

amykhar
08-19-2005, 01:59 AM
What about this one? urlencode() I think that puppy may do what I need.

Amy

amykhar
08-19-2005, 02:13 AM
I'm going to look at sanitize url and see if it's any better. I'm not crazy about the looks of this:

http://www.eaforums.com/forums/quiz/Art+and+Artists+Quizzes/116-Renaissance+Artists.htm

amykhar
08-19-2005, 04:53 AM
I ended up going with str_replace and defining the characters that I wanted stripped:

http://www.eaforums.com/forums/quiz/MiscQuizzes/70-AQuizYouHAVEtoLookuptheAnswersFor.htm

sabret00the
08-19-2005, 10:19 AM
What about this one? urlencode() I think that puppy may do what I need.

Amy

that's the one i woudl've gone with.