Hello everyone, I'm sorry I havent posted in such a long time. I've been busy with coding, going out, managing a DC hub etc... Do you still remember me? 🙂

Anyway, ive recoded my CMS (again) this time its much more efficient but im faced with a few problems.

First problem is, I need to turn off magic_quotes or whatever it is called. I need to do this because I already have a script doing it:

<?
foreach($_POST as $title => $val){
	$_POST[$title] = addslashes($val);
}
?>

Secondly, this isnt really a php question but when I add something that has " or ' in the title (Or anything that would be later displayed in an input box) is goes wrong 😛 Is there anyway to "escape" the " and ' in HTML?

Thanks in advance, Atomiku.

    php.ini houses the option u desire to toggle

    ::coughs:: google ::coughs::

    if you googled the title of this thread youd've found that answer 😃

      okay, but I need to turn of magic quotes within the code. not from php.ini

      Edit: Nevermind, ive found more logical way of doing it:

      <?
      if(get_magic_quotes_gpc() != 1){
      	foreach($_POST as $title => $val){
      		$_POST[$title] = addslashes($val);
      	}
      }
      ?>
      

        Example 31-2. Disabling magic quotes at runtime

        <?php
        if (get_magic_quotes_gpc()) {
           function stripslashes_deep($value)
           {
               $value = is_array($value) ?
                           array_map('stripslashes_deep', $value) :
                           stripslashes($value);
        
           return $value;
           }
        
           $_POST = array_map('stripslashes_deep', $_POST);
           $_GET = array_map('stripslashes_deep', $_GET);
           $_COOKIE = array_map('stripslashes_deep', $_COOKIE);
        }
        ?>
        

        directly from php.net: here

          You might want to chuck $REQUEST and $SERVER into that function if you'll use them.

            Write a Reply...