Continuing from the code in the previous article; below is the code for redirecting the article:
隐藏内容:会员可查看
<?php
require("./config.php");
$dbname2 = 'www_azhenxi_com';
$dbname = 'ecms_site';
$u = empty($_GET['n'])?0:$_GET['n'];
if(empty($_GET['n'])){
turncate($dbname,'phome_ecms_news');
turncate($dbname,'phome_ecms_news_check');
turncate($dbname,'phome_ecms_news_check_data');
turncate($dbname,'phome_ecms_news_data_1');
turncate($dbname,'phome_ecms_news_index');
}
define('EmpireCMSAdmin','1');
require("../e/class/connect.php");
require("../e/class/db_sql.php");
require("../e/class/functions.php");
require("../e/class/delpath.php");
require("../e/class/copypath.php");
require("../e/class/t_functions.php");
require("../e/data/dbcache/class.php");
require("../e/data/dbcache/MemberLevel.php");
$link=db_connect();
$empire=new mysqlquery();
$r=$empire->query("SELECT * FROM `$dbname2`.`liwuposts` where `post_type` = 'post' and `ID` > {$u} order by `ID` ASC limit 50");
$_POST = json_decode(file_get_contents("post.json"),true);
while($r2=$empire->fetch($r)) //循环获取查询记录
{
$classid = $empire->query("SELECT * FROM `$dbname2`.`liwuterm_relationships` WHERE `object_id` = {$r2['ID']} ");
$classid = $empire->fetch($classid);
$classid = $classid['term_taxonomy_id'];
// print_r($classid);die;
// print_r($r2);die;
$_POST['titlepic'] = '';
$_POST['newstext'] = htmlspecialchars_decode($r2['post_content']);
$_POST['newstext'] = preg_replace('/<img.*?>/i', '', $_POST['newstext']);
$_POST['newstext'] = preg_replace('/<figure.*?>*?<\/figure>/i', '', $_POST['newstext']);
// print_r($_POST['newstext']);
$time = strtotime($r2['post_date']);
$sql1 = "INSERT INTO `{$dbname}`.`phome_ecms_news` (`id`, `classid`, `ttid`, `onclick`, `plnum`, `totaldown`, `newspath`, `filename`, `userid`, `username`, `firsttitle`, `isgood`, `ispic`, `istop`, `isqf`, `ismember`, `isurl`, `truetime`, `lastdotime`, `havehtml`, `groupid`, `userfen`, `titlefont`, `titleurl`, `stb`, `fstb`, `restb`, `keyboard`, `title`, `newstime`, `titlepic`, `ftitle`, `smalltext`, `diggtop`) VALUES ({$r2['ID']}, '{$classid}', '0', '0', '0', '0', '', '1', '1', 'admin', '0', '0', '0', '0', '0', '0', '0', '{$time}', '{$time}', '1', '0', '0', '', '', '1', '1', '1', '{$r2['post_excerpt']}', '{$r2['post_title']}', '{$time}', '{$_POST['titlepic']}', '{$r2['post_title']}', '".addcslashes($r2['post_excerpt'])."', '0') ;";
$sql2 = "INSERT INTO `{$dbname}`.`phome_ecms_news_data_1` (`id`, `classid`, `keyid`, `dokey`, `newstempid`, `closepl`, `haveaddfen`, `infotags`, `writer`, `befrom`, `newstext`) VALUES ({$r2['ID']}, '{$classid}', '', '1', '0', '0', '0', '', '心动礼物网', '心动礼物网', '".addslashes($_POST['newstext'])."') ;";
$sql3 = "INSERT INTO `{$dbname}`.`phome_ecms_news_index` (`id`, `classid`, `checked`, `newstime`, `truetime`, `lastdotime`, `havehtml`) VALUES ({$r2['ID']}, '{$classid}', '1', '{$time}', '{$time}', '{$time}', '1') ;";
if($empire->query($sql1)){
echo "文章《{$r2['post_title']}》更新成功/33%<br>";
}else{
echo "文章《{$r2['post_title']}》更新失败/33%:{$sql1}<br>";
}
if($empire->query($sql2)){
echo "文章《{$r2['post_title']}》更新成功/66%<br>";
}else{
echo "文章《{$r2['post_title']}》更新失败/66%:{$sql2}<br>";
}
if($empire->query($sql3)){
echo "文章《{$r2['post_title']}》更新成功/100%<br><br>";
}else{
echo "文章《{$r2['post_title']}》更新失败/100%:{$sql3}<br>";
}
$u = $r2['ID'];
}
db_close();
$empire=null;
// die;
$_GET['n'] = $u;
$url = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."?n=".$_GET['n'];
echo '<html>';
echo '<head>';
echo '<meta http-equiv="refresh" content="0; url='.$url.'">';
echo '</head>';
JSON file code:
{"ehash_bf9a":"7f4acc1ed062a816ee25","rhash_ce6d":"0d7212cbe5bd","ehash_4IIMJ":"Ccf04syPf3ocZwpV7k0w","ehash_d84b":"4cfed5520f59c446154c","rhash_Bgyf0":"macGrGq7mGD6","ehash_24e9":"0fd0b314591732e306fb","enews":"AddNews","classid":"1","bclassid":"0","id":"0","filepass":"1678417767","username":"","oldfilename":"","oldgroupid":"","oldchecked":"1","newstext_url":"","ecmsfrom":"http:\/\/ecms10260.yanshi.4s5.cn\/e\/admin\/ListNews.php?&ehash_4IIMJ=Ccf04syPf3ocZwpV7k0w&bclassid=0&classid=1","ecmsnfrom":"1","fstb":"","oldttid":"","ecmscheck":"0","ztids":"","zcids":"","oldztids":"","oldzcids":"","havetmpic":"0","title":"\u6807\u9898","titlecolor":"","ftitle":"\u526f\u6807\u9898","checked":"1","isgood":"0","firsttitle":"0","keyboard":"\u5173\u952e\u8bcd","titleurl":"","newstime":"2023-03-10 11:09:27","titlepic":"\u56fe\u7247","smalltext":"\u7b80\u4ecb","writer":"\u4f5c\u8005","w_id":"\u9009\u62e9\u4f5c\u8005","befrom":"\u65b0\u95fb\u6765\u6e90","befrom_id":"\u9009\u62e9\u4fe1\u606f\u6765\u6e90","newstext":"\u6b63\u6587","dokey":"1","qz_url":"","autosize":"5000","getfirsttitlepic":"","getfirsttitlespicw":"105","getfirsttitlespich":"118","istop":"0","newstempid":"0","groupid":"0","userfen":"0","onclick":"0","totaldown":"0","newspath":"","filename":"","infotags":"tag,tag2","oldinfotags":"","info_diyotherlink":"0","info_keyid":"","info_infouptime":"","info_infodowntime":"","vote_title":"","vote_name":["","","","","","","",""],"vote_num":["0","0","0","0","0","0","0","0"],"v_vote_num":"1","v_editnum":"8","vote_class":"0","dovote_ip":"0","vote_olddotime":"0000-00-00","vote_dotime":"0000-00-00","vote_width":"500","vote_height":"300","vote_tempid":"1","addnews":" \u63d0 \u4ea4 "}