api.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. // by 请勿倒卖,已申请软著,否则追究法律责任
  3. require "../system/db.class.php";
  4. header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
  5. header("Cache-Control: no-cache, must-revalidate");
  6. header("Pragma: no-cache");
  7. header("Content-type: text/html;charset=" . IN_CHARSET);
  8. header("Access-Control-Allow-Origin: " . (isset($_SERVER["HTTP_ORIGIN"]) ? $_SERVER["HTTP_ORIGIN"] : NULL));
  9. header("Access-Control-Allow-Credentials: true");
  10. $status = SafeRequest("status", "get");
  11. $site = SafeRequest("site", "get");
  12. $id = intval(SafeRequest("id", "get"));
  13. $sid = db("sign")->where("in_site", $site)->where("in_aid", $id)->value("in_id");
  14. if ($status < 2) {
  15. $ssl = SafeRequest("ssl", "get");
  16. $path = SafeRequest("path", "get");
  17. $ipa = SafeRequest("ipa", "get");
  18. $replace = SafeRequest("replace", "get");
  19. $charset = SafeRequest("charset", "get");
  20. $name = SafeRequest("name", "get");
  21. $cert = SafeRequest("cert", "get");
  22. $setarr = array("in_aid" => $id, "in_aname" => @convert_utf8($name, $charset), "in_replace" => $replace, "in_ssl" => $ssl, "in_site" => $site, "in_path" => $path, "in_ipa" => $ipa, "in_status" => 1, "in_cert" => $cert, "in_time" => time());
  23. if ($sid) {
  24. db("sign")->where(array("in_id" => $sid))->update($setarr);
  25. } else {
  26. db("sign")->insert($setarr);
  27. }
  28. echo "1";
  29. } else {
  30. if ($sid) {
  31. db("sign")->where(array("in_id" => $sid))->update(array("in_status" => 2, "in_time" => time()));
  32. echo "1";
  33. }
  34. }