1

I'm very new to php and this m first project but am stuck which this kind of error:

Notice: Undefined variable: magic_quotes_active in C:\wamp\www\mysite\includes\functions.php on line 16

HERE are my codes;

function mysqli_prep($value) {
   $magic_quotes_activen = get_magic_quotes_gpc();

   $new_enough_php = function_exists( "mysqli_real_escape_string");

   // i.e PHP >= V4.3.0

   if ($new_enough_php ) {// PHP V4.3.0 or higher

   // undo any magic quote effects so mysqli_real_escape_string can

   // do the work

   if( $magic_quotes_active ) {$value = stripslashes($value);}

   $value = mysqli_real_escape_string($value);

   } else {//before PHP V4.3.0

   // if magic quotes aren't already on then add slashes manually

   if(!$magic_quotes_active) { $value = addslashes($value);}

   // if magic quoes are active, then the slashes already exist
   }
   return $value;
JasonMArcher
  • 14,195
  • 22
  • 56
  • 52
malma
  • 19
  • 2

2 Answers2

0

You've declared the variable as $magic_quotes_activen but are referencing $magic_quotes_active. It's pretty clear in that PHP error message, too.

jlindenbaum
  • 1,891
  • 18
  • 28
0

Thank you for quick reply jlindenbaum,

I have seen that mistake and cleared it but now it still shows this

Warning: get_magic_quotes_gpc() expects exactly 0 parameters, 1 given in C:

and this

Warning: mysqli_real_escape_string() expects exactly 2 parameters, 1 given in C

malma
  • 19
  • 2