query("insert into {$dbtbpre}enewsshopps(pname,price,otherprice,psay,isclose) values('".eaddslashes($add[pname])."','$add[price]','$add[otherprice]','".eaddslashes($add[psay])."','$add[isclose]');");
$pid=$empire->lastid();
if($sql)
{
//操作日志
insert_dolog("pid=".$pid."
pname=".$add[pname]);
printerror("AddPayfsSuccess","AddPs.php?enews=AddPs".hReturnEcmsHashStrHref2(0));
}
else
{
printerror("DbError","history.go(-1)");
}
}
//修改配送方式
function EditPs($add,$userid,$username){
global $empire,$dbtbpre;
$add[pid]=(int)$add[pid];
if(empty($add[pname])||!$add[pid])
{
printerror("EmptyPayname","history.go(-1)");
}
//验证权限
CheckLevel($userid,$username,$classid,"shopps");
$add[price]=(float)$add[price];
$add['isclose']=(int)$add['isclose'];
$add['pname']=ehtmlspecialchars($add['pname']);
$add['otherprice']=hRepPostStr($add['otherprice'],1);
$sql=$empire->query("update {$dbtbpre}enewsshopps set pname='".eaddslashes($add[pname])."',price='$add[price]',otherprice='$add[otherprice]',psay='".eaddslashes($add[psay])."',isclose='$add[isclose]' where pid='$add[pid]'");
if($sql)
{
//操作日志
insert_dolog("pid=".$add[pid]."
pname=".$add[pname]);
printerror("EditPayfsSuccess","ListPs.php".hReturnEcmsHashStrHref2(1));
}
else
{
printerror("DbError","history.go(-1)");
}
}
//删除配送方式
function DelPs($pid,$userid,$username){
global $empire,$dbtbpre;
$pid=(int)$pid;
if(!$pid)
{
printerror("EmptyPayfsid","history.go(-1)");
}
//验证权限
CheckLevel($userid,$username,$classid,"shopps");
$r=$empire->fetch1("select pname from {$dbtbpre}enewsshopps where pid='$pid'");
$sql=$empire->query("delete from {$dbtbpre}enewsshopps where pid='$pid'");
if($sql)
{
//操作日志
insert_dolog("pid=".$pid."
pname=".$r[pname]);
printerror("DelPayfsSuccess","ListPs.php".hReturnEcmsHashStrHref2(1));
}
else
{
printerror("DbError","history.go(-1)");
}
}
//设置为默认配送方式
function DefPs($pid,$userid,$username){
global $empire,$dbtbpre;
$pid=(int)$pid;
if(!$pid)
{
printerror("EmptyPayfsid","history.go(-1)");
}
//验证权限
CheckLevel($userid,$username,$classid,"shopps");
$r=$empire->fetch1("select pname from {$dbtbpre}enewsshopps where pid='$pid'");
$upsql=$empire->query("update {$dbtbpre}enewsshopps set isdefault=0");
$sql=$empire->query("update {$dbtbpre}enewsshopps set isdefault=1 where pid='$pid'");
if($sql)
{
//操作日志
insert_dolog("pid=".$pid."
pname=".$r[pname]);
printerror("DefPayfsSuccess","ListPs.php".hReturnEcmsHashStrHref2(1));
}
else
{
printerror("DbError","history.go(-1)");
}
}
$enews=$_POST['enews'];
if(empty($enews))
{$enews=$_GET['enews'];}
if($enews)
{
hCheckEcmsRHash();
}
if($enews=="AddPs")
{
AddPs($_POST,$logininid,$loginin);
}
elseif($enews=="EditPs")
{
EditPs($_POST,$logininid,$loginin);
}
elseif($enews=="DelPs")
{
$pid=$_GET['pid'];
DelPs($pid,$logininid,$loginin);
}
elseif($enews=="DefPs")
{
$pid=$_GET['pid'];
DefPs($pid,$logininid,$loginin);
}
else
{}
$search=$ecms_hashur['ehref'];
$page=(int)$_GET['page'];
$page=RepPIntvar($page);
$start=0;
$line=16;//每页显示条数
$page_line=18;//每页显示链接数
$offset=$page*$line;//总偏移量
$query="select * from {$dbtbpre}enewsshopps";
$num=$empire->num($query);//取得总条数
$query=$query." order by pid limit $offset,$line";
$sql=$empire->query($query);
$returnpage=page2($num,$line,$page_line,$start,$page,$search);
?>
位置:管理配送方式 |
ID |
配送方式 |
价格 |
默认 |
启用 |
操作 |
=$r[pid]?>
|
=$r[pname]?>
|
=$r[price]?>
元 |
=$r[isdefault]==1?'是':'--'?> |
=$r[isclose]==1?'关闭':'开启'?> |
|
=$returnpage?> |