网站如果是采集的,一次性审核发布大量采集信息不利于网站seo,使用这款帝国CMS自动审核发布脚本就可以轻松解决这个问题。比帝国自带的计划任务功能好,不用开启后台才运行,脚本放到服务器上后加入服务器的计划任务便可以每天定时审核发布信息。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
<span class="pun"><?</span><span class="pln">php </span><span class="com">//使用密码控制</span> <span class="kwd">if</span><span class="pun">(</span><span class="pln">empty</span><span class="pun">(</span><span class="pln">$_GET</span><span class="pun">[</span><span class="str">'pwd'</span><span class="pun">])</span> <span class="pun">||</span><span class="pln"> $_GET</span><span class="pun">[</span><span class="str">'pwd'</span><span class="pun">]</span> <span class="pun">!=</span> <span class="str">'脚本运行密码,请自行修改'</span><span class="pun">){</span> <span class="kwd">die</span><span class="pun">(</span><span class="str">'Fuck you! -www.zztuku.com!'</span><span class="pun">);</span> <span class="pun">}</span><span class="pln"> define </span><span class="pun">(</span> <span class="str">'EmpireCMSAdmin'</span><span class="pun">,</span> <span class="str">'1'</span> <span class="pun">);</span> <span class="kwd">require</span> <span class="pun">(</span><span class="str">"../class/connect.php"</span><span class="pun">);</span> <span class="kwd">require</span> <span class="pun">(</span><span class="str">"../class/db_sql.php"</span><span class="pun">);</span> <span class="kwd">require</span> <span class="pun">(</span><span class="str">"../class/functions.php"</span><span class="pun">);</span> <span class="kwd">require</span> <span class="pun">(</span><span class="str">"../class/t_functions.php"</span><span class="pun">);</span> <span class="kwd">require</span> <span class="pun">(</span><span class="str">"../data/dbcache/class.php"</span><span class="pun">);</span> <span class="kwd">require</span> <span class="pun">(</span><span class="str">"../data/dbcache/MemberLevel.php"</span><span class="pun">);</span><span class="pln"> $link </span><span class="pun">=</span><span class="pln"> db_connect </span><span class="pun">();</span><span class="pln"> $empire </span><span class="pun">=</span> <span class="kwd">new</span><span class="pln"> mysqlquery </span><span class="pun">();</span><span class="pln"> $enews </span><span class="pun">=</span><span class="pln"> $_POST </span><span class="pun">[</span><span class="str">'enews'</span><span class="pun">];</span> <span class="kwd">if</span> <span class="pun">(</span><span class="pln">empty </span><span class="pun">(</span><span class="pln"> $enews </span><span class="pun">))</span> <span class="pun">{</span><span class="pln"> $enews </span><span class="pun">=</span><span class="pln"> $_GET </span><span class="pun">[</span><span class="str">'enews'</span><span class="pun">];</span> <span class="pun">}</span> <span class="com">//参数</span><span class="pln"> $news_table </span><span class="pun">=</span> <span class="str">"news"</span><span class="pun">;</span> <span class="com">//新闻表</span><span class="pln"> $news_num </span><span class="pun">=</span> <span class="lit">1</span><span class="pun">;</span> <span class="com">//每次审核条数</span> <span class="com">/** *使用时间控制审核的栏目,下面的代码因为栏目太多,每天分三个时段更新 *实验证明这个效果是不好的,收录只有早上的那次 * $hours = date ( 'H' ); switch($hours){ //频道和列表 case '8': $where = "bclassid = 0 or classid between 33 and 86"; break; case '13': $where = "bclassid = 0 or classid between 87 and 139"; break; case '22': $where = "bclassid = 0 or classid between 140 and 192"; break; default: $where = "classid='10000'"; } */</span><span class="pln"> $where </span><span class="pun">=</span> <span class="str">'1'</span><span class="pun">;</span> <span class="com">//审核新闻模型全部栏目</span><span class="pln"> $class_list </span><span class="pun">=</span><span class="pln"> $empire</span><span class="pun">-></span><span class="pln">query </span><span class="pun">(</span> <span class="str">"SELECT classid,islast from {$dbtbpre}enewsclass where $where"</span> <span class="pun">);</span><span class="pln"> $class </span><span class="pun">=</span><span class="pln"> array </span><span class="pun">();</span><span class="pln"> $pclass </span><span class="pun">=</span><span class="pln"> array </span><span class="pun">();</span> <span class="kwd">while</span> <span class="pun">(</span><span class="pln"> $r </span><span class="pun">=</span><span class="pln"> $empire</span><span class="pun">-></span><span class="pln">fetch </span><span class="pun">(</span><span class="pln"> $class_list </span><span class="pun">)</span> <span class="pun">)</span> <span class="pun">{</span> <span class="kwd">if</span> <span class="pun">(</span><span class="pln">$r </span><span class="pun">[</span><span class="str">'islast'</span><span class="pun">]</span> <span class="pun">==</span> <span class="str">'0'</span><span class="pun">)</span> <span class="pun">{</span><span class="pln"> array_push </span><span class="pun">(</span><span class="pln"> $pclass</span><span class="pun">,</span><span class="pln"> $r </span><span class="pun">[</span><span class="str">'classid'</span><span class="pun">]</span> <span class="pun">);</span> <span class="com">// 非终极栏目不可以发不信息,所以不参与信息审核</span> <span class="pun">}</span> <span class="kwd">else</span> <span class="pun">{</span><span class="pln"> array_push </span><span class="pun">(</span><span class="pln"> $class</span><span class="pun">,</span><span class="pln"> $r </span><span class="pun">[</span><span class="str">'classid'</span><span class="pun">]</span> <span class="pun">);</span> <span class="pun">}</span> <span class="pun">}</span> <span class="kwd">foreach</span> <span class="pun">(</span><span class="pln"> $class </span><span class="kwd">as</span><span class="pln"> $key </span><span class="pun">=></span><span class="pln"> $val </span><span class="pun">)</span> <span class="pun">{</span><span class="pln"> ecmscheck </span><span class="pun">(</span><span class="pln"> $val</span><span class="pun">,</span><span class="pln"> $news_table</span><span class="pun">,</span><span class="pln"> $news_num </span><span class="pun">);</span> <span class="com">// 审核</span> <span class="pun">}</span> <span class="com">// 刷新非终极栏目</span> <span class="kwd">foreach</span> <span class="pun">(</span><span class="pln"> $pclass </span><span class="kwd">as</span><span class="pln"> $key </span><span class="pun">=></span><span class="pln"> $value </span><span class="pun">)</span> <span class="pun">{</span><span class="pln"> echo </span><span class="str">'上级栏目'</span><span class="pun">.</span><span class="pln">$value</span><span class="pun">.</span><span class="str">'已经更新<hr/>'</span><span class="pun">;</span> <span class="typ">ReListHtml</span> <span class="pun">(</span><span class="pln"> $value</span><span class="pun">,</span> <span class="lit">1</span> <span class="pun">);</span> <span class="pun">}</span> <span class="typ">ReIndex</span><span class="pun">();</span> <span class="com">//刷新首页</span> <span class="com">/** * * @param $classid * @param $table * @param $num */</span> <span class="kwd">function</span><span class="pln"> ecmscheck</span><span class="pun">(</span><span class="pln">$classid</span><span class="pun">,</span><span class="pln"> $table</span><span class="pun">,</span><span class="pln"> $num</span><span class="pun">)</span> <span class="pun">{</span> <span class="kwd">global</span><span class="pln"> $empire</span><span class="pun">,</span><span class="pln"> $class_r</span><span class="pun">,</span><span class="pln"> $dbtbpre</span><span class="pun">;</span><span class="pln"> $time </span><span class="pun">=</span><span class="pln"> time </span><span class="pun">();</span> <span class="com">// 每周一审核的设置为推荐</span><span class="pln"> $isgood </span><span class="pun">=</span> <span class="str">'0'</span><span class="pun">;</span><span class="pln"> $day </span><span class="pun">=</span><span class="pln"> strftime </span><span class="pun">(</span> <span class="str">"%A"</span> <span class="pun">);</span> <span class="kwd">if</span> <span class="pun">(</span><span class="pln">$day </span><span class="pun">==</span> <span class="str">'Monday'</span><span class="pun">)</span> <span class="pun">{</span><span class="pln"> $isgood </span><span class="pun">=</span> <span class="str">'1'</span><span class="pun">;</span> <span class="pun">}</span><span class="pln"> $res </span><span class="pun">=</span><span class="pln"> $empire</span><span class="pun">-></span><span class="pln">query </span><span class="pun">(</span> <span class="str">"select id from {$dbtbpre}ecms_"</span> <span class="pun">.</span><span class="pln"> $table </span><span class="pun">.</span> <span class="str">"_check where classid ="</span> <span class="pun">.</span><span class="pln"> $classid </span><span class="pun">.</span> <span class="str">" ORDER BY `truetime` ASC LIMIT {$num}"</span> <span class="pun">);</span> <span class="kwd">while</span> <span class="pun">(</span><span class="pln"> $r </span><span class="pun">=</span><span class="pln"> $empire</span><span class="pun">-></span><span class="pln">fetch </span><span class="pun">(</span><span class="pln"> $res </span><span class="pun">)</span> <span class="pun">)</span> <span class="pun">{</span><span class="pln"> $data </span><span class="pun">[]</span> <span class="pun">=</span><span class="pln"> $r </span><span class="pun">[</span><span class="str">'id'</span><span class="pun">];</span> <span class="pun">}</span> <span class="typ">CheckNews_auto</span> <span class="pun">(</span><span class="pln"> $classid</span><span class="pun">,</span><span class="pln"> $data </span><span class="pun">);</span> <span class="pun">}</span> <span class="com">/** * 审核信息 * @param $classid * @param $id */</span> <span class="kwd">function</span> <span class="typ">CheckNews_auto</span><span class="pun">(</span><span class="pln">$classid</span><span class="pun">,</span><span class="pln"> $id</span><span class="pun">)</span> <span class="pun">{</span> <span class="kwd">global</span><span class="pln"> $empire</span><span class="pun">,</span><span class="pln"> $class_r</span><span class="pun">,</span><span class="pln"> $dbtbpre</span><span class="pun">,</span><span class="pln"> $emod_r</span><span class="pun">,</span><span class="pln"> $adddatar</span><span class="pun">;</span><span class="pln"> $classid </span><span class="pun">=</span> <span class="pun">(</span> <span class="kwd">int</span> <span class="pun">)</span><span class="pln"> $classid</span><span class="pun">;</span><span class="pln"> $count </span><span class="pun">=</span><span class="pln"> count </span><span class="pun">(</span><span class="pln"> $id </span><span class="pun">);</span><span class="pln"> $time </span><span class="pun">=</span><span class="pln"> time</span><span class="pun">();</span> <span class="com">//每周一审核的设置为推荐</span><span class="pln"> $isgood </span><span class="pun">=</span><span class="pln"> strftime</span><span class="pun">(</span><span class="str">'%A'</span><span class="pun">)</span> <span class="pun">==</span> <span class="str">'Monday'</span><span class="pun">?</span><span class="lit">1</span><span class="pun">:</span><span class="lit">0</span><span class="pun">;</span> <span class="kwd">for</span><span class="pun">(</span><span class="pln">$i </span><span class="pun">=</span> <span class="lit">0</span><span class="pun">;</span><span class="pln"> $i </span><span class="pun"><</span><span class="pln"> $count</span><span class="pun">;</span><span class="pln"> $i </span><span class="pun">++)</span> <span class="pun">{</span><span class="pln"> $infoid </span><span class="pun">=</span> <span class="pun">(</span> <span class="kwd">int</span> <span class="pun">)</span><span class="pln"> $id </span><span class="pun">[</span><span class="pln">$i</span><span class="pun">];</span><span class="pln"> $infor </span><span class="pun">=</span><span class="pln"> $empire</span><span class="pun">-></span><span class="pln">fetch1 </span><span class="pun">(</span> <span class="str">"select * from {$dbtbpre}ecms_"</span> <span class="pun">.</span><span class="pln"> $class_r </span><span class="pun">[</span><span class="pln">$classid</span><span class="pun">]</span> <span class="pun">[</span><span class="pln">tbname</span><span class="pun">]</span> <span class="pun">.</span> <span class="str">"_check where id='$infoid' limit 1"</span> <span class="pun">);</span> <span class="com">//$picurl = empty($infor['titlepic'])?'/images/smallpic/'.rand(1,300).'.jpg':$infor['titlepic']; //为了网站能好看点设置一个1-300的随机图片</span><span class="pln"> $res </span><span class="pun">=</span><span class="pln"> $empire</span><span class="pun">-></span><span class="pln">query</span><span class="pun">(</span><span class="str">"update {$dbtbpre}ecms_"</span><span class="pun">.</span><span class="pln">$class_r</span><span class="pun">[</span><span class="pln">$classid</span><span class="pun">][</span><span class="pln">tbname</span><span class="pun">].</span><span class="str">"_check set truetime='$time',newstime='$time',lastdotime='$time',isgood='$isgood' where id='$infoid' limit 1"</span><span class="pun">);</span><span class="pln"> $sql </span><span class="pun">=</span><span class="pln"> $empire</span><span class="pun">-></span><span class="pln">query </span><span class="pun">(</span> <span class="str">"update {$dbtbpre}ecms_"</span> <span class="pun">.</span><span class="pln"> $class_r </span><span class="pun">[</span><span class="pln">$classid</span><span class="pun">]</span> <span class="pun">[</span><span class="pln">tbname</span><span class="pun">]</span> <span class="pun">.</span> <span class="str">"_index set checked=1,truetime='$time',newstime='$time',lastdotime='$time' where id='$infoid'"</span> <span class="pun">);</span> <span class="com">// 未审核表转换</span> <span class="typ">MoveCheckInfoData</span> <span class="pun">(</span><span class="pln"> $class_r </span><span class="pun">[</span><span class="pln">$classid</span><span class="pun">]</span> <span class="pun">[</span><span class="pln">tbname</span><span class="pun">],</span> <span class="lit">0</span><span class="pun">,</span><span class="pln"> $infor </span><span class="pun">[</span><span class="str">'stb'</span><span class="pun">],</span> <span class="str">"id='$infoid'"</span> <span class="pun">);</span> <span class="com">// 更新栏目信息数</span> <span class="typ">AddClassInfos</span> <span class="pun">(</span><span class="pln"> $infor </span><span class="pun">[</span><span class="str">'classid'</span><span class="pun">],</span> <span class="str">''</span><span class="pun">,</span> <span class="str">'+1'</span> <span class="pun">);</span> <span class="com">// 刷新信息</span> <span class="typ">GetHtml</span> <span class="pun">(</span><span class="pln"> $infor </span><span class="pun">[</span><span class="str">'classid'</span><span class="pun">],</span><span class="pln"> $infor </span><span class="pun">[</span><span class="str">'id'</span><span class="pun">],</span><span class="pln"> $infor</span><span class="pun">,</span> <span class="lit">0</span> <span class="pun">);</span><span class="pln"> echo </span><span class="str">'信息 '</span><span class="pun">.</span><span class="pln">$infor </span><span class="pun">[</span><span class="str">'id'</span><span class="pun">].</span><span class="str">' 内容页已经更新<hr/>'</span><span class="pun">;</span> <span class="com">// 刷新列表</span> <span class="typ">ReListHtml</span> <span class="pun">(</span><span class="pln"> $infor </span><span class="pun">[</span><span class="str">'classid'</span><span class="pun">],</span> <span class="lit">1</span> <span class="pun">);</span><span class="pln"> echo </span><span class="str">'终极栏目 '</span><span class="pun">.</span><span class="pln">$infor </span><span class="pun">[</span><span class="str">'classid'</span><span class="pun">].</span><span class="str">' 已经更新<hr/>'</span><span class="pun">;</span> <span class="pun">}</span> <span class="pun">}</span> <span class="com">//刷新首页</span> <span class="kwd">function</span> <span class="typ">ReIndex</span><span class="pun">(){</span><span class="pln"> $indextemp</span><span class="pun">=</span><span class="typ">GetIndextemp</span><span class="pun">();</span><span class="com">//取得模板</span> <span class="typ">NewsBq</span><span class="pun">(</span><span class="pln">$classid</span><span class="pun">,</span><span class="pln">$indextemp</span><span class="pun">,</span><span class="lit">1</span><span class="pun">,</span><span class="lit">0</span><span class="pun">);</span><span class="pln"> echo </span><span class="str">'首页已经刷新'</span><span class="pun">;</span> <span class="pun">}</span> |
脚本需要根据自己的情况适当修改调整。因为我用的Linux服务器,所以运行crontab就可以了,Windows的请自行寻找计划任务方法。宝塔面板直接添加计划任务就行。
声明:本站发布的所有资源均来自于互联网,所有资源版权均属于原作者所有,这里所提供资源均只能用于参考学习用,请勿直接商用。若由于商用引起版权纠纷,一切责任均由使用者承担。
如侵犯到您的权益,请及时通知我们,我们会及时处理。邮箱:505289534@qq.com
评论(0)