www.gusucode.com > 搜一次CMS电影程序 PHP 1.5源码程序 > admin/admin_label.php
<?php /* '************************************************************************************************** ' 软件名称: 搜一次 Content Management System ' 版本编号: Version 1.X ' 官方网站: http://www.syccms.com ' 官方论坛:http://bbs.syccms.com ' 版权所有: 搜一次开发团队 无痕(QQ:512591) ' 法律顾问: 杭州市元茂律师事务所 严飞律师 ' 郑重声明: ' 1、任何个人或组织不得在未经授权的情况下删除、修改、拷贝本软件及其他副本上一切关于版权的信息; ' 2、搜一次网络事业部保留此软件的法律追究权利 '************************************************************************************************** */ include "../include/conn.php"; include "../include/function.php"; include "admin_version.php"; include "admin_loginstate.php"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <link href="images/style.css" rel="stylesheet" type="text/css" /> <title>自定义标签</title> <script type="text/javascript" language="javascript">var tentpath='<?php echo S_SitePath?>';</script> <script src="js/jquery.js"></script> <script language="javascript" src="js/alerts.js"></script> <link type="text/css" href="images/alerts.css" rel="stylesheet" media="screen"> <script language="javascript"> $(document).ready(function(){ $("#ChkAll").click(function(){ if($(this).attr("checked")==true){ $("input[name='S_ID[]']").each(function(){ $(this).attr("checked",true); }) }else{ $("input[name='S_ID[]']").each(function(){ $(this).attr("checked",false); }) } }) $("#btn_delall").click(function(){ jConfirm('您确定要执行操作吗?', '操作提示', function(r) { if(r==true){form2.submit();} }); }) $("#labelsb").click(function(){ var labelname=$("#labelname").val(); var labelremark=$("#labelremark").val(); var labelcontent=$("#labelcontent").val(); $("#labelname").css("border-color","#666 #ccc #ccc #666"); $("#labelremark").css("border-color","#666 #ccc #ccc #666"); $("#labelcontent").css("border-color","#666 #ccc #ccc #666"); if(labelname==""){ $("#labelname").css("border","1px solid red"); return false;}; if(labelremark==""){ $("#labelremark").css("border","1px solid red"); return false;}; if(labelcontent==""){ $("#labelcontent").css("border","1px solid red"); return false;}; }); }) function del(id){ jConfirm("确定删除自定义标签吗?","操作提示",function(R){ if(R==true){ window.location='?action=del&S_ID='+id; } }) } function copy(obj) { var clipBoardContent=obj; window.clipboardData.setData("Text",clipBoardContent); jAlert("复制成功!请粘贴到要调用的地方!","操作提示"); } </script> </head> <body> <?php class ui_label{ public function main($sql,$size){ global $db; $Arr=getpagerow($sql,$size);//sql,每页显示条数 $result=$db->query($Arr[2]); ?> <div class="r_main"> <div class="r_content"> <div class="r_content_1"> <form name="form2" action="?action=delall" method="post"> <table width="98%" border="0" cellspacing="0" cellpadding="0" class="tb_style"> <tr> <td class="td_title" colspan="6"> 自定义标签管理</td> </tr> <tr> <td width="6%" height="30" class="td_border"> ID</td> <td width="16%" class="td_border"> 名称</td> <td width="18%" class="td_border"> 标签代码</td> <td width="29%" class="td_border"> 标签说明</td> <td width="17%" align="center" class="td_border">添加时间</td> <td width="14%" align="center" class="td_border">操作</td> </tr> <?php if($result){ while ($row = $db ->fetch_array($result)){ ?> <tr> <td class="td_border" height="30"> <input type="checkbox" class="checkbox" name="S_ID[]" value="<?php echo $row['S_ID']?>"><?php echo $row['S_ID']?></td> <td class="td_border"> <?php echo $row['S_Name']?></td> <td class="td_border"> <?php echo "{sycself:".$row['S_Name']."}"?></td> <td class="td_border"> <?php echo $row['S_Remark']?></td> <td align="center" class="td_border"><font color="#FF0000"><?php echo $row['S_AddTime']?></font></td> <td align="center" class="td_border"><a onclick="copy('<?php echo "{sycself:".$row['S_Name']."}"?>')">调 用</a> <A href="?action=edit&S_ID=<?php echo $row['S_ID']?>">编 辑</A> <a onclick="del(<?php echo $row['S_ID']?>)">删除</a></td> </tr> <?php } } ?> <tr> <td class="td_border" height="35" align="left" colspan="6"> <input type="checkbox" class="checkbox" name="ChkAll" id="ChkAll"> 全选 <input value="批量删除选中" type="button" class="rb1" id="btn_delall"> <input type="button" value="添加新标签" class="rb1" onclick="window.location='?action=add'"></td> </tr> <tr> <td class="td_border" colspan="6" align="center" height="40"><?php echo $Arr[0];?></td> </tr> </table> </form> </div> </div> </div> <?php } public function add($Arr,$url){ $S_Name=$Arr[0]; $S_ReMark=$Arr[1]; $S_Content=$Arr[2]; $S_ID=SafeRequest("S_ID","get"); if($url=="?action=saveadd"){ $Title="添加"; } else { $Title="编辑"; } ?> <div class="r_main"> <div class="r_content"> <div class="r_content_1"> <form name="form1" action="<?php echo $url?>" method="post"> <input name="S_ID" value="<?php echo $S_ID?>" type="hidden"> <table width="98%" border="0" cellspacing="0" cellpadding="0" class="tb_style"> <tr> <td class="td_title" colspan="2"> <?php echo $Title?>自定义标签</td> </tr> <tr> <td class="td_border" height="30">自定义标签名称:</td> <td class="td_border"> <input type="text" size="50" name="labelname" id="labelname" value="<?php echo $S_Name?>"><font color="red">(*请填写英文字母或数字)</font></td> </tr> <tr> <td class="td_border" height="30">自定义标签描述:</td> <td class="td_border"> <input type="text" size="80" name="labelremark" id="labelremark" value="<?php echo $S_ReMark?>"></td> </tr> <tr> <td class="td_border">自定义标签内容: </td> <td class="td_border"> <textarea name="labelcontent" id="labelcontent" rows="20" cols="80"><?php echo $S_Content?></textarea></td> </tr> <tr> <td class="td_border" colspan="2" height="35" align="center"><input type="submit" id="labelsb" value="确定<?php echo $Title?>" class="rb1"> <input type="reset" value="重新填写" class="rb1"></td> </tr> </table> </form> </div> </div> </div> <?php } } ?> <?php $ui= new ui_label; $action=SafeRequest("action","get"); switch($action){ case 'main': $ui->main("select * from s_label",20); break; case 'add': add(); break; case 'saveadd': saveadd(); break; case 'edit': edit(); break; case 'saveedit': saveedit(); break; case 'delall': delall(); break; case 'del': del(); break; default: $ui->main("select * from s_label",20); break; } function del(){ global $db; $S_ID=SafeRequest("S_ID","get"); $sql="delete from s_label where S_ID='".$S_ID."'"; //die($sql); if($db->query($sql)){ echo "<script>window.location='admin_label.php';</script>"; } } function delall(){ global $db; $S_ID=RequestBox("S_ID"); $sql="delete from s_label where S_ID in ($S_ID)"; //die($S_ID); if($S_ID=="0"){ echo "<script>jAlert('请选择要删除的自定义标签?','操作提示',function(R){history.back();})</script>"; } else{ if($db->query($sql)){ echo "<script>jAlert('恭喜你!操作成功了!','成功提示',function(R){window.location='admin_label.php';})</script>"; } } } function edit(){ global $db; global $ui; $S_ID=SafeRequest("S_ID","get"); if(!IsNum($S_ID)){ echo "<script>jAlert('参数传输错误!','操作提示',function(R){if(R==true){history.go(-1);}});</script>"; } $sql="select * from s_label where S_ID=".$S_ID.""; $row=$db->getrow($sql); $Arr=array($row['S_Name'],$row['S_Remark'],$row['S_SelfLable']); $ui->add($Arr,"?action=saveedit"); } function saveedit(){ global $db; $S_Name=SafeRequest("labelname","post"); $S_Remark=SafeRequest("labelremark","post"); $S_Content=SafeRequest("labelcontent","post"); $S_ID=SafeRequest("S_ID","post"); if(!IsNum($S_ID)){ echo "<script>jAlert('参数传输错误!','操作提示',function(R){if(R==true){history.go(-1);}});</script>"; } $sql="update s_label set S_Name='".$S_Name."',S_Remark='".$S_Remark."',S_SelfLable='".$S_Content."' where S_ID=".$S_ID.""; if($db->query($sql)){ echo "<script>window.location='admin_label.php'</script>"; } else{ echo "<script>jAlert('编辑失败','操作提示',function(R){if(R==true){history.go(-1);}});</script>"; } } function saveadd(){ global $db; $S_Name=SafeRequest("labelname","post"); $S_Remark=SafeRequest("labelremark","post"); $S_Content=SafeRequest("labelcontent","post"); $S_AddTime=date('Y-m-d H:i:s'); $sql="insert s_label (S_Name,S_Remark,S_SelfLable,S_AddTime) values ('".$S_Name."','".$S_Remark."','".$S_Content."','".$S_AddTime."')"; if($db->query($sql)){ echo "<script>window.location='admin_label.php'</script>"; } else{ echo "<script>jAlert('添加失败','操作提示',function(R){if(R==true){history.go(-1);}});</script>"; } } function add(){ global $ui; $Arr=array("","","",""); $ui->add($Arr,"?action=saveadd"); } ?> <?php include "admin_bottom.php"; ?> </body> </html>