954,587 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

what exactly does this do?

:?: 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);
}

nike123
Newbie Poster
20 posts since Jun 2005
Reputation Points: 10
Solved Threads: 0
 

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

Example:
[php]
<?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')";
?>
[/php]

YoungCoder
Junior Poster
193 posts since Aug 2004
Reputation Points: 13
Solved Threads: 2
 

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

nike123
Newbie Poster
20 posts since Jun 2005
Reputation Points: 10
Solved Threads: 0
 
leelee
Junior Poster in Training
77 posts since Aug 2005
Reputation Points: 31
Solved Threads: 1
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You