safe.fun.php 870 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. function inject_check($sql_str)
  3. {
  4. return eregi('select|insert|update|delete|\'|\\/\\*|\\*|\\.\\.\\/|\\.\\/|union|into|load_file|outfile', $sql_str);
  5. }
  6. function verify($id = NULL, $type)
  7. {
  8. if (inject_check($id)) {
  9. write_msg('', $global[SiteUrl] . '/index.php');
  10. }
  11. $id = intval($id);
  12. $id = $id ? $id : $type;
  13. return $id;
  14. }
  15. function mymps_str_check($str)
  16. {
  17. $str = trim($str);
  18. if (!get_magic_quotes_gpc()) {
  19. $str = addslashes($str);
  20. }
  21. $str = str_replace('%', '\\%', $str);
  22. return $str;
  23. }
  24. function mymps_post_check($post)
  25. {
  26. if (!get_magic_quotes_gpc()) {
  27. $post = addslashes($post);
  28. }
  29. $post = str_replace('_', '\\_', $post);
  30. $post = str_replace('%', '\\%', $post);
  31. $post = htmlspecialchars($post);
  32. $post = str_replace('
  33. ', '<br>', str_replace(' ', '&nbsp;', $post));
  34. return $post;
  35. }
  36. if (!defined('IN_MYMPS')) {
  37. exit('FORBIDDEN');
  38. }
  39. ?>