<?php
function qesc($s,$m) {
switch($m) {
case 0:
$s= str_replace("&" ,"&" ,$s);
return $s;
case 8:
$s= str_replace("&" ,"&" ,$s);
$s= str_replace("<" ,"<" ,$s);
$s= str_replace(">" ,">" ,$s);
return $s;
case 9:
$s= str_replace("&" ,"&" ,$s);
$s= str_replace("<" ,"<" ,$s);
$s= str_replace(">" ,">" ,$s);
$s= str_replace("\n ","<br> ",$s);
$s= str_replace("\n" ,"<br>",$s);
$s= str_replace("\t"," ",$s);
$s= str_replace(" " ," ",$s);
$s= str_replace(" " ," ",$s);
return $s;
case 1:
$s= str_replace("&" ,"&" ,$s);
$s= str_replace("'" ,"'",$s);
return $s;
case 2:
$s= str_replace("&" ,"&" ,$s);
$s= str_replace("\"",""",$s);
return $s;
case 3:
$s= str_replace("\\","\\\\" ,$s);
$s= str_replace("'" ,"\'" ,$s);
$s= str_replace("\n","\\n" ,$s);
$s= str_replace("\r","\\r" ,$s);
$s= preg_replace("/<\/(script)>/i","<\\u002F$1>",$s);
return $s;
case 4:
$s= str_replace("\\","\\\\" ,$s);
$s= str_replace("\"","\\\"" ,$s);
$s= str_replace("\n","\\n" ,$s);
$s= str_replace("\r","\\r" ,$s);
$s= preg_replace("/<\/(script)>/i","<\\u002F$1>",$s);
return $s;
case 5:
$s= str_replace("\\","\\\\" ,$s);
$s= str_replace("'" ,"\'" ,$s);
$s= str_replace("\n","\\n" ,$s);
$s= str_replace("\r","\\r" ,$s);
$s= str_replace("&" ,"&" ,$s);
$s= str_replace("\"",""",$s);
return $s;
case 6:
$s= str_replace("\\","\\\\" ,$s);
$s= str_replace("\"","\\\"" ,$s);
$s= str_replace("\n","\\n" ,$s);
$s= str_replace("\r","\\r" ,$s);
$s= str_replace("&" ,"&" ,$s);
$s= str_replace("'" ,"'",$s);
return $s;
case 7:
$s= mysql_real_escape_string($s);
return $s;
}
}
function Q_escape($s,$m) { return qesc($s,$m); }
?> |