www.gusucode.com > Tatter Tools 0.961 SE GB2312 简体中文版 > upload/del_exe.php

    <?
	include("inc_global.php");
	include("inc_function.php");

	if ($mode == "tb") {
		if (!return_authority()) error_process("01A3");
	}

	if ($mode == "del_tb") {
		if (return_authority()) {
			put_query("delete from t3_".$dbid."_trackback where no = '$num'");
			set_tb_cnt($pnum);
			?>
			<script type="text/javascript">
				alert('该引用(传送)资料已删除.\t');
				opener.exe_frame.location.href='add_exe.php?md=tb&num=<?=$pnum?>&d_target=post_<?=$pnum?>';
				window.close();
			</script>
			<?
			exit;
		} else error_process("01A3");
	}

	if ($mode == "del_rp") {

		$sql = "select password('$del_pass')";
		list ($del_pass) = mysql_fetch_array(mysql_query($sql));

		$sql = "select password from t3_".$dbid."_reply where no = '$num'";
		list ($db_pass) = mysql_fetch_array(mysql_query($sql));

		if ($action == "1") {
			if (return_authority() || $del_pass == $db_pass) {

				$sql = "select count(*) from t3_".$dbid."_reply where rno = '$num'";
				list ($r_cnt) = mysql_fetch_array(mysql_query($sql));

				if ($r_cnt) {
					?>
					
					<script type="text/javascript">
						alert('您输入的删除密码不正确,请返回重新输入.\t');
						window.close();
					</script>
					<?
					exit;
				}

				put_query("delete from t3_".$dbid."_reply where no = '$num'");
				set_rp_cnt($pnum);
				?>
				<script type="text/javascript">
					alert('该回复资料已删除\t');
					opener.exe_frame.location.href='add_exe.php?md=rp&num=<?=$pnum?>&d_target=post_<?=$pnum?>';
					window.close();
				</script>
				<?
				exit;
			} else error_process("02B1");
		} else if ($action == "2") {
			if ($del_pass != $db_pass && !return_authority()) error_process("02B1");
			$mode = "edit";
		}
	}

	if ($mode == "del_edit") {

		if ($is_secret == "on") $is_secret = 1; else $is_secret = 0;
		if ($homepage == "http://") $homepage = "";

		$sql = "select pno, password from t3_".$dbid."_reply where no = '$num'";
		list ($pno, $db_pass) = mysql_fetch_array(mysql_query($sql));

		if ($del_pass == $db_pass || return_authority()) {
			put_query("update t3_".$dbid."_reply set name='$name', homepage='$homepage', body='$body', is_secret='$is_secret' where no = '$num'");
			?>
			<script type="text/javascript">
				alert('该回复资料编辑成功.\t');
				opener.exe_frame.location.href='add_exe.php?md=rp&num=<?=$pno?>&d_target=post_<?=$pno?>';
				window.close();
			</script>
			<?
		} else error_process("02B1");
	}

	if ($mode == "del_gue") {

		if (!return_authority()) {

			$tab = "t3_".$dbid."_guest";

			if (!$pnum) {
				$sql = "select count(*) from t3_".$dbid."_guest_reply where pno = $num";
				list ($cnt) = mysql_fetch_array(mysql_query($sql));
				if ($cnt) error_process("01B2");
			} else $tab .= "_reply";

			$sql = "select password('$del_pass')";
			list ($del_pass) = mysql_fetch_array(mysql_query($sql));

			$sql = "select password from $tab where no = '$num'";
			list ($db_pass) = mysql_fetch_array(mysql_query($sql));

			if ($del_pass != $db_pass) error_process("02B1");

		}

		if ($pnum) {
			put_query("delete from t3_".$dbid."_guest_reply where no = '$num'");
		} else {
			put_query("delete from t3_".$dbid."_guest where no = '$num'");
			put_query("delete from t3_".$dbid."_guest_reply where pno = '$num'");
		}

		?>
		<script type="text/javascript">
			alert('该篇文章日志已删除\t');
			opener.location.reload();
			window.close();
		</script>
		<?

	}

?><html>
<head>
<title><?=$p_version?></title>
<meta http-equiv="Content-Type" content="text/html; charset=GB2312">
<meta http-equiv="Content-Language" content="text/html; language=zh-cn">
<link rel="stylesheet" href="admin/style.css">
</head>

<body background="images/e_back.gif" style="margin:0; padding:0" onload="<? if (!return_authority() && $mode != "edit") print "del_exe.del_pass.focus();" ?>">

<script type="text/javascript" src="lib.js"></script>

<script type="text/javascript">

	function onclick_submit(form){
		trim_all(form);
		form.submit();
	}

</script>

<form method="post" name="del_exe" action="<?=$PHP_SELF?>">
<input type="hidden" name="mode" value="del_<?=$mode?>">
<input type="hidden" name="pnum" value="<?=$pnum?>">
<input type="hidden" name="num" value="<?=$num?>">

	<table cellpadding="0" cellspacing="0" width="100%" style="height:100%"><tr>
	<td>

		<table cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" width="100%" style="border-style:solid;border-width:1;border-color:#444444"><tr>
		<td align="center" style="font-size:8pt; font-family:verdana; padding:10 0 12 5; background-image:url('images/back.gif')">
		<b><?=$p_version?></b>
		</td>
		</tr><tr>
		<td align="center" valign="top">

		<? input_block(); ?>

		<?
			if ($mode == "edit" && $action == "2") {
				$sql = "select name, homepage, body, is_secret from t3_".$dbid."_reply where no = '$num'";
				list ($name, $homepage, $body, $is_secret) = mysql_fetch_array(mysql_query($sql));
				if (!trim($homepage)) $homepage = "http://";
		?>

		<div align="left">

			<table cellpadding="0" cellspacing="0" style="margin:15 0 0 0"><tr>
			<td align="right" width="80">大名 :: &nbsp;</td>
			<td><input class=text type=text name="name" value="<?=$name?>" style="width:70"></td>
			<td align="right" width="90">主页 :: &nbsp;</td>
			<td><input class="text" type="text" name="homepage" value="<?=$homepage?>" style="width:150"></td>
			</tr></table>

			<table cellpadding="0" cellspacing="0" style="margin:2 0 0 0"><tr>
			<td style="padding:0 0 0 80">

				<table cellpadding="0" cellspacing="0" style="margin:5 0 5 0"><tr>
				<td><input type="checkbox" name="is_secret" <? if ($is_secret) print "checked"; ?> ></td>
				<td style="padding:1 0 0 2">私密回复(限管理员查看)</td>
				</tr></table>

			<textarea class="text" rows="3" cols="55" name="body" style="width:310;"><?=$body?></textarea>
			</td>
			</tr></table>

		</div>

		<a href="#" onclick="onclick_submit(del_exe);"><img class="ib" src="./images/b_submit.gif" alt="" style="margin:10 0 15 0"></a>

		</td>
		</tr></table>

	</td>
	</tr></table>

<input type="hidden" name="del_pass" value="<?=$del_pass?>">

</form>

</body>
</html>

		<?
			exit;
			}
		?>

			<table style="margin:15 0 10 0"><tr>
			<td><input type="radio" name="action" value="1" checked></td>
			<td><?
			    if ($mode == "tb") print "引用地址(Trackbacks)";
			    else if ($mode == "rp") print "回复";
			    else print "地址";
			?>楷写内容</td>
			<?
				if ($mode == "rp") {
					?>
					<td>&nbsp; <input type="radio" name="action" value="2"></td>
					<td>修改回复内容</td>
					<?
				}
			?>
			</tr></table>

			<table style="margin:0 0 10 0"><tr>
			<?
				if (!return_authority()) {
					?>
					<td align="right">输入密码 ::&nbsp;</td>
					<td><input type="password" class="text" maxlength="8" name="del_pass" style="width:100" onkeydown="if (event.keyCode == 13) { onclick_submit(del_exe); return false; }"></td>
					<?
				}
			?>
			<td style="padding-left:5"><img class="ib" src="images/b_submit.gif" width="53" height="17" onclick="onclick_submit(del_exe);" alt=""></td>
			</tr></table>

		</td>
		</tr></table>

	</td>
	</tr></table>

</form>

</body>
</html>