Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Feb 2009
    Location
    Texas
    Posts
    56
    Thanks
    6
    Thanked 3 Times in 3 Posts

    get_magic_quotes_gpc?

    I am teaching myself php with a book, and the book explains everything pretty well except for this snippet of code:

    PHP Code:
    if (get_magic_quotes_gpc()){
         
    $qstring =  stripslashes($qstring);
    }
    $qstring mysql_real_escape_string($qstring
    Can anybody explain what this does or what it is used for to me?
    Free PSD to XHTML/CSS conversion - Dimby.net
    Which doctype should I use?

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,865
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    Try to follow GPC Stripping Tutorial by Fou-lu
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    Senior Coder NancyJ's Avatar
    Join Date
    Feb 2005
    Location
    Bradford, UK
    Posts
    3,174
    Thanks
    19
    Thanked 66 Times in 65 Posts
    PHP Code:
    //if magic quotes are turned on (automatically adds slashes to $_POST/$_GET etc data)
    if (get_magic_quotes_gpc()){
    //remove the slashes
         
    $qstring =  stripslashes($qstring);
    }
    // use mysql_real_escape_string to escape data - more advanced/secure than simply doing addslashes() which is essentially what magic quotes does
    $qstring mysql_real_escape_string($qstring


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •