12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <?php
- include_once('tpl/header.php');
- include_once('functions/medoo.php');
- include_once("config.php");
- $database = new medoo([
- 'database_type' => 'sqlite',
- 'database_file' => 'data/nssl.db3']);
- $cerid = $_GET['cerid'];
- $ssl = $database->get("s_cert",["domain","crt","key","time","note"],["id" => $cerid]);
- ?>
- <div class="layui-container" style = "margin-top:40px;margin-bottom:60px;">
- <div class="layui-row">
- <div class="layui-col-lg10 layui-col-md-offset1">
- <!--表单-->
- <div id="editssl">
- <form class="layui-form" action="">
- <div class="layui-form-item">
- <label class="layui-form-label">域名</label>
- <div class="layui-input-block">
- <input type="text" id="domain" readonly="readonly" required lay-verify="required" placeholder="请输证书对应的域名" autocomplete="off" class="layui-input" value = "<?php echo $ssl['domain']; ?>">
- </div>
- </div>
- <div class="layui-form-item layui-form-text">
- <label class="layui-form-label">.cer and .crt</label>
- <div class="layui-input-block">
- <textarea id="crt" placeholder="请将.cer和.crt内容复制到这里,.cer内容在前,.crt内容在后" class="layui-textarea" style = "height:200px;"><?php echo $ssl['crt']; ?></textarea>
- </div>
- </div>
- <div class="layui-form-item layui-form-text">
- <label class="layui-form-label">.key</label>
- <div class="layui-input-block">
- <textarea id="key" placeholder="请将.key内容复制到这里" class="layui-textarea" style = "height:200px;"><?php echo $ssl['key']; ?></textarea>
- </div>
- </div>
- <div class="layui-form-item">
- <label class="layui-form-label">备注</label>
- <div class="layui-input-block">
- <input type="text" id="note" placeholder="备注非必填" autocomplete="off" class="layui-input" value = "<?php echo $ssl['note']; ?>">
- </div>
- </div>
- </form>
- <div class="layui-form-item">
- <div class="layui-input-block">
- <button class="layui-btn" lay-filter="formDemo" id = "btn">更新</button>
- </div>
- </div>
- </div>
- <!--表单END-->
- </div>
- </div>
- </div>
- <?php
- include_once('tpl/footer.php');
- ?>
- <script>
- layui.use(['form','element'], function(){
- var form = layui.form;
- //监听提交
- });
- $(document).ready(function(){
- $("title").empty();
- $("title").append("编辑SSL证书");
- $("#btn").click(function(){
- var domain = $("#domain").val();
- var crt = $("#crt").val();
- var key = $("#key").val();
- var note = $("#note").val();
-
- $.post("./functions/method.php?type=update_ssl&cerid=<?php echo $cerid; ?>",{domain:domain,crt:crt,note:note,key:key},function(data){
- layer.open({
- title:'温馨提示',
- content:data,
- time:2000
- });
- });
- });
- $.get("./functions/method.php?type=update_ssl",function(data,status){
- $("#listssl").append(data);
- });
- });
- </script>
|