人人商城

az.func.php 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. /**
  3. * [源码小铺授权系统 System] Copyright (c) 2018 itplume.com
  4. */
  5. defined('IN_IA') or exit('Access Denied');
  6. function get_file($url,$name,$folder = './') {
  7. set_time_limit((24 * 60) * 60);
  8. $destination_folder = $folder . '/';
  9. $newfname = $destination_folder.$name;
  10. $file = fopen($url, 'rb');
  11. if ($file) {
  12. $newf = fopen($newfname, 'wb');
  13. if ($newf) {
  14. while (!feof($file)) {
  15. fwrite($newf, fread($file, 1024 * 8), 1024 * 8);
  16. }
  17. }
  18. }
  19. if ($file) {
  20. fclose($file);
  21. }
  22. if ($newf) {
  23. fclose($newf);
  24. }
  25. return true;
  26. }
  27. function runquery($sql) {
  28. $file_path = $sql;
  29. if(file_exists($file_path)){
  30. if($fp=fopen($file_path,"a+")){
  31. $buffer=1024;
  32. $str="";
  33. while(!feof($fp)){
  34. $str.=fread($fp,$buffer);
  35. }
  36. }
  37. }
  38. $query = $str;
  39. pdo_run($query);
  40. }
  41. function deldir($dir) {
  42. $dh=opendir($dir);
  43. while ($file=readdir($dh)) {
  44. if($file!="." && $file!="..") {
  45. $fullpath=$dir."/".$file;
  46. if(!is_dir($fullpath)) {
  47. unlink($fullpath);
  48. } else {
  49. deldir($fullpath);
  50. }
  51. }
  52. }
  53. closedir($dh);
  54. if(rmdir($dir)) {
  55. return true;
  56. } else {
  57. return false;
  58. }
  59. }