| | |
what exactly does this do?
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jun 2005
Posts: 20
Reputation:
Solved Threads: 0
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);
}
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]
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]
Class Info:
Warrior Priest | Bright Wizard |Witch Hunter | Rune Priest |Engineer | Hammerer |Ironbreaker | Black Orc |Orc Choppa | Goblin Shaman |Squig Herder | Chosen |Magus | Zealot | Marauder
Warrior Priest | Bright Wizard |Witch Hunter | Rune Priest |Engineer | Hammerer |Ironbreaker | Black Orc |Orc Choppa | Goblin Shaman |Squig Herder | Chosen |Magus | Zealot | Marauder
![]() |
Other Threads in the PHP Forum
- Previous Thread: php error HELP!!!
- Next Thread: file download links script
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array basic beginner binary bounce broken cakephp checkbox class cms code computing confirm cron curl database date delete directory display domain download dynamic echo email error file files folder form forms function functions google href htaccess html image include indentedsubcategory insert integration ip java javascript joomla limit link load login loop mail malfunction menu mlm mod_rewrite multiple mysql oop parse paypal pdf php problem query radio random recursion regex remote return script search server sessions sms soap source space sql structure syntax system table tutorial update upload url validation validator variable video web xml youtube





