Jump to content
Addicted2 Romania
Aplicatiile pentru functia de "Helper" pentru serverul de Minecraft sunt deschise !

Anti injectie sript pentru DB


Guest Alex

Recommended Posts

Guest HackHunter

Majoritatea care siau facut server au fost hackati (injectati in DB) care iau distrus conturile si site-ul.

Am gasit un script pentru protejarea injectiilor in DB si care nu va afecta nimik. Nu este creatia mea ... Am luato de la =Master= care si el a luat scriptul de la Savoy.

scriptul il puneti in index.php si dupa ce lati pus ii dati un run in ODBC si DONE. ;-)

Sper sa va fie de folos :-)

// Begin

/*

The muonline xweb base injection filter script

Mssql Injection Filter, Includes arrays

-----------------------------------------------------------------

Changelog: mu.vachev.net?mod=xweb

*/

function xw_sanitycheck($str){

if(strpos(str_replace("''",""," $str"),"'")!=false)

return str_replace("'", "''", $str);

else

return $str;

}

function secure($str){

// Case of an array

if (is_array($str)) {

foreach($str AS $id => $value) {

$str[$id] = secure($value);

}

}

else

$str = xw_sanitycheck($str);

return $str;

}

// Get Filter

$xweb_AI = array_keys($_GET);

$i=0;

while($i<count($xweb_AI)) {

$_GET[$xweb_AI[$i]]=secure($_GET[$xweb_AI[$i]]);

$i++;

}

unset($xweb_AI);

// Request Filter

$xweb_AI = array_keys($_REQUEST);

$i=0;

while($i<count($xweb_AI)) {

$_REQUEST[$xweb_AI[$i]]=secure($_REQUEST[$xweb_AI[$i]]);

$i++;

}

unset($xweb_AI);

// Post Filter

$xweb_AI = array_keys($_POST);

$i=0;

while($i<count($xweb_AI)) {

$_POST[$xweb_AI[$i]]=secure($_POST[$xweb_AI[$i]]);

$i++;

}

// Cookie Filter (do we have a login system?)

$xweb_AI = array_keys($_COOKIE);

$i=0;

while($i<count($xweb_AI)) {

$_COOKIE[$xweb_AI[$i]]=secure($_COOKIE[$xweb_AI[$i]]);

$i++;

}

// End

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing

    • No registered users viewing this page.
  • Popular Contributors

    Nobody has received reputation this week.

×
×
  • Create New...