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.

Coding Forum


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



Reply
Help with PHP and SQL Input fliter!
Old 03-28-2003, 02:31 PM Help with PHP and SQL Input fliter!
X-Ray5's Avatar
Novice Talker

Posts: 8
Location: RI
Trades: 0
Hey all I'm working on a quote script in PHP, it uses SQL. I'm making it in dreamweaver. My question is how would I go about flitering what people can input. For example I was people to NOT be about to post any html tags. Here is the sudo code...

If Quote = *<*>* then
Print = Sorry no HTML tags!
Else
Print Quote to database
End If

I'm not to good with PHP and I have not found time to pick up a book and start to become better at it so if someone could help me out or link me to a place that can tell me how to do this I would be gratefull. Thanks, here is my site http://rhs.zapto.org go to quotes.
X-Ray5 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-28-2003, 02:53 PM
shneak's Avatar
Average Talker

Posts: 24
Location: South UK
Trades: 0
Hmm you could always try htmlspecialchars() - it's a string function in PHP that replaces HTML characters like < with codes like &lt;.

To use it:

$inputString = htmlspecialchars($inputString);

then you can just go ahead and add it to your database. If you want to check to see if anything's changed (ie: if there is HTML in the post):

$htmlString = htmlspecialchars($inputString);
if($htmlString != $inputString){
echo "There is HTML in the string";
} else {
echo "There is no HTML in the string";
}

I hope this helps,
Dan
__________________
------------------------------------------
Dan - www.shneak.com
shneak is offline
Reply With Quote
View Public Profile Visit shneak's homepage!
 
Reply     « Reply to Help with PHP and SQL Input fliter!
 

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.19354 seconds with 12 queries