manage_sort_end.php
资源名称:p2p_vod.rar [点击查看]
上传用户:liguizhu
上传日期:2015-11-01
资源大小:2422k
文件大小:3k
源码类别:
P2P编程
开发平台:
Visual C++
- <?PHP
- include_once 'common.php';
- include_once '../classes/template.inc';
- $t = NEW Template();
- $act = getParameter('act', 'letter', PP_GET);
- switch($act){
- case 'add':
- $t -> set_file('main', '../html/manage_success.html');
- $common = getParameter('sort_name', 'common', PP_POST);
- if (!empty($common)){
- $sql_sort = "SELECT count(*) FROM sort WHERE sort_name = '$common'";
- $query_sort = db_query($sql_sort);
- list($count) = db_fetch_row($query_sort);
- if($count==0){
- $sql_sort_i = "INSERT INTO sort (sort_name, e_name, e_time) VALUES ('$common', '1', NOW())";
- $query_sort_i = db_query($sql_sort_i);
- $t -> set_var('img', 'success.gif');
- $t -> set_var('talk', '添加分类成功');
- $t -> set_var('ahref', 'manage_sort.php');
- }else {
- $t -> set_var('img', 'error.gif');
- $t -> set_var('talk', '此分类已存在');
- $t -> set_var('ahref', 'manage_sort.php');
- }
- }else {
- $t -> set_var('img', 'error.gif');
- $t -> set_var('talk', '请填写完整分类名称');
- $t -> set_var('ahref', 'manage_sort.php');
- }
- $t -> pparse('out', 'main');
- break;
- case 'upd':
- $sid = getParameter('sid', 'numbers', PP_GET);
- $t -> set_file('main', '../html/manage_sort_end.html');
- $sql_sort = "SELECT sort_name FROM sort WHERE sid = '$sid'";
- $query_sort = db_query($sql_sort);
- $num = db_num_rows($query_sort);
- if(!empty($num)){
- $rs_sort = db_fetch_array($query_sort);
- $t -> set_var('sort_id', $sid);
- $t -> set_var('sort_name', $rs_sort['sort_name']);
- }
- $t -> parse('out', 'main');
- $t -> p('out');
- break;
- case 'updend':
- $sid = getParameter('sid', 'numbers', PP_GET);
- $t -> set_file('main', '../html/manage_success.html');
- $sql = "SELECT count(*) FROM sort WHERE sid = '$sid'";
- $query = db_query($sql);
- list($count) = db_fetch_row($query);
- if($count!=0){
- $sortname = getParameter('sortname', 'common', PP_POST);
- if(!empty($sortname)){
- $sql_num = "SELECT count(*) FROM sort WHERE sort_name = '$sortname'";
- $query_num = db_query($sql_num);
- list($num) = db_fetch_row($query_num);
- if($num==0){
- $sql_up = "UPDATE sort SET sort_name = '$sortname' WHERE sid = '$sid'";
- $query_up = db_query($sql_up);
- $t -> set_var('img', 'success.gif');
- $t -> set_var('talk', '修改成功');
- $t -> set_var('ahref', 'manage_sort.php');
- }else {
- $t -> set_var('img', 'error.gif');
- $t -> set_var('talk', '此分类已存在');
- $t -> set_var('ahref', 'manage_sort.php');
- }
- }else {
- $t -> set_var('img', 'error.gif');
- $t -> set_var('talk', '此分类已存在');
- $t -> set_var('ahref', 'manage_sort.php');
- }
- }else {
- $t -> set_var('img', 'error.gif');
- $t -> set_var('talk', '您的提交有误,请重试');
- $t -> set_var('ahref', 'manage_sort.php');
- }
- $t -> parse('out', 'main');
- $t -> p('out');
- break;
- case 'del':
- $sid = getParameter('sid', 'numbers', PP_GET);
- $sql = "delete from sort where sid = '$sid'";
- $query = db_query($sql);
- $t -> set_file('main', '../html/manage_success.html');
- $t -> set_var('img', 'success.gif');
- $t -> set_var('talk', '删除成功');
- $t -> set_var('ahref', 'manage_sort.php');
- $t -> parse('out', 'main');
- $t -> p('out');
- break;
- }
- ?>