帝國CMS錯誤報告功能啟用、防垃圾灌水、統計、增加報告分類
發布時間:2019-10-11 來源:未知 瀏覽: 關鍵詞:
一、錯誤報告啟用
內容模板加
<a href="[!--news.url--]e/public/report/?classid=[!--classid--]&id=[!--id--]">錯誤報告</a>
如果做了分類,請鏈接地址加個&cid=分類ID。如:&cid=1
<a href="[!--news.url--]e/public/report/?classid=[!--classid--]&id=[!--id--]&cid=1">錯誤報告</a>
二、錯誤報告防灌水
方法1、會員登錄才能使用“錯誤報告”功能
可以設置僅注冊會員才可以進行報告
修改 e/public/report/index.php
在里面加入判斷語句,如加在$empire=new mysqlquery();該行下面:
$userid=(int)getcvar('mluserid');
if(!$userid)
{
printerror('未登錄用戶禁用此功能','history.go(-1)',1,0,1);
}
方法2、使用驗證碼
三、錯誤報告統計
錯誤報告全部統計
<?=$empire->gettotal("select count(*) as total from {$dbtbpre}enewsdownerror")?>
注釋:統計enewsdownerror表的記錄總數
當前列表頁頁統計(列表頁)
<?=$empire->gettotal("select count(*) as total from {$dbtbpre}enewsdownerror where classid='$GLOBALS[navclassid]'")?>
注釋:只能統計終極欄目,一級欄目不能統計
指定列表頁頁統計(首頁、列表頁)
如:“影視頻道”下的“動作片”
<?=$empire->gettotal("select count(*) as total from {$dbtbpre}enewsdownerror where classid='42' ")?>
注釋:1、多個欄目時用:classid in('欄目ID1','欄目ID2','欄目ID3')
2、只能統計終極欄目,一級欄目不能統計
當前內容頁統計(內容頁)
<?=$empire->gettotal("select count(*) as total from {$dbtbpre}enewsdownerror where classid='$navinfor[classid]' and id='$navinfor[id]'")?>
四、錯誤報告頁面增加選擇分類
說明:在填寫錯誤報告的頁面增加可選擇的分類(后臺增加的分類) 如:默認、新建 等信息分類
方法1、增加下拉框選擇分類
在/e/template/public/report.php 中加入以下代碼
<select name="cid" id="cid">
<option value="" selected="selected">請選擇</option>
<option value="1">默認</option>
<option value="2">新建</option>
</select>
--------------------------------------------------------------
實例:表單部分
<form name="form1" method="post" action="../../enews/index.php">
<table width="600" border="0" align="center" cellpadding="3" cellspacing="1"class=tableborder>
<input type="hidden" name="cid" value="<?=$cid?>">
<tr class=header>
<td height="23" colspan="2">提交錯誤報告</td>
</tr>
<tr>
<td width='16%' height=25 bgcolor='ffffff'><div align="right">選需求:</div></td>
<td bgcolor='ffffff'>
<select name="cid" id="cid">
<option value="" selected="selected">請選擇</option>
<option value="1">默認</option>
<option value="2">新建</option>
</select></td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="137" height="23"><div align="left">信息標題:</div></td>
<td width="448" height="23"><a href='<?=$titleurl?>' target=_blank><?=$r[title]?></a></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="23"><div align="left">您的郵箱:</div></td>
<td height="23"><input name="email" type="text" id="email">
(方便回復您)</td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="23"><div align="left">報告內容(*):</div></td>
<td height="23"><textarea name="errortext" cols="60" rows="12" id="name4"></textarea></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="23"> </td>
<td height="23"><input type="submit" name="Submit" value="提交"> <input type="reset" name="Submit2" value="重置">
<input name="enews" type="hidden" id="enews" value="AddError">
<input name="id" type="hidden" id="id" value="<?=$id?>">
<input name="classid" type="hidden" id="classid" value="<?=$classid?>"></td>
</tr>
</table>
</form>
==============================================================================================
方法2、單選方式
在/e/template/public/report.php 中的“信息標題:”下面加入以下代碼(在“信息標題:”以上添加時,信息標題會不顯示)
<?php
$sql=$empire->query("select classid,classname from {$dbtbpre}enewserrorclass order by classid desc");
?>
<?
while($r=$empire->fetch($sql))
{
?>
<input name="cid" type="radio" value="<?=$r[classid]?>"><?=$r[classname]?>
<?
}
db_close();
$empire=null;
?>
--------------------------------------------------------------
實例:表單部分
<form name="form1" method="post" action="../../enews/index.php">
<table width="600" border="0" align="center" cellpadding="3" cellspacing="1"class=tableborder>
<input type="hidden" name="cid" value="<?=$cid?>">
<tr class=header>
<td height="23" colspan="2">提交錯誤報告</td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="137" height="23"><div align="left">信息標題:</div></td>
<td width="448" height="23"><a href='<?=$titleurl?>' target=_blank><?=$r[title]?></a></td>
</tr>
<tr bgcolor="#FFFFFF"> <td height="23"><div align="left">選擇分類:</div></td>
<td height="23"><?php $sql=$empire->query("select classid,classname from {$dbtbpre}enewserrorclass order by classid desc");?>
<? while($r=$empire->fetch($sql)){ ?><input name="cid" type="radio" value="<?=$r[classid]?>"><?=$r[classname]?>
<? } db_close();$empire=null;?></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="23"><div align="left">您的郵箱:</div></td>
<td height="23"><input name="email" type="text" id="email">
(方便回復您)</td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="23"><div align="left">報告內容(*):</div></td>
<td height="23"><textarea name="errortext" cols="60" rows="12" id="name4"></textarea></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="23"> </td>
<td height="23"><input type="submit" name="Submit" value="提交"> <input type="reset" name="Submit2" value="重置">
<input name="enews" type="hidden" id="enews" value="AddError">
<input name="id" type="hidden" id="id" value="<?=$id?>">
<input name="classid" type="hidden" id="classid" value="<?=$classid?>"></td>
</tr>
</table>
</form>
內容模板加
<a href="[!--news.url--]e/public/report/?classid=[!--classid--]&id=[!--id--]">錯誤報告</a>
如果做了分類,請鏈接地址加個&cid=分類ID。如:&cid=1
<a href="[!--news.url--]e/public/report/?classid=[!--classid--]&id=[!--id--]&cid=1">錯誤報告</a>
二、錯誤報告防灌水
方法1、會員登錄才能使用“錯誤報告”功能
可以設置僅注冊會員才可以進行報告
修改 e/public/report/index.php
在里面加入判斷語句,如加在$empire=new mysqlquery();該行下面:
$userid=(int)getcvar('mluserid');
if(!$userid)
{
printerror('未登錄用戶禁用此功能','history.go(-1)',1,0,1);
}
方法2、使用驗證碼
三、錯誤報告統計
錯誤報告全部統計
<?=$empire->gettotal("select count(*) as total from {$dbtbpre}enewsdownerror")?>
注釋:統計enewsdownerror表的記錄總數
當前列表頁頁統計(列表頁)
<?=$empire->gettotal("select count(*) as total from {$dbtbpre}enewsdownerror where classid='$GLOBALS[navclassid]'")?>
注釋:只能統計終極欄目,一級欄目不能統計
指定列表頁頁統計(首頁、列表頁)
如:“影視頻道”下的“動作片”
<?=$empire->gettotal("select count(*) as total from {$dbtbpre}enewsdownerror where classid='42' ")?>
注釋:1、多個欄目時用:classid in('欄目ID1','欄目ID2','欄目ID3')
2、只能統計終極欄目,一級欄目不能統計
當前內容頁統計(內容頁)
<?=$empire->gettotal("select count(*) as total from {$dbtbpre}enewsdownerror where classid='$navinfor[classid]' and id='$navinfor[id]'")?>
四、錯誤報告頁面增加選擇分類
說明:在填寫錯誤報告的頁面增加可選擇的分類(后臺增加的分類) 如:默認、新建 等信息分類
方法1、增加下拉框選擇分類
在/e/template/public/report.php 中加入以下代碼
<select name="cid" id="cid">
<option value="" selected="selected">請選擇</option>
<option value="1">默認</option>
<option value="2">新建</option>
</select>
--------------------------------------------------------------
實例:表單部分
<form name="form1" method="post" action="../../enews/index.php">
<table width="600" border="0" align="center" cellpadding="3" cellspacing="1"class=tableborder>
<input type="hidden" name="cid" value="<?=$cid?>">
<tr class=header>
<td height="23" colspan="2">提交錯誤報告</td>
</tr>
<tr>
<td width='16%' height=25 bgcolor='ffffff'><div align="right">選需求:</div></td>
<td bgcolor='ffffff'>
<select name="cid" id="cid">
<option value="" selected="selected">請選擇</option>
<option value="1">默認</option>
<option value="2">新建</option>
</select></td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="137" height="23"><div align="left">信息標題:</div></td>
<td width="448" height="23"><a href='<?=$titleurl?>' target=_blank><?=$r[title]?></a></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="23"><div align="left">您的郵箱:</div></td>
<td height="23"><input name="email" type="text" id="email">
(方便回復您)</td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="23"><div align="left">報告內容(*):</div></td>
<td height="23"><textarea name="errortext" cols="60" rows="12" id="name4"></textarea></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="23"> </td>
<td height="23"><input type="submit" name="Submit" value="提交"> <input type="reset" name="Submit2" value="重置">
<input name="enews" type="hidden" id="enews" value="AddError">
<input name="id" type="hidden" id="id" value="<?=$id?>">
<input name="classid" type="hidden" id="classid" value="<?=$classid?>"></td>
</tr>
</table>
</form>
==============================================================================================
方法2、單選方式
在/e/template/public/report.php 中的“信息標題:”下面加入以下代碼(在“信息標題:”以上添加時,信息標題會不顯示)
<?php
$sql=$empire->query("select classid,classname from {$dbtbpre}enewserrorclass order by classid desc");
?>
<?
while($r=$empire->fetch($sql))
{
?>
<input name="cid" type="radio" value="<?=$r[classid]?>"><?=$r[classname]?>
<?
}
db_close();
$empire=null;
?>
--------------------------------------------------------------
實例:表單部分
<form name="form1" method="post" action="../../enews/index.php">
<table width="600" border="0" align="center" cellpadding="3" cellspacing="1"class=tableborder>
<input type="hidden" name="cid" value="<?=$cid?>">
<tr class=header>
<td height="23" colspan="2">提交錯誤報告</td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="137" height="23"><div align="left">信息標題:</div></td>
<td width="448" height="23"><a href='<?=$titleurl?>' target=_blank><?=$r[title]?></a></td>
</tr>
<tr bgcolor="#FFFFFF"> <td height="23"><div align="left">選擇分類:</div></td>
<td height="23"><?php $sql=$empire->query("select classid,classname from {$dbtbpre}enewserrorclass order by classid desc");?>
<? while($r=$empire->fetch($sql)){ ?><input name="cid" type="radio" value="<?=$r[classid]?>"><?=$r[classname]?>
<? } db_close();$empire=null;?></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="23"><div align="left">您的郵箱:</div></td>
<td height="23"><input name="email" type="text" id="email">
(方便回復您)</td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="23"><div align="left">報告內容(*):</div></td>
<td height="23"><textarea name="errortext" cols="60" rows="12" id="name4"></textarea></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="23"> </td>
<td height="23"><input type="submit" name="Submit" value="提交"> <input type="reset" name="Submit2" value="重置">
<input name="enews" type="hidden" id="enews" value="AddError">
<input name="id" type="hidden" id="id" value="<?=$id?>">
<input name="classid" type="hidden" id="classid" value="<?=$classid?>"></td>
</tr>
</table>
</form>
責任編輯:實速科技