Skip to content

Instantly share code, notes, and snippets.

@le717
Last active January 21, 2022 21:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save le717/39abf54581302440a011286cb75d71b6 to your computer and use it in GitHub Desktop.
Save le717/39abf54581302440a011286cb75d71b6 to your computer and use it in GitHub Desktop.
<?php
function makeSQLsafe($sql_input) {
$sql_input = str_replace("'","\\'",stripslashes($sql_input));
$sql_input = str_replace('"','\\"',$sql_input);
$sql_input = str_replace(';','\\;',$sql_input);
//$sql_input = str_replace('%','\\%',$sql_input);
//$sql_input = str_replace('_','\\_',$sql_input);
$sql_input = str_replace("&","&amp\\;",$sql_input);
$sql_input = str_replace("<","&lt\\;",$sql_input);
$sql_input = str_replace(">","&gt\\;",$sql_input);
return $sql_input;
}
function makeSQLsafe($sql_input) {
$sql_input = str_replace("'","",stripslashes($sql_input));
$sql_input = str_replace("&","&amp;",$sql_input);
$sql_input = str_replace("<","&lt;",$sql_input);
$sql_input = str_replace(">","&gt;",$sql_input);
$sql_input = str_replace("`","",$sql_input);
/*$sql_input = str_replace("�","&#198;",$sql_input);
$sql_input = str_replace("�","&#233;",$sql_input);*/
return $sql_input;
}
function makeSQLsafe($sql_input) {
$sql_input = mysql_real_escape_string($sql_input);
#$sql_input = str_replace("'","\\'",stripslashes($sql_input));
#$sql_input = str_replace('"','\\"',$sql_input);
#$sql_input = str_replace(';','\\;',$sql_input);
//$sql_input = str_replace('%','\\%',$sql_input);
//$sql_input = str_replace('_','\\_',$sql_input);
#$sql_input = str_replace("&","&amp\\;",$sql_input);
#$sql_input = str_replace("<","&lt\\;",$sql_input);
#$sql_input = str_replace(">","&gt\\;",$sql_input);
return $sql_input;
}
function makeSQLsafe($sql_input) {
$sql_input = mysql_real_escape_string($sql_input);
return $sql_input;
}
function makeSQLsafe($sql_input) {
$sql_input = str_replace("'","\\'",stripslashes($sql_input));
$sql_input = str_replace('"','\\"',$sql_input);
$sql_input = str_replace(';','\\;',$sql_input);
$sql_input = str_replace('%','\\%',$sql_input);
$sql_input = str_replace('_','\\_',$sql_input);
$sql_input = str_replace("&","&amp\\;",$sql_input);
$sql_input = str_replace("<","&lt\\;",$sql_input);
$sql_input = str_replace(">","&gt\\;",$sql_input);
return $sql_input;
}
function makeSQLsafe($sql_input)
{
$sql_input = str_replace("'", "", stripslashes($sql_input));
$sql_input = str_replace("&", "&amp;", $sql_input);
$sql_input = str_replace("<", "&lt;", $sql_input);
$sql_input = str_replace(">", "&gt;", $sql_input);
$sql_input = str_replace("`", "", $sql_input);
$sql_input = str_replace("�", "&#198;", $sql_input);
$sql_input = str_replace("�", "&#233;", $sql_input);
return $sql_input;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment