query("insert into {$dbtbpre}enewskey(keyname,keyurl,cid) values('$keyname','$keyurl','$cid');");
$keyid=$empire->lastid();
GetConfig();//更新缓存
if($sql)
{
//操作日志
insert_dolog("keyid=".$keyid."
keyname=".$keyname);
printerror("AddKeySuccess","key.php?fcid=$fcid".hReturnEcmsHashStrHref2(0));
}
else
{printerror("DbError","history.go(-1)");}
}
//修改关键字
function EditKey($keyid,$keyname,$keyurl,$userid,$username){
global $empire,$dbtbpre;
$cid=(int)$_POST['cid'];
$fcid=(int)$_POST['fcid'];
if(!$keyname||!$keyurl||!$keyid)
{printerror("EmptyKeyname","history.go(-1)");}
//验证权限
CheckLevel($userid,$username,$classid,"key");
$keyid=(int)$keyid;
$keyname=hRepPostStr($keyname,1);
$keyurl=hRepPostStr($keyurl,1);
$sql=$empire->query("update {$dbtbpre}enewskey set keyname='$keyname',keyurl='$keyurl',cid='$cid' where keyid='$keyid'");
GetConfig();//更新缓存
if($sql)
{
//操作日志
insert_dolog("keyid=".$keyid."
keyname=".$keyname);
printerror("EditKeySuccess","key.php?fcid=$fcid".hReturnEcmsHashStrHref2(0));
}
else
{printerror("DbError","history.go(-1)");}
}
//删除关键字
function DelKey($keyid,$userid,$username){
global $empire,$dbtbpre;
$fcid=(int)$_GET['fcid'];
$keyid=(int)$keyid;
if(!$keyid)
{printerror("NotDelKeyid","history.go(-1)");}
//验证权限
CheckLevel($userid,$username,$classid,"key");
$r=$empire->fetch1("select keyname from {$dbtbpre}enewskey where keyid='$keyid'");
$sql=$empire->query("delete from {$dbtbpre}enewskey where keyid='$keyid'");
GetConfig();//更新缓存
if($sql)
{
//操作日志
insert_dolog("keyid=".$keyid."
keyname=".$r[keyname]);
printerror("DelKeySuccess","key.php?fcid=$fcid".hReturnEcmsHashStrHref2(0));
}
else
{printerror("DbError","history.go(-1)");}
}
$enews=$_POST['enews'];
if(empty($enews))
{$enews=$_GET['enews'];}
if($enews)
{
hCheckEcmsRHash();
}
//增加关键字
if($enews=="AddKey")
{
$keyname=$_POST['keyname'];
$keyurl=$_POST['keyurl'];
AddKey($keyname,$keyurl,$logininid,$loginin);
}
//修改关键字
elseif($enews=="EditKey")
{
$keyid=$_POST['keyid'];
$keyname=$_POST['keyname'];
$keyurl=$_POST['keyurl'];
EditKey($keyid,$keyname,$keyurl,$logininid,$loginin);
}
//删除关键字
elseif($enews=="DelKey")
{
$keyid=$_GET['keyid'];
DelKey($keyid,$logininid,$loginin);
}
else
{}
$page=(int)$_GET['page'];
$page=RepPIntvar($page);
$start=0;
$line=30;//每页显示条数
$page_line=12;//每页显示链接数
$offset=$page*$line;//总偏移量
$search='';
$search.=$ecms_hashur['ehref'];
$add='';
//分类
$fcid=(int)$_GET['fcid'];
if($fcid)
{
$add=" where cid='$fcid'";
$search.='&fcid='.$fcid;
}
$totalquery="select count(*) as total from {$dbtbpre}enewskey".$add;
$num=$empire->gettotal($totalquery);
$query="select keyid,keyname,keyurl,cid from {$dbtbpre}enewskey".$add." order by keyid desc limit $offset,$line";
$sql=$empire->query($query);
$returnpage=page2($num,$line,$page_line,$start,$page,$search);
//分类
$cstr='';
$csql=$empire->query("select classid,classname from {$dbtbpre}enewskeyclass");
while($cr=$empire->fetch($csql))
{
$cstr.="";
}
?>
关键字
选择分类:
|
while($r=$empire->fetch($sql))
{
?>
}
db_close();
$empire=null;
?>
=$returnpage?>
|