editssl.php 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. include_once('tpl/header.php');
  3. include_once('functions/medoo.php');
  4. include_once("config.php");
  5. $database = new medoo([
  6. 'database_type' => 'sqlite',
  7. 'database_file' => 'data/nssl.db3']);
  8. $cerid = $_GET['cerid'];
  9. $ssl = $database->get("s_cert",["domain","crt","key","time","note"],["id" => $cerid]);
  10. ?>
  11. <div class="layui-container" style = "margin-top:40px;margin-bottom:60px;">
  12. <div class="layui-row">
  13. <div class="layui-col-lg10 layui-col-md-offset1">
  14. <!--表单-->
  15. <div id="editssl">
  16. <form class="layui-form" action="">
  17. <div class="layui-form-item">
  18. <label class="layui-form-label">域名</label>
  19. <div class="layui-input-block">
  20. <input type="text" id="domain" readonly="readonly" required lay-verify="required" placeholder="请输证书对应的域名" autocomplete="off" class="layui-input" value = "<?php echo $ssl['domain']; ?>">
  21. </div>
  22. </div>
  23. <div class="layui-form-item layui-form-text">
  24. <label class="layui-form-label">.cer and .crt</label>
  25. <div class="layui-input-block">
  26. <textarea id="crt" placeholder="请将.cer和.crt内容复制到这里,.cer内容在前,.crt内容在后" class="layui-textarea" style = "height:200px;"><?php echo $ssl['crt']; ?></textarea>
  27. </div>
  28. </div>
  29. <div class="layui-form-item layui-form-text">
  30. <label class="layui-form-label">.key</label>
  31. <div class="layui-input-block">
  32. <textarea id="key" placeholder="请将.key内容复制到这里" class="layui-textarea" style = "height:200px;"><?php echo $ssl['key']; ?></textarea>
  33. </div>
  34. </div>
  35. <div class="layui-form-item">
  36. <label class="layui-form-label">备注</label>
  37. <div class="layui-input-block">
  38. <input type="text" id="note" placeholder="备注非必填" autocomplete="off" class="layui-input" value = "<?php echo $ssl['note']; ?>">
  39. </div>
  40. </div>
  41. </form>
  42. <div class="layui-form-item">
  43. <div class="layui-input-block">
  44. <button class="layui-btn" lay-filter="formDemo" id = "btn">更新</button>
  45. </div>
  46. </div>
  47. </div>
  48. <!--表单END-->
  49. </div>
  50. </div>
  51. </div>
  52. <?php
  53. include_once('tpl/footer.php');
  54. ?>
  55. <script>
  56. layui.use(['form','element'], function(){
  57. var form = layui.form;
  58. //监听提交
  59. });
  60. $(document).ready(function(){
  61. $("title").empty();
  62. $("title").append("编辑SSL证书");
  63. $("#btn").click(function(){
  64. var domain = $("#domain").val();
  65. var crt = $("#crt").val();
  66. var key = $("#key").val();
  67. var note = $("#note").val();
  68. $.post("./functions/method.php?type=update_ssl&cerid=<?php echo $cerid; ?>",{domain:domain,crt:crt,note:note,key:key},function(data){
  69. layer.open({
  70. title:'温馨提示',
  71. content:data,
  72. time:2000
  73. });
  74. });
  75. });
  76. $.get("./functions/method.php?type=update_ssl",function(data,status){
  77. $("#listssl").append(data);
  78. });
  79. });
  80. </script>