杰奇cms章节页面报错功能实现,基本思路

2018-10-21T22:02:00

这是交流群里面一个群友提出来的问题,而网上的这种功能是手机端插件自带的,并不属于杰奇官方版的插件。然后今天简单的研究了一下,发现直接使用杰奇后台收件箱的功能是可行的,所以就随手写了一些代码。这些代码我没有做什么安全措施,仅提供一个大概的思路,具体的自己可以去完善一下。
注意:仅限杰奇1.7官方版哦,那些用手机端插件或者二次开发的应该是用不了的。
实际效果如下:


代码主要写在style.html,这是目录页模板
html代码如下,加在body标签:

<div class="toerrors">
    <div class="toerrors-main">
        <form action="/toerrors.php">
            <input type="text" class="e-book" name="e-book" value="问题反馈:{?$jieqi_title?}-{?$article_title?}">
            <textarea class="e-text" name="e-text" placeholder="输入错误内容"></textarea>
            <button class="e-sub">提交</button>
        </form>
    </div>
</div>

css代码如下,加在head标签:

<style>
.toerrors{position:fixed;
width:100%;
z-index:999;
height:160px;
top:25%;}
.toerrors-main{margin:0 auto;
height:160px;
width:280px;
padding:10px;
background:#fff;
border:solid 1px #ddd;
border-radius:4px;
-webkit-box-shadow:0 1px 5px rgba(0,0,0,.2);
box-shadow:0 1px 5px rgba(0,0,0,.2);}
.toerrors-main .e-book,.toerrors-main .e-text{display:block; margin:5px 0px;
width:260px;
padding:5px 10px;}
.toerrors-main .e-text{margin-top:15px;
height:60px;
resize:none;}
.toerrors-main .e-sub{display:block;
width:60px;
margin:10px auto 0px auto;
height:25px;
background:#d44653;
color:#fff !important;
border:none;
border-radius:4px;}
</style>

php代码,这里我创建了一个toerrors.php放在根目录:

<?php
$title = "";
$content = "";
$time = time();;
if($_GET['e-book']){
    $title = $_GET['e-book'];
    $content = $_GET['e-text'];
    require_once("configs/define.php");
    @mysql_connect(constant("JIEQI_DB_HOST"), constant("JIEQI_DB_USER"),constant("JIEQI_DB_PASS"));  
    @mysql_query("SET NAMES 'gbk'");
    @mysql_select_db(constant("JIEQI_DB_NAME"));
    $sql=@mysql_query("INSERT INTO `jieqi_system_message` (`messageid`, `siteid`, `postdate`, `fromid`, `fromname`, `toid`, `toname`, `title`, `content`, `messagetype`, `isread`, `fromdel`, `todel`, `enablebbcode`, `enablehtml`, `enablesmilies`, `attachsig`, `attachment`) VALUES
('', 0, $time, 0, 'admin', 0, '', '$title', '$content', 0, 0, 0, 0, 1, 0, 1, 0, 0);");
    echo "<script>alert('提交成功');";
    echo "window.location.href='javascript:history.go(-1)';</script>";
}
?>

上面那些代码已经可以实现功能了,至于怎么通过按钮或者链接呼唤弹窗,这个js我就没写了,还有php的安全性问题,可以加群讨论下。

当前页面是本站的「Baidu MIP」版。发表评论请点击:完整版 »