auth.php 846 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. #设置所有的用户名密码,前面是用户名,后面是对应密码
  3. $alluser=[
  4. "user1"=>"pass1",
  5. "user2"=>"pass2",
  6. "user3"=>"pass3",
  7. "user4"=>"pass4",
  8. ];
  9. $proxy_ip=$_GET['local_addr'];
  10. $user_ip=$_GET['client_addr'];
  11. $service=$_GET['service'];
  12. $is_sps=$_GET['sps']=='1';
  13. $user=$_GET['user'];
  14. $pass=$_GET['pass'];
  15. $target=$_GET['target'];
  16. //业务逻辑判断
  17. //....
  18. $ok=false;
  19. foreach ($alluser as $dbuser => $dbpass) {
  20. if ($user==$dbuser&&$pass==$dbpass){
  21. $ok=true;
  22. break;
  23. }
  24. }
  25. //设置认证结果
  26. if($ok){
  27. header("userconns:1000");
  28. header("ipconns:2000");
  29. //header("userrate:3000");
  30. //header("iprate:8000");
  31. //header("UPSTREAM:http://127.0.0.1:3500?parent-type=tcp");
  32. header("HTTP/1.1 204 No Content");
  33. }