Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
preg_match form security
Old 02-07-2010, 06:26 PM preg_match form security
Junior Talker

Posts: 1
Trades: 0
Hi all,

I hope somebody will be able to help me with my small preg_match pattern issue. It feels like I have been struggling for days with this and getting nowhere.

Its quite simple, I have a comment form on my site, there are some buttons so users can make text bold and italic a bold text would look like this: <span style="font-weight: bold;">something</span>

now I want to limit the form to not submit if the pattern is broken, like if the user tries to enter a hyperlink or something like that.

this is what I got so far. (I know its not much, but for now, it should validate only letters and numbers.

Code:
function validateEditorNEW($theinput,$description = ''){
$regmatchex = "/[^a-zA-Z0-9]+$/";
if (preg_match($regmatchex, $theinput)) {
   $this->errors[] = $description;
    return false;
} else {

    return true;
}
}
any suggestions?
jonespr is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-09-2010, 08:11 AM Re: preg_match form security
Experienced Talker

Posts: 41
Name: Adam B
Trades: 0
All you're doing there is checking for the string ending in a character other than a-z A-Z or 0-9. I don't really see what this has to do with broken hyperlinks or bold / italic tags?
adam89 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to preg_match form security
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.46451 seconds with 12 queries