:?: Have tried to make sense of this, but am not quite sure what this !get_magic_quotes_pgc does, can someone please provide me with a simple expalnation of what it is, and why do i really need it. Please please please. Thanks. :lol:

if(!get_magic_quotes_gpc())
{
$title = addslashes($title);
$content = addslashes($content);
}

Recommended Answers

All 3 Replies

It returns the current configuration setting of magic_quotes_gpc (0 for off, 1 for on).

Example:

<?php
echo get_magic_quotes_gpc();        // 1
echo $_POST['lastname'];            // O\'reilly
echo addslashes($_POST['lastname']); // O\\\'reilly

if (!get_magic_quotes_gpc()) {
   $lastname = addslashes($_POST['lastname']);
} else {
   $lastname = $_POST['lastname'];
}

echo $lastname; // O\'reilly
$sql = "INSERT INTO lastnames (lastname) VALUES ('$lastname')";
?>

sorry am asking this again but, what is the magic_quotes_gpc? magic.... i don't know what it is, and what it does?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.