代码拉取完成,页面将自动刷新
<?php
/**
* Created by PhpStorm.
* User: clkj1
* Date: 2018/6/21
* Time: 9:32
*/
require 'core/header.php';
//$得出的结果 = preg_replace($搜索的值, $替换成的值, $需要替换的值[,$替换几个,$替换了多少个,输出])
//$text = preg_replace($search_result, "<span style="color:#ff0000">".$content."</span>", $topicid_posts)
if (isset($_GET['tag'])){
if ($_GET['content']==""){
echo '<script>history.back();</script>';
exit();
}
if ($_GET['tag'] == 1){
$search_result = sql_search_topics(addslashes(trim($searchContent)));
echo '<hr />结果:找到"'.htmlspecialchars($searchContent).'"相关内容 '.$search_result[1].' 个<hr />';
while (($result_array = mysqli_fetch_array($search_result[0])) != null) {
//根据topicid找到主题内容
$topicid = $result_array['topic_id'];
$topicid_posts = sql_topicid_posts($topicid);
$set_search = "/".htmlspecialchars($searchContent)."/";
$change_search = "<span style=\"color:#ff0000\">" . htmlspecialchars($searchContent) . "</span>";
$get_title = $result_array['topic_title'];
$get_content = $topicid_posts['post_content'];
$set_title = preg_replace($set_search, $change_search, $get_title);
$set_content = preg_replace($set_search, $change_search, $get_content);
$echo_title = '<a href="topic.php?topicid='.$topicid.'&p=1">'.$set_title.'</a>';
$echo_content = $set_content;
echo $echo_title;
echo '<br />';
echo $echo_content;
echo '<br />';
//主题发表时间-作者-板块
$topic_createtime = $topicid_posts['post_createtime'];
echo date('Y-m-d',$topic_createtime);
$topic_auther = $topicid_posts['post_authuid'];
//根据id查用户名/home.php?mod=space&uid=1
$auther_all = sql_search_uid_all($topic_auther);
$auther_uid = $auther_all['user_uid'];
$auther_name = $auther_all['user_username'];
echo ' <a href="home.php?mod=space&uid='.$auther_uid.'">'.$auther_name.'</a>';
//forumid/forums.php?forumid=14&p=1
$forums = sql_topicid_forums($topicid);
$forumid = $forums['forum_id'];
$forumname = $forums['forum_name'];
echo ' <a href="forums.php?forumid='.$forumid.'&p=1">'.$forumname.'</a>';
echo '<hr />';
}
}elseif ($_GET['tag'] == 2){
$search_result = sql_list_users(addslashes(trim($searchContent)));
echo '<hr />结果:找到"'.htmlspecialchars($searchContent).'"相关用户 '.$search_result[1].' 个<hr />';
while (($result_array = mysqli_fetch_array($search_result[0])) != null) {
//根据topicid找到主题内容
$userid = $result_array['user_uid'];
$user_name = $result_array['user_username'];
echo '<a href = "home.php?mod=space&uid='.$userid.'">'.$result_array['user_username'].'</a>';
echo '<hr />';
}
}
}
require 'core/footer.php';
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。