installssl.php 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. include_once('tpl/header.php');
  3. $host = $_SERVER['HTTP_HOST'].$_SERVER["REQUEST_URI"];
  4. $host = "http://".str_replace("installssl.php","",$host)."functions/method.php?type=select_ssl";
  5. $selectssl = file_get_contents($host);
  6. ?>
  7. <div class="layui-container" style = "margin-top:40px;">
  8. <div class="layui-row">
  9. <div class="layui-col-lg10 layui-col-md-offset1">
  10. <!--提示-->
  11. <div>
  12. <pre class="layui-code">请在下方填写需要启用SSL的站点,域名不需要包含http://,如果您的网站调用了http链接,强制HTTPS会导致网站异常。</pre>
  13. </div>
  14. <!--提示END-->
  15. <!--表单-->
  16. <div id="" style = "margin-top:40px;">
  17. <form class="layui-form" action="">
  18. <div class="layui-form-item">
  19. <label class="layui-form-label">域名</label>
  20. <div class="layui-input-block">
  21. <input type="text" id="domain" required lay-verify="required" placeholder="输入要启用SSL的域名" autocomplete="off" class="layui-input">
  22. </div>
  23. </div>
  24. <div class="layui-form-item">
  25. <label class="layui-form-label">选择证书</label>
  26. <div class="layui-input-block">
  27. <select id = "cert" lay-verify="required">
  28. <?php echo $selectssl; ?>
  29. </select>
  30. </div>
  31. </div>
  32. <div class="layui-form-item">
  33. <label class="layui-form-label">强制HTTPS</label>
  34. <div class="layui-input-block">
  35. <input type="checkbox" name="switch" lay-skin="switch" id = "https">
  36. </div>
  37. </div>
  38. </form>
  39. <div class="layui-form-item">
  40. <div class="layui-input-block">
  41. <button class="layui-btn" lay-filter="formDemo" id = "btn">保存</button>
  42. <!--<button type="reset" class="layui-btn layui-btn-primary">重置</button>-->
  43. </div>
  44. </div>
  45. </div>
  46. <!--表单END-->
  47. </div>
  48. </div>
  49. </div>
  50. <script>
  51. layui.use(['form','element'], function(){
  52. var form = layui.form;
  53. });
  54. $(document).ready(function(){
  55. //$.get("./functions/method.php?type=select_ssl",function(data,status){
  56. // $("#cert").append(data);
  57. //});
  58. $("title").empty();
  59. $("title").append("部署SSL证书");
  60. $("#btn").click(function(){
  61. //alert('dsds');
  62. var domain = $("#domain").val();
  63. var sslid = $("#cert").val();
  64. //var https = $("#https").val();
  65. //是否强制SSL
  66. if ($("#https").get(0).checked) {
  67. var https = 1;
  68. }
  69. else {
  70. var https = 0;
  71. }
  72. $.post("./functions/method.php?type=add_site",{domain:domain,sslid:sslid,https:https},function(data,status){
  73. layer.open({
  74. title:'温馨提示',
  75. content:data,
  76. time:2000
  77. });
  78. });
  79. });
  80. });
  81. </script>
  82. <?php
  83. include_once('tpl/footer.php');
  84. ?>