query("insert into {$dbtbpre}enewslink(lname,lpic,lurl,ltime,onclick,width,height,target,myorder,email,lsay,ltype,checked,classid) values('".$add[lname]."','".$add[lpic]."','".$add[lurl]."','$ltime',$add[onclick],'$add[width]','$add[height]','$add[target]',$add[myorder],'".$add[email]."','".eaddslashes($add[lsay])."',$add[ltype],$add[checked],$add[classid]);");
$lastid=$empire->lastid();
if($sql)
{
//操作日志
insert_dolog("lid=".$lastid."
lname=".$add[lname]);
printerror("AddLinkSuccess","AddLink.php?enews=AddLink&cid=$add[cid]".hReturnEcmsHashStrHref2(0));
}
else
{printerror("DbError","history.go(-1)");}
}
//----------------修改友情链接
function EditLink($add,$userid,$username){
global $empire,$dbtbpre;
$add[lid]=(int)$add[lid];
if(!$add[lname]||!$add[lurl]||!$add[lid])
{printerror("EmptyLname","history.go(-1)");}
//验证权限
CheckLevel($userid,$username,$classid,"link");
$add[lname]=hRepPostStr($add[lname],1);
$add[lpic]=hRepPostStr2(eDoRepPostComStr($add[lpic],1));
$add[lurl]=hRepPostStr2(eDoRepPostComStr($add[lurl],1));
$add[email]=hRepPostStr($add[email],1);
$add[onclick]=(int)$add[onclick];
$add[myorder]=(int)$add[myorder];
$add[ltype]=(int)$add[ltype];
$add[checked]=(int)$add[checked];
$add[classid]=(int)$add[classid];
$add[cid]=(int)$add[cid];
$add['width']=hRepPostStr($add['width'],1);
$add['height']=hRepPostStr($add['height'],1);
$add['target']=hRepPostStr($add['target'],1);
$sql=$empire->query("update {$dbtbpre}enewslink set lname='".$add[lname]."',lpic='".$add[lpic]."',lurl='".$add[lurl]."',onclick=$add[onclick],width='$add[width]',height='$add[height]',target='$add[target]',myorder=$add[myorder],email='".$add[email]."',lsay='".eaddslashes($add[lsay])."',ltype=$add[ltype],checked=$add[checked],classid=$add[classid] where lid='$add[lid]'");
if($sql)
{
//操作日志
insert_dolog("lid=".$add[lid]."
lname=".$add[lname]);
printerror("EditLinkSuccess","ListLink.php?classid=$add[cid]".hReturnEcmsHashStrHref2(0));
}
else
{printerror("DbError","history.go(-1)");}
}
//---------------删除友情链接
function DelLink($lid,$cid,$userid,$username){
global $empire,$dbtbpre;
$lid=(int)$lid;
$cid=(int)$cid;
if(!$lid)
{printerror("EmptyLid","history.go(-1)");}
//验证权限
CheckLevel($userid,$username,$classid,"link");
$r=$empire->fetch1("select lname from {$dbtbpre}enewslink where lid='$lid'");
$sql=$empire->query("delete from {$dbtbpre}enewslink where lid='$lid'");
if($sql)
{
//操作日志
insert_dolog("lid=".$lid."
lname=".$r[lname]);
printerror("DelLinkSuccess","ListLink.php?classid=$cid".hReturnEcmsHashStrHref2(0));
}
else
{printerror("DbError","history.go(-1)");}
}
$enews=$_POST['enews'];
if(empty($enews))
{$enews=$_GET['enews'];}
if($enews)
{
hCheckEcmsRHash();
}
if($enews=="AddLink")
{
AddLink($_POST,$logininid,$loginin);
}
elseif($enews=="EditLink")
{
EditLink($_POST,$logininid,$loginin);
}
elseif($enews=="DelLink")
{
$lid=$_GET['lid'];
$cid=$_GET['cid'];
DelLink($lid,$cid,$logininid,$loginin);
}
else
{}
$search=$ecms_hashur['ehref'];
$page=(int)$_GET['page'];
$page=RepPIntvar($page);
$start=0;
$line=16;//每页显示条数
$page_line=25;//每页显示链接数
$offset=$page*$line;//总偏移量
$query="select * from {$dbtbpre}enewslink";
$totalquery="select count(*) as total from {$dbtbpre}enewslink";
//类别
$add="";
$classid=(int)$_GET['classid'];
if($classid)
{
$add=" where classid=$classid";
$search.="&classid=$classid";
}
$query.=$add;
$totalquery.=$add;
$num=$empire->gettotal($totalquery);//取得总条数
$query=$query." order by myorder,lid 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}enewslinkclass order by classid");
while($cr=$empire->fetch($csql))
{
$select="";
if($cr[classid]==$classid)
{
$select=" selected";
}
$cstr.="";
}
?>
位置:管理友情链接 |
选择类别: |
ID |
预览 |
点击 |
状态 |
操作 |
=$r[lid]?>
|
=$logo?>
|
=$r[onclick]?>
|
=$checked?> |
|
=$returnpage?> |