www.gusucode.com > Tatter Tools 0.961 SE GB2312 简体中文版 > upload/admin/article_category_pop1.php
<? include("../inc_global.php"); include("../inc_function.php"); check_authority(); if ($mode == "insert") { $newsortno = get_maxval("t3_".$dbid."_ct1", "sortno", "") + 1; put_query(" insert into t3_".$dbid."_ct1 ( sortno, label ) values ( $newsortno, '$label' ) "); check_query(); header("Location: article_category_pop1.php"); exit; } if ($mode == "update") { put_query("update t3_".$dbid."_ct1 set label = '$plabel' where no = $num"); check_query(); header("Location: article_category_pop1.php"); exit; } if ($mode == "delete") { put_query("delete from t3_".$dbid."_ct1 where no = $num"); put_query("delete from t3_".$dbid."_ct2 where pno = $num"); put_query("update t3_$dbid set category1 = '0', category2 = '0' where category1 = '$num'"); check_query(); header("Location: article_category_pop1.php"); exit; } if ($mode == "sortup") { $sql = "select max(sortno) from t3_".$dbid."_ct1 where sortno < $sortno"; list ($max_sortno) = mysql_fetch_array(mysql_query($sql)); if ($max_sortno) { $sql = "select no, sortno from t3_".$dbid."_ct1 where sortno = $max_sortno"; list ($newno, $newsortno) = mysql_fetch_array(mysql_query($sql)); put_query("update t3_".$dbid."_ct1 set sortno = $newsortno where no = $no"); put_query("update t3_".$dbid."_ct1 set sortno = $sortno where no = $newno"); check_query(); } header("Location: article_category_pop1.php"); exit; } if ($mode == "sortdown") { $sql = "select min(sortno) from t3_".$dbid."_ct1 where sortno > $sortno"; list ($min_sortno) = mysql_fetch_array(mysql_query($sql)); if ($min_sortno) { $sql = "select no, sortno from t3_".$dbid."_ct1 where sortno = $min_sortno"; list ($newno, $newsortno) = mysql_fetch_array(mysql_query($sql)); put_query("update t3_".$dbid."_ct1 set sortno = $newsortno where no = $no"); put_query("update t3_".$dbid."_ct1 set sortno = $sortno where no = $newno"); check_query(); } header("Location: article_category_pop1.php"); exit; } admin_pop_header("\" onUnload=\"opener.location.reload();"); ?> <script type="text/javascript"> function onclick_insert(form) { trim_all(form); if (isNull(form.label,'输入大分类名称')) return false; form.mode.value = 'insert'; form.submit(); } function onclick_update(form, num, label) { trim_all(form); if (trim(label) == '') { alert('输入大分类名称'); return false; } form.mode.value = 'update'; form.num.value = num; form.plabel.value = label; form.submit(); } function onclick_delete(form, num) { if (!confirm('将要删除此大分类. 确定要继续吗?\t')) return false; form.mode.value = 'delete'; form.num.value = num; form.submit(); } </script> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <form method="post" name="category1" action="<?=$PHP_SELF?>"> <input type="hidden" name="mode"> <input type="hidden" name="num"> <input type="hidden" name="plabel"> <table width="100%" style="margin:6 0 3 0"><tr> <td width="24" align="right"><img src="../images/num_03.gif" height="17" alt=""></td> <td width="9"><img src="../images/ver_01.gif" width="9" height="17" alt=""></td> <td><img src="../images/cap_03.gif" width="102" height="17" alt=""></td> </tr></table> <? print_content_line(); ?> <table class="content_back1" cellpadding="0" cellspacing="0" width="100%"><tr> <td style="padding:10 0 10 0"> <table cellpadding="0" cellspacing="0" style="margin-bottom:5"><tr> <td width="80" align="right" style="padding-top:3">大分类 :: </td> <td><input class="text" type="text" name="label" style="width:150;" onkeydown="if (event.keyCode == 13) { onclick_insert(category1); return false; }"></td> <td style=padding-left:5><img class=ib src=../images/b_add.gif width=53 height=17 onclick="onclick_insert(category1);" alt=""></td> </tr></table> <? input_block() ?> <? $sql = "select no, sortno, label from t3_".$dbid."_ct1 order by sortno asc"; $result = @mysql_query($sql); while(list($no, $sortno, $label) = @mysql_fetch_array($result)) { ?> <table cellpadding="0" cellspacing="0" style="margin-top:5"><tr> <td width="80" align="right"><img class="ib" src="../images/b_up.gif" width="15" height="16" onclick="window.location.href='<?=$PHP_SELF?>?mode=sortup&no=<?=$no?>&sortno=<?=$sortno?>'" style=margin-right:5><img class=ib src=../images/b_down.gif width=15 height=16 onclick="window.location.href='<?=$PHP_SELF?>?mode=sortdown&no=<?=$no?>&sortno=<?=$sortno?>'" style="margin-right:6" alt=""></td> <td><input class="text" type="text" name="ct1_<?=$no?>" onkeydown="if (event.keyCode == 13) { onclick_update(document.category1, '<?=$no?>', this.value); return false; }" value="<?=$label?>" style="width:150"></td> <td style="padding-left:5"><img class="ib" src="../images/b_edit.gif" width="53" height="17" onclick="onclick_update(document.category1, '<?=$no?>', document.category1.ct1_<?=$no?>.value)" alt=""></td> <td style="padding-left:5"><img class="ib" src="../images/b_delete.gif" width="53" height="17" onclick="onclick_delete(document.category1, '<?=$no?>');" alt=""></td> <td style="padding-left:5"><img class="ib" src="../images/b_edit_category2.gif" height="17" onclick="window.location.href='article_category_pop2.php?ct1=<?=$no?>';" alt=""></td> </tr></table> <? } ?> </td> </tr></table> <? print_content_line(); ?> <table cellpadding="0" cellspacing="0" width="100%"><tr> <td height="35" align="right" style="padding-right:13"><img class="ib" src="../images/b_close.gif" width="53" height="17" onclick="window.close();" alt=""></td> </tr></table> </form> <? admin_pop_footer(""); ?>