123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- <?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']);
- $siteid = $_GET['siteid'];
- $siteinfo = $database->get("s_site",["domain","sslid","https"],["id" => $siteid]);
- //开关按钮状态
- if($siteinfo['https'] == 1) {
- $isswitch = "checked";
- }
- if($siteinfo['https'] == 0) {
- $isswitch = "";
- }
-
- ?>
- <div class="layui-container" style = "margin-top:40px;">
- <div class="layui-row">
- <div class="layui-col-lg10 layui-col-md-offset1">
- <!--提示-->
- <div>
- <pre class="layui-code">请在下方填写需要启用SSL的站点,域名不需要包含http://,如果您的网站调用了http链接,强制HTTPS会导致网站异常。</pre>
- </div>
- <!--提示END-->
- <!--表单-->
- <div id="" style = "margin-top:40px;">
- <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="输入要启用SSL的域名" autocomplete="off" class="layui-input" value = "<?php echo $siteinfo['domain']; ?>">
- </div>
- </div>
- <div class="layui-form-item">
- <label class="layui-form-label">强制HTTPS</label>
- <div class="layui-input-block">
- <input type="checkbox" name="switch" lay-skin="switch" id = "https" <?php echo $isswitch; ?>>
- </div>
- </div>
- </form>
- <div class="layui-form-item">
- <div class="layui-input-block">
- <button class="layui-btn" lay-filter="formDemo" id = "btn">保存</button>
- <!--<button type="reset" class="layui-btn layui-btn-primary">重置</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("是否强制HTTPS?");
- $("#btn").click(function(){
- //alert('dsds');
- var domain = $("#domain").val();
- var siteid = <?php echo $siteid; ?>
-
- //是否强制SSL
- if ($("#https").get(0).checked) {
- var https = 1;
- }
- else {
- var https = 0;
- }
-
- $.post("./functions/method.php?type=update_site",{domain:domain,siteid:siteid,https:https},function(data,status){
- layer.open({
- title:'温馨提示',
- content:data,
- time:2000
- });
- });
- });
- });
- </script>
|