Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. function protect( &$str ) {
  2. if( !is_array( $str ) ) {
  3. $str = preg_replace( '/(from|select|insert|delete|where|drop|union|order|update|database)/i', '', $str );
  4. $str = preg_replace( '/(<|<)?script(/?(>|>(.*))?)/i', '', $str );
  5. $tbl = get_html_translation_table( HTML_ENTITIES );
  6. $tbl = array_flip( $tbl );
  7. $str = addslashes( $str );
  8. $str = strip_tags( $str );
  9. return strtr( $str, $tbl );
  10. } else {
  11. return array_filter( $str, "protect" );
  12. } }
  13.  
  14. session_start();
  15. $login = protect($_SESSION['login']));
  16. $senha = protect($_SESSION['senha']));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement