Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Injection Prevention - Is this shooting for the heart?

Status
Not open for further replies.

DigitalBuilder

Programmer
Apr 7, 2005
33
NZ

<?
function pstr($Name) {
global $$Name;
if (!empty($$Name)) {
return str_replace("'","''",$$Name);
}
if (!empty($_GET[$Name])) {
return str_replace("'","''",$_GET[$Name]);
}
elseif (!empty($_POST[$Name])) {
return str_replace("'","''",$_POST[$Name]);
}
else { return null; }
}
?>

<?
function pint($Name) {
global $$Name;
if (!empty($$Name)) {
if (is_numeric($$Name)) {
return $$Name;
}
else {
die(pintMailError());
}
}
elseif (!empty($_GET[$Name])) {
if (is_numeric($_GET[$Name])) {
return $_GET[$Name];
}
else {
die(pintMailError());
}
}
elseif (!empty($_POST[$Name])) {
if (is_numeric($_POST[$Name])) {
return $_POST[$Name];
}
else {
die(pintMailError());
}
}
else { return null; }
}
?>
 
It's ideas to control SQL Injection at the root source: where its injected
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top