Autor | Zpráva | ||
---|---|---|---|
Pan_snek Profil * |
#1 · Zasláno: 26. 10. 2008, 10:37:20
Zdravim,
myslíte si, že tato funkce dokonale ochrání sql dotazy a data před zneužitím, když vymažu hlavní kontrukční znaky pro sestavení dotazu ? function osetri($str) { $str=ereg_replace( "'", "", $str); $str=ereg_replace( "<", "", $str); $str=ereg_replace( ">", "", $str); $str=ereg_replace( "\"", "", $str); $str=ereg_replace( "--", "", $str); $str=ereg_replace( "select", "", $str); $str=ereg_replace( "SELECT", "", $str); $str=ereg_replace( "UNION", "", $str); $str=ereg_replace( "union", "", $str); $str=ereg_replace( "WHERE", "", $str); $str=ereg_replace( "where", "", $str); $str=ereg_replace( "=", "", $str); return $str; } Děkuji za názor případné vylepšení. |
||
Taps Profil |
#2 · Zasláno: 26. 10. 2008, 10:39:48
Pan_snek
není to zbytečně složité můžeš přece použít funkce jako je add_slashes, mysql_real_escape_string |
||
srigi Profil |
#3 · Zasláno: 26. 10. 2008, 11:48:44
Na cistenie inputu odporucam triedu input filter. Ta dokaze cistit dokonca jednotlive atributy u tagov. Cize mozes povolit tag <img>, povolit mu atribut src ale zakazat vsetky ostatne atributy.
|
||
Časová prodleva: 15 let
|
0