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
Jay
Forum Newbie
Posts: 22 Joined: Fri Jul 12, 2002 8:36 am
Location: KUL, Malaysia
Post
by Jay » Sat Oct 12, 2002 7:13 pm
i am preparing a regular expression pattern to
exclude the following characters in submitted URLS, please feel free to add to this list?
Code: Select all
var $chars = '\r\n \t\x0B<>''"\\]\\ї'; // characters to exclude in URLs
Thank you.
rev
Forum Commoner
Posts: 52 Joined: Wed Oct 02, 2002 3:58 pm
Location: Atlanta, GA
Post
by rev » Sat Oct 12, 2002 9:31 pm
Takuma
Forum Regular
Posts: 931 Joined: Sun Aug 04, 2002 10:24 am
Location: UK
Contact:
Post
by Takuma » Sun Oct 13, 2002 2:56 am
You won't be able to use <, > etc. in URL anyway, it's gets encoded...
hob_goblin
Forum Regular
Posts: 978 Joined: Sun Apr 28, 2002 9:53 pm
Contact:
Post
by hob_goblin » Sun Oct 13, 2002 12:41 pm
No, he's talking about something like an input in a form
Because i could easily just input:
Code: Select all
http://somesite.com/">okay</a><script><!-- bad script here -->
But heres how i'd do it.
Code: Select all
if(!preg_match('(http://ї-a-zA-Z0-9@:%_\+.~#?&//=]+)', $string)){
die('Invalid input');
}