+ Reply to Thread
Results 1 to 6 of 6

Thread: Small errors with feedback section

  1. #1
    drf1229 is offline x10Hosting Member drf1229 is an unknown quantity at this point
    Join Date
    Jun 2009
    Posts
    71

    Small errors with feedback section

    On my website (http://www.algebrahelper.x10hosting.com) I made a user feedback section where people can place their feedback onto a page of the website. It works like this: The feedback page is a file that gets edited each time a user submits feedback using PHP's fread and fwrite. This works fine, but I just have one problem. Whenever somebody submits a symbol, such as " ' / , etc. it appears with a backslash infront of it. This isn't a huge problem but prohibits users from posting some html tags. How can I stop/fix this? Please tell me if more detail is needed. Thanks!

  2. #2
    kbjradmin's Avatar
    kbjradmin is offline x10 Elder kbjradmin is an unknown quantity at this point
    Join Date
    Feb 2008
    Location
    Washington State, USA
    Posts
    512

    Re: Small errors with feedback section

    you should probably look into htmlspecialchars.it turns certain characters into the html entities.

  3. #3
    gomarc's Avatar
    gomarc is offline x10 Elder gomarc is an unknown quantity at this point
    Join Date
    Oct 2007
    Location
    USA
    Posts
    511

    Re: Small errors with feedback section

    Try using the php string function stripslashes($str). It will give you a string with backslashes stripped off.

    Example #1 A stripslashes() example

    PHP Code:
    <?php
    $str 
    "Is your name O\'reilly?";

    // Outputs: Is your name O'reilly?
    echo stripslashes($str);
    ?>
    To learn more about stripslashes, go to http://us2.php.net/manual/en/function.stripslashes.php (example source)

  4. #4
    kbjradmin's Avatar
    kbjradmin is offline x10 Elder kbjradmin is an unknown quantity at this point
    Join Date
    Feb 2008
    Location
    Washington State, USA
    Posts
    512

    Re: Small errors with feedback section

    or you could do that, forgot about that one :]

  5. #5
    gomarc's Avatar
    gomarc is offline x10 Elder gomarc is an unknown quantity at this point
    Join Date
    Oct 2007
    Location
    USA
    Posts
    511

    Re: Small errors with feedback section

    LOL, kbjradmin suggestion will also work. (Seems we posted almost at same time!)
    Last edited by gomarc; 09-03-2009 at 05:46 PM.

  6. #6
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: Small errors with feedback section

    Just make sure you remove unsafe tags, such as <script>, <object>, <link>, <embed>, <style> &c, so your site isn't vulnerable to cross-site scripting.
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

+ Reply to Thread

Similar Threads

  1. Feedback Section
    By normaltusker in forum Off Topic
    Replies: 3
    Last Post: 09-15-2008, 07:17 AM
  2. Header Output Errors
    By jjpeacha in forum Programming Help
    Replies: 4
    Last Post: 09-14-2008, 06:56 PM
  3. PHP Media section
    By earnthenspend in forum Programming Help
    Replies: 5
    Last Post: 06-10-2008, 05:03 AM
  4. Ad Codes Errors
    By hahoozhafax in forum Free Hosting
    Replies: 1
    Last Post: 07-27-2005, 07:02 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers