Jump to content

Problems with magic_quotes_gpc


malma
Go to solution Solved by malma,

Recommended Posts

I'm using PHP 5.3.0 version, now i'm trying to escape quotes but I'm getting error which I don't know how solve. I'm very new to php and this is my first atempt to learn it. I'm asking for your help please.

 

These are my codes.

 

Fatal error: Call to undefined function get_magic_quotes_gps() in C:\wamp\www\widget\include\functions.php on line 4

function mysql_prep($value) {
    $magic_quotes_active = get_magic_quotes_gps();

    $new_enough_php = function_exists( "mysql_real_escape_string");

    // i.e PHP >= v4.3.0

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

    // undo any magic quotes effects so mysql_real_escape_string

    // can do the work

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

    $value = mysql_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 quotes aren't active, the the slashes already exist

    }

    return $value;

}

Edited by malma
Link to comment
Share on other sites

Read the error message more carefully. What function does it say is undefined?

 

UPGRADE!

Yes I can read and that but my problem is that I'm very new to php, i can't seem able to find the right way of defining that function, can you please help me to point out how I can do it

Link to comment
Share on other sites

  • Solution

you need to proof read your code. you have a spelling mistake in the function name. hint - php does not have a global positioning location function. 

Thank you very much for the help, i have seen what I had done wrong now it works

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.