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 5 of 5
  1. #1
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,863
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts

    problem with set_magic_quotes_runtime(1)

    Hi all,
    For some reason I've to run set_magic_quotes_runtime(1)(I know the risk), but it doesn't work in my server.
    For the code
    PHP Code:
    print 'get_gpc : '.ini_get("magic_quotes_gpc");
    print 
    '<br/>set mq : '.set_magic_quotes_runtime(1);
    print 
    '<br/>get mq : '.get_magic_quotes_gpc(void); 
    gives
    Code:
    get_gpc : 1
    set mq : 1
    get mq : 1
    in my local server, but
    Code:
    get_gpc :
    set mq : 1
    get mq : 0
    in my original server.
    Any Ideas?

    thanks,
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #2
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    magic_quotes_runtime and magic_quotes_gpc are two different things. You might be looking for get_magic_quotes_runtime(), but it is being turned on according to your output:
    PHP Code:
    print '<br/>set mq : '.set_magic_quotes_runtime(1); // set mq : 1 is returned 

  • Users who have thanked Inigoesdr for this post:

    abduraooft (12-28-2007)

  • #3
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,863
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    Thanks, For the time being,I solved out by writing a foreach loop on all POST values to addslashes.
    (And started to rewrite the entire code )
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #4
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,107
    Thanks
    2
    Thanked 326 Times in 318 Posts
    I believe I saw posted comments from a php.net meeting where magic quotes have been removed in php6. Don't depend on magic quotes to do anything in your code for you as your code will probably stop working and need to be rewritten under php6.

    See this link (and the link to the php.net address it contains) - http://www.bhsdesign.com/forums.php?m=posts&p=9087

    magic quotes was another lazy way short cut, like register globals, of getting the php language to do something that the programmer should have been doing himself and only when he wanted it to be done that have caused more problems and wasted code to detect and work-a-round than what they were worth.

    If you are using a database, you should be using mysql_real_escape_string() instead of addslashes().
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • Users who have thanked CFMaBiSmAd for this post:

    abduraooft (12-28-2007)

  • #5
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,863
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    Thanks, that's an eye opener and I've gone through various links like
    addslashes() vs mysql_real_escape_string()...the final debate PHP and their sublinks. All of them will definitely help me to improve in these areas.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)


  •  

    Posting Permissions

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