⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 topic_admin.php

📁 是个关于网格编程的程序
💻 PHP
字号:
<?php
//*****************************************
//       id: replace
//       EasyTalk V3.0 2008.5.6 20:50
//       by 仙踪云影
//*****************************************

define('is_admin_path', 'yes');
require_once '../common.php';
if ($admin_login !="yes" || $isadmin!=1)
header("Location: admin_login.php");
$action=$_POST['action'];
$action2=$_GET['act'];
if ($action2=="del") {
    $tn=$_GET['tn'];
	$tn_tem = explode("|",$topicwords);
	$tx_tem = explode("|",$topicnews);
	@reset($tn_tem);
	@reset($tx_tem);
	for ($i=0;$i<count($tn_tem);$i++) {
		$tx_tem2="";
		if ($tn_tem[$i]!=$tn) {
			$temn=explode($tn_tem[$i],$tx_tem[$i]);
			if ($temn[1]) {
			  $tx_tem2=$temn[1];
			}
			$tx_tem2=$tn_tem[$i].$tx_tem2;
			$_n_tem="$tn_tem[$i]|$_n_tem";
			$_x_tem="$tx_tem2|$_x_tem";
		}
	}
	$_n_tem=substr($_n_tem,0,-1);
	$_x_tem=substr($_x_tem,0,-1);
	$query = "UPDATE ".$DBprefix."settings  SET topic = '$_n_tem',topic_news='$_x_tem'"; 
	mysql_query($query);
	@unlink("../cache/replace_topic_cache.php");
	$query = "select replace_word from ".$DBprefix."settings";
	$result=mysql_query($query);
	$data = @mysql_fetch_array($result); 
	$replace_word=$data['replace_word'];
	$fp=fopen(ET_ROOT."/cache/replace_topic_cache.php","a");
	fputs($fp,"<?php\n");
	fputs($fp,"\$replace='$replace_word';\n");
	fputs($fp,"\$topicwords='$_n_tem';\n");
	fputs($fp,"\$topicnews=\"$_x_tem\";\n");
	fputs($fp,"\$smarty->assign('replace',\$replace);\n");
	fputs($fp,"\$smarty->assign('topicwords',\$_topic_n);\n");
	fputs($fp,"\$smarty->assign('topicnews',\$_topic_x);\n");
	fputs($fp,"?>");
	header("location: topic_admin.php");
}
if ($action=="topic") {
	$_topic_n2=$_POST["topic_n"];
	$_topic_x=$_POST["topic_x"];
    $_topic_x=str_replace("\"","'",$_topic_x);
	$query = "select topic,topic_news from ".$DBprefix."settings";
	$result=mysql_query($query);
	$data = @mysql_fetch_array($result); 
	$admin_topic=$data['topic'];
	$admin_tnews=$data['topic_news'];
	$_topic_n="$admin_topic|$_topic_n2";
	$_topic_x="$admin_tnews|$_topic_n2$_topic_x";
    if (substr($_topic_n,0,1)=="|") {
	    $_topic_n=substr($_topic_n,1);
	}
    if (substr($_topic_x,0,1)=="|") {
	    $_topic_x=substr($_topic_x,1);
	}
	mysql_query("set names gbk");
	$query = "UPDATE ".$DBprefix."settings  SET topic = '$_topic_n',topic_news='$_topic_x'"; 
	mysql_query($query);
	@unlink("../cache/replace_topic_cache.php");
	$query = "select replace_word from ".$DBprefix."settings";
	$result=mysql_query($query);
	$data = @mysql_fetch_array($result); 
	$replace_word=$data['replace_word'];
	$fp=fopen(ET_ROOT."/cache/replace_topic_cache.php","a");
	fputs($fp,"<?php\n");
	fputs($fp,"\$replace='$replace_word';\n");
	fputs($fp,"\$topicwords='$_topic_n';\n");
	fputs($fp,"\$topicnews=\"$_topic_x\";\n");
	fputs($fp,"\$smarty->assign('replace',\$replace);\n");
	fputs($fp,"\$smarty->assign('topicwords',\$_topic_n);\n");
	fputs($fp,"\$smarty->assign('topicnews',\$_topic_x);\n");
	fputs($fp,"?>");
	header("location: topic_admin.php");
}
if ($action=="edit") {
	$query = "select topic,topic_news from ".$DBprefix."settings";
	$result=mysql_query($query);
	$data = @mysql_fetch_array($result); 
	$admin_topic=$data['topic'];
	$admin_tnews=$data['topic_news'];
	$tn_tem = explode("|",$admin_topic);
	@reset($tn_tem);
	$_n_tem="";
	$_x_tem="";
	for ($i=0;$i<count($tn_tem);$i++) {
		$_n=$_POST["n_$i"];
		$_x=$_POST["x_$i"];
		$_x=$_n.$_x;
		$_n_tem="$_n_tem$_n|";
		$_x_tem="$_x_tem$_x|";
	}
	$_n_tem=substr($_n_tem,0,-1);
	$_x_tem=substr($_x_tem,0,-1);
	$_x_tem=str_replace("\"","'",$_x_tem);
    $query = "UPDATE ".$DBprefix."settings  SET topic = '$_n_tem',topic_news='$_x_tem'"; 
	mysql_query($query);
	@unlink("../cache/replace_topic_cache.php");
	$query = "select replace_word from ".$DBprefix."settings";
	$result=mysql_query($query);
	$data = @mysql_fetch_array($result); 
	$replace_word=$data['replace_word'];
	$fp=fopen(ET_ROOT."/cache/replace_topic_cache.php","a");
	fputs($fp,"<?php\n");
	fputs($fp,"\$replace='$replace_word';\n");
	fputs($fp,"\$topicwords='$_n_tem';\n");
	fputs($fp,"\$topicnews=\"$_x_tem\";\n");
	fputs($fp,"\$smarty->assign('replace',\$replace);\n");
	fputs($fp,"\$smarty->assign('topicwords',\$_topic_n);\n");
	fputs($fp,"\$smarty->assign('topicnews',\$_topic_x);\n");
	fputs($fp,"?>");
	header("location: topic_admin.php");
}
	$tn_tem = @explode("|",$topicwords);
	$tx_tem = @explode("|",$topicnews);
	$smarty->assign("topicwords", $topicwords);
	@reset($tn_tem);
	@reset($tx_tem);
	for ($i=0;$i<count($tn_tem);$i++) {
		$tx_tem2="";
		$temn=@explode($tn_tem[$i],$tx_tem[$i]);
		if ($temn[1]) {
		  $tx_tem2=$temn[1];
		}
		$array[] = array("i"=>$i,"t_name"=>$tn_tem[$i],"t_news"=>$tx_tem2);
	}
	$smarty->assign("t_n", $array);
	unset($array);
$smarty->template_dir = "templates";   
$smarty->compile_dir = "templates_c";    
$smarty->display("topic_admin.htm"); 
?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -