Tema: Chmod 777
Pogledajte određenu poruku
Staro 06. 03. 2011.   #10
webarto
expert
Grand Master
 
Avatar webarto
 
Datum učlanjenja: 11.04.2010
Poruke: 998
Hvala: 141
959 "Hvala" u 153 poruka
webarto is on a distinguished roadwebarto is on a distinguished roadwebarto is on a distinguished roadwebarto is on a distinguished roadwebarto is on a distinguished roadwebarto is on a distinguished roadwebarto is on a distinguished roadwebarto is on a distinguished road
Default

Kakav update, niti se SQL mjenjao niti PHP (ili šta već) koristiš...

PHP kôd:
function replace($string$type "an"$custom ""){
    switch(
$type){
        case 
"n"$regex "0-9"; break;
        case 
"a"$regex "a-zA-Z"; break;
        case 
"an"$regex "a-zA-Z0-9"; break;
    }
    return 
preg_replace("#([^$regex$custom]+)#is"""$string);
}

echo 
replace("x' OR 'x' = 'x"); // xORxx
echo replace("x' OR 'x' = 'x""a""\s"); // x OR x  x 
Za tekstualne inpute...

PHP kôd:
function escape($mixed){
    if(
is_array($mixed)){
        foreach(
$mixed as $key => $value){
            if(
is_array($value)){
                
$value escape($value);
            }else{
                
$value mysql_real_escape_string(htmlspecialchars($valueENT_QUOTES"UTF-8"));
            }
        }
    }else{
        
$mixed =  mysql_real_escape_string(htmlspecialchars($mixedENT_QUOTES"UTF-8"));
    }
return 
$mixed;

E sad ako nije tvoja aplikacija možeš da postaviš na DB klasu da pri upisu odradi nešto od ovoga, ako toga nema, možeš da se slikaš

Edit:

Kako se ispiti polažu :P http://webarto.com/39/sql-injection-example

Znači nema tu šta, blokiraš par ovih specijalnih znakova i ćao.

Poslednja izmena od webarto : 06. 03. 2011. u 01:03.
webarto je offline   Odgovorite uz citat