include.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. class QS{
  3. function getUsernameList(){
  4. $databasePath = "";
  5. if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
  6. $rootPath = "C:/AOB/";
  7. }else{
  8. $rootPath = "/etc/AOB/";
  9. }
  10. if (filesize("root.inf") > 0){
  11. //Use the special path instead.
  12. $rootPath = trim(file_get_contents("root.inf"));
  13. }
  14. $databasePath = $rootPath . "whitelist.config";
  15. $authdata = file_get_contents($databasePath);
  16. $usernameList = [];
  17. foreach(explode("\n",$authdata) as $value){
  18. array_push($usernameList,explode(",",$value)[0]);
  19. }
  20. array_pop($usernameList);
  21. return $usernameList;
  22. }
  23. function filepath($str){
  24. return '"'.explode("<and>",explode("file_request=../../",$str)[1])[0].'"';
  25. }
  26. function checkfileexist($str){
  27. $path = $this->filepath($str);
  28. $path = str_replace('"',"",$path);
  29. return file_exists($path) ? "true" : "false";
  30. }
  31. function arr2jsarr($arr){
  32. $str = "[";
  33. foreach($arr as $value){
  34. $str = $str.'"'.$value.'",';
  35. }
  36. $str = substr($str, 0, -1);
  37. $str = $str."]";
  38. return $str;
  39. }
  40. }