Created
December 29, 2010 19:27
-
-
Save drewlesueur/758936 to your computer and use it in GitHub Desktop.
A couple PHP utility functions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Disable magic quotes | |
if (get_magic_quotes_gpc()) { | |
$process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST); | |
while (list($key, $val) = each($process)) { | |
foreach ($val as $k => $v) { | |
unset($process[$key][$k]); | |
if (is_array($v)) { | |
$process[$key][stripslashes($k)] = $v; | |
$process[] = &$process[$key][stripslashes($k)]; | |
} else { | |
$process[$key][stripslashes($k)] = stripslashes($v); | |
} | |
} | |
} | |
unset($process); | |
} | |
function he($i) { | |
echo htmlspecialchars($i, ENT_QUOTES); | |
} | |
function h($i) { | |
return htmlspecialchars($i, ENT_QUOTES); | |
} | |
function empt($what) { | |
return $what !== 0 && $what !== '0' && empty($what); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment