Go Back   Cyber Tech Help Support Forums > Software > Web Development & Graphic Design

Notices

Reply
 
Topic Tools
  #1  
Old August 2nd, 2006, 07:27 PM
enat66's Avatar
enat66 enat66 is offline
CTH Subscriber
 
Join Date: Dec 2001
O/S: Windows Vista
Location: Wisconsin
Age: 19
Posts: 3,089
PHP & Hidden Form Values

So I've created a comment system for my school's newspaper website so users can add comments to the bottom of articles. It works fine except to prevent spam I was forced to use a multi-page form, passing the form data through hidden form values. The problem arises when a user adds a comment with a quotation mark.

ex:
Comment: Hi It's Enat

so on the next page the input rendered by the php is:
<input name='c' type='hidden' value='Hi It\'s Enat' />

Magic Quotes is on so it does add a slash, but that doesn't help
because the slash still ends the html value, though not the echo
statement that echo's the html. As you can see the stuff in
orange is not included.

What is the work around for this?
Thanks in Advance
__________________

Reply With Quote
  #2  
Old August 2nd, 2006, 09:18 PM
enat66's Avatar
enat66 enat66 is offline
CTH Subscriber
 
Join Date: Dec 2001
O/S: Windows Vista
Location: Wisconsin
Age: 19
Posts: 3,089
Well I've figured it out...or atleast a work around.
I'm now using cookieless sessions. Passing the SID from page to page. This way I don't have to deal with inputs.
__________________

Reply With Quote
  #3  
Old August 3rd, 2006, 10:15 AM
degsy's Avatar
degsy degsy is offline
Cyber Tech Help Moderator
 
Join Date: Jul 2001
Location: North-East, UK
Posts: 22,022
Blog Entries: 1
You should use double quotes for HTML values, attributes etc. It usually works out better that way.

If you want better security then have a login system or use some type of CAPTCHA system.
__________________
Cheers,
Degs

Please post back with your results
CTH Terms of Use

CTH Subscriptions :: Adaware Guide :: HijackThis
Reply With Quote
Reply

Bookmarks

Topic Tools

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
Forum Jump


All times are GMT +1. The time now is 03:13 PM.

[ RSS ]