";
}
//////email converter -- use option 1 for Paypal
//1 - Converts all characters to the nnn; format;
//2 - Replaces @ with ' at ' and . with ' dot ';
//3 - Does 2 and then 1.
//$convertedEmail = convertEmail ("fred@bloggs.com", 1);
function convertEmail ($email, $type) {
switch ($type) {
case 2 :
case 3 :
$emailConv = str_replace (".", " dot ", $email);
$emailConv = str_replace ("@", " at ", $emailConv);
if ($type == 2)
break;
$email = $emailConv;
$emailConv = "";
default :
for ($i = 0; $i < strlen ($email); $i++)
$emailConv .= sprintf ("%03d;", ord ($email{$i}));
}
return $emailConv;
}
// escaping and slashing all POST and GET variables. you may add $_COOKIE and $_REQUEST if you want them sanitized.
array_walk_recursive($_POST, 'sanitizeVariables');
array_walk_recursive($_GET, 'sanitizeVariables');
// sanitization
function sanitizeVariables(&$item, $key)
{
if (!is_array($item))
{
// undoing 'magic_quotes_gpc = On' directive
if (get_magic_quotes_gpc())
$item = stripcslashes($item);
$item = sanitizeText($item);
}
}
// does the actual 'html' and 'sql' sanitization. customize if you want.
function sanitizeText($text)
{
$text = str_replace("<", "<", $text);
$text = str_replace(">", ">", $text);
$text = str_replace("\"", """, $text);
$text = str_replace(chr(145), """, $text);
$text = str_replace(chr(148), """, $text);
$text = str_replace(chr(151), """, $text);
$text = str_replace(chr(146), "‘", $text);
$text = str_replace(chr(147), "’", $text);
$text = str_replace("'", "'", $text);
// it is recommended to replace 'addslashes' with 'mysql_real_escape_string' or whatever db specific fucntion used for escaping. However 'mysql_real_escape_string' is slower because it has to connect to mysql.
$text = addslashes($text);
//echo "
$text";
return $text;
}
// export POST variables as GLOBALS. remove if you want
foreach (array_keys($_POST) as $ehsanKey)
$GLOBALS[$ehsanKey] = $_POST[$ehsanKey];
// export GET variables as GLOBALS. remove if you want
foreach (array_keys($_GET) as $ehsanKey)
{
$GLOBALS[$ehsanKey] = $_GET[$ehsanKey];
}
// preventing the key used above for iteration from getting into globals (in case 'register_globals = On')
unset($ehsanKey);
// the reverse function of 'sanitizeText'. you may use it in pages which need the original data (e.g. for an HTML editor)
function unsanitizeText($text)
{
$text = stripcslashes($text);
$text = str_replace("'", "'", $text);
$text = str_replace(">", ">", $text);
$text = str_replace(""", "\"", $text);
$text = str_replace("<", "<", $text);
return $text;
}
( ! ) SCREAM: Error suppression ignored for ( ! ) Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /mnt/home/j105.org/public_html/fleet14/racing/nbc_standings.php on line 9 ( ! ) Error: Call to undefined function mysql_connect() in /mnt/home/j105.org/public_html/fleet14/racing/nbc_standings.php on line 9 Call Stack # Time Memory Function Location 1 0.0041 387440 {main}( ) .../nbc_standings.php:0