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

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

	check_authority();

	if ($mode == "modify") {
		$gue_perm = $gue_perm1 + $gue_perm2;
		put_query("
			update t3_".$dbid."_setting set
				gue_page_cnt = '$gue_page_cnt'
				, gue_perm = '$gue_perm'

		");

		?>
		<html>
		<head>
    <meta http-equiv="Content-type" content="text/html; charset=gb2312">
		<script type="text/javascript" language="JavaScript">
			alert('留言本相关设置完毕!\t');
			window.close();
		</script>
		<?
		exit;
	}

	if ($mode == "insert") {

		if (!$icon) $icon = $_FILES["icon"][tmp_name];
		if (!$icon_name) $icon_name = $_FILES["icon"][name];
		$icon_name = str_replace("'", "", $icon_name);

		$i_path = $r_attach_path."icon/";
		@mkdir($i_path, 0777);
		@chmod($i_path, 0777);

		$attachname = get_timestamp3().substr($icon_name, strrpos($icon_name, "."));
		move_uploaded_file($icon, $i_path.$attachname);

		@mkdir($i_path.$attachname, 0777);
		@chmod($i_path.$attachname, 0777);

		list($width, $height) = getimagesize($i_path.$attachname);
		if (!$width) error_process("02B2");

		$newsortno = get_maxval("t3_".$dbid."_guest_icon", "sortno", "") + 1;

		put_query("
			insert into t3_".$dbid."_guest_icon (
				sortno, name, file, label, width, height, type
			) values (
				'$newsortno', '$iname', '$attachname', '$icon_name', '$width', '$height', '$type'
			)
		");
		header("Location: setting_guest.php");
		exit;

	}

	if ($mode == "edit") {

		unset($add_query);

		if ($cond && $mstr) $add_query = ", cond = '$cond', mstr = '$mstr'";

		put_query("
			update t3_".$dbid."_guest_icon set
				name = '$nval'
				$add_query
			where
				no = '$num'
		");

		?>
				<html>
		<head>
    <meta http-equiv="Content-type" content="text/html; charset=gb2312">
		<script type="text/javascript" language="JavaScript">
			alert('头像设置成功。\t');
			document.location.href = '<?=$PHP_SELF?>';
			location.href='setting_guest.php?m=1#g<?=$num?>';
		</script>
		<?
		exit;

	}

	if ($mode == "delete") {

		$sql = "select file from t3_".$dbid."_guest_icon where no = '$num'";
		list ($file, $label, $width, $height) = @mysql_fetch_array(@mysql_query($sql));
		@unlink("../attach/icon/".$file);

		put_query("delete from t3_".$dbid."_guest_icon where no = '$num'");

		?>
				<html>
		<head>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8">
		<script type="text/javascript" language="JavaScript">
			alert('头像设置已经取消。\t');
			document.location.href = '<?=$PHP_SELF?>';
		</script>
		<?
		exit;

	}

	if ($mode == "sortup") {

		$sql = "select max(sortno) from t3_".$dbid."_guest_icon where sortno < $sortnum and type = '$nval'";
		list ($max_sortnum) = mysql_fetch_array(mysql_query($sql));

		if ($max_sortnum) {
			$sql = "select no, sortno from t3_".$dbid."_guest_icon where sortno = '$max_sortnum' and type = '$nval'";
			list ($newnum, $newsortnum) = mysql_fetch_array(mysql_query($sql));
			put_query("update t3_".$dbid."_guest_icon set sortno = '$newsortnum' where no = '$num'");
			put_query("update t3_".$dbid."_guest_icon set sortno = '$sortnum' where no = '$newnum'");
			check_query();
		}

		?><script> location.href='setting_guest.php?m=1#g<?=$num?>'; </script><?
		exit;
	}

	if ($mode == "sortdown") {
		$sql = "select min(sortno) from t3_".$dbid."_guest_icon where sortno > $sortnum and type = '$nval'";
		list ($min_sortnum) = mysql_fetch_array(mysql_query($sql));

		if ($min_sortnum) {
			$sql = "select no, sortno from t3_".$dbid."_guest_icon where sortno = '$min_sortnum' and type = '$nval'";
			list ($newnum, $newsortnum) = mysql_fetch_array(mysql_query($sql));
			put_query("update t3_".$dbid."_guest_icon set sortno = '$newsortnum' where no = '$num'");
			put_query("update t3_".$dbid."_guest_icon set sortno = '$sortnum' where no = '$newnum'");
			check_query();
		}
		?><script> location.href='setting_guest.php?m=1#g<?=$num?>'; </script><?
		exit;
	}

	admin_pop_header("");
?>

	<script type="text/javascript" language="JavaScript">

		function onclick_save(form) {
			form.submit();
		}

		function onclick_icon_insert(form) {
			trim_all(form);
			if (isNull(form.icon, '请选择要上传的图片')) return false;
			if (isNull(form.iname, '请输入图片名称')) return false;
			form.mode.value = 'insert';
			form.submit();
		}

		function onclick_icon_edit(form, num, nval) {
			trim_all(form);
			if (isNull(nval, '请输入要修改的图片名称')) return false;
			form.mode.value = 'edit';
			form.num.value = num;
			form.nval.value = nval.value;
			form.submit();
		}

		function onclick_icon_edit2(form, num, nval, cond, mstr) {
			trim_all(form);
			if (isNull(nval, '请输入要修改的图片名称')) return false;
			form.mode.value = 'edit';
			form.num.value = num;
			form.nval.value = nval.value;
			form.cond.value = cond.value;
			form.mstr.value = mstr.value;
			form.submit();
		}

		function onclick_icon_delete(form, num) {
			trim_all(form);
			form.mode.value = 'delete';
			form.num.value = num;
			form.submit();
		}

		function onclick_icon_sort(form, action, num, sortnum, type) {
			trim_all(form);
			form.mode.value = action;
			form.num.value = num;
			form.sortnum.value = sortnum;
			form.nval.value = type;
			form.submit();
		}

	</script>

	<table width=100% style=margin-bottom:3;margin-top:6>
	<form method=post name=setting_guest action="<?=$PHP_SELF?>">
	<input type=hidden name=mode value="modify">
	<tr>
	<td width=44 align=right><img src=../images/num_add.gif height=17></td>
	<td width=9><img src=../images/ver_01.gif width=9 height=17></td>
	<td><img src=../images/cap_add1.gif height=17></td>
	</tr></table>

	<? print_content_line(); ?>

	<table class=content_back1 cellpadding=0 cellspacing=0 width=100%><tr>
	<td style=padding-top:8;padding-bottom:10>

		<table style="margin:5 0 8 0"><tr>
		<td style=padding-top:2;padding-left:20>:: 留言板每页显示</td>
		<td>
		<select name=gue_page_cnt>
		<? for ($i=1;$i<=30;$i++) { ?><option value=<?=$i?> <? if ($p_gue_page_cnt == $i) print "selected"; ?>><?=$i?></option><? }?>
		</select>
		</td>
		<td style=padding-top:2>篇留言.</td>
		</tr></table>

		<? input_block() ?>

		<table cellpadding=0 cellspacing=0 style=padding-top:8;><tr>
		<td width=65 valign=top style="padding:13 0 0 20">:: 管理授权</td>
		<td>
			<table><tr>
			<td><input type=checkbox name=gue_perm1 value=1 <? if ($p_gue_perm == 1 || $p_gue_perm == 3) print "checked"; ?>></td>
			<td>允许访客留言.</td>
			</tr><tr>
			<td><input type=checkbox name=gue_perm2 value=2 <? if ($p_gue_perm == 2 || $p_gue_perm == 3) print "checked"; ?>></td>
			<td>允许日志访客留言.</td>
			</tr></table>
		</td>
		</tr></table>

		<? input_block() ?>

		<div style="padding:10 10 5 20">:: 如果不需使用留言板, 在模板的 skin.html 文件将留言板部分删除即可.从此处代码开始<s_guest>到</s_guest>的源码删除.</div>

	</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_save.gif width=53 height=17 onclick="document.setting_guest.submit();" style=margin-right:5><img class=ib src=../images/b_close.gif width=53 height=17 onclick="window.close();"></td>
	</tr></form></table>

	<table width=100% style="margin:20 0 3 0">
	<form method=post name=setting_guest_icon enctype=multipart/form-data action="<?=$PHP_SELF?>" onsubmit="onclick_icon_insert(this); return false;">
	<input type=hidden name=mode>
	<input type=hidden name=num>
	<input type=hidden name=sortnum>
	<input type=hidden name=nval>
	<input type=hidden name=cond>
	<input type=hidden name=mstr>
	<tr>
	<td width=44 align=right><img src=../images/num_add.gif height=17></td>
	<td width=9><img src=../images/ver_01.gif width=9 height=17></td>
	<td><img src=../images/cap_add2.gif height=17></td>
	</tr></table>

	<? print_content_line(); ?>

	<table class=content_back1 cellpadding=0 cellspacing=0 width=100%><tr>
	<td style="padding:0 0 20 0">

		<table cellpadding=0 cellspacing=0 style="margin:8 0 15 0"><tr>
		<td width=0><img id=pre_icon src=../images/spacer.gif style="margin:10 10 0 10"></td>
		<td valign=top style="padding:8 0 0 0">
		:: 请选择要添加上传的图像.<br>
		<input type=file class=button size=30 name=icon style="margin:5 0 10 0;" onchange="document.getElementById('pre_icon').src=this.value;"><br>

			<table cellpadding=0 cellspacing=0><tr>
			<td>:: 设定此留言版图像名称为</td>
			<td style="padding:0 5 1 5"><input class=text type=text name=iname value="" style="width:100;"></td>
			<td style=padding-top:2>此图像的提供给</td>
			<td style="padding:0 5 1 5">
			<select name=type>
			<option value=1>一般访客</option>
			<option value=2>特别来宾</option>
			<option value=3>管理人员</option>
			</select>
			</td>
			<td style=padding-top:2>所使用.</td>
			</tr></table>

			<table cellpadding=0 cellspacing=0 style="margin:10 0 0 0"><tr>
			<td>:: 设定此图像.</td>
			<td style="padding:0 0 0 5"><img class=ib src=../images/b_submit.gif width=53 height=17 onclick="onclick_icon_insert(document.setting_guest_icon);"></td>
			</tr></table>

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

		<table cellpadding=0 cellspacing=0 style="margin:20 0 0 18"><tr>

		<td valign=top>

			<table>
			<?
				$sql = "
					select
						no, sortno, name, file, label, width, height
					from
						t3_".$dbid."_guest_icon
					where
						type = '1'
					order by sortno asc
				";
				// print $sql;
				$result = mysql_query($sql);
				while(list($no, $sortno, $name, $file, $label, $width, $height) = @mysql_fetch_array($result)) {
					if ($width > 60) $width = 60;
					if ($height > 60) $height = 60;
					?>
					<tr>
					<td style="padding:0 0 2 0">

						<table bgcolor=#E8E8E8 width=240><tr>
						<td valign=top style="padding:0 5 5 10">
						<a name="g<?=$no?>"></a>
						<span style="font-family:tahoma;font-size:8pt;color:#404040;"><b>Guest</b></span><br>
						<img src="../attach/icon/<?=$file?>" width="<?=$width?>" height="<?=$height?>"></td>
						<td valign=top style="padding:5 10 5 0">

							<table style="margin:12 0 0 0"><tr>
							<td>向上</td>
							<td><img class=ib src=../images/b_up.gif width=15 height=16
							onclick="onclick_icon_sort(document.setting_guest_icon, 'sortup', '<?=$no?>', '<?=$sortno?>', '1')"
							><td>
							<td>向下</td>
							<td><img class=ib src=../images/b_down.gif width=15 height=16
							onclick="onclick_icon_sort(document.setting_guest_icon, 'sortdown', '<?=$no?>', '<?=$sortno?>', '1')"
							><td>
							</tr></table>

							<? input_block(); ?>

							<div style="padding:4 0 0 4">修改名称</div>

							<table><tr>
							<td><input class=text type=text name=iname<?=$no?> value="<?=$name?>" style="width:90"></td>
							<td style="padding:2 0 0 0"><img class=ib src=../images/b_edit.gif width=53 height=17
							onclick="onclick_icon_edit(document.setting_guest_icon, '<?=$no?>', document.setting_guest_icon.iname<?=$no?>);"
							><td>
							</tr></table>

							<? input_block(); ?>

							<table><tr>
							<td style="padding:2 0 0 0">删除图片</td>
							<td><img class=ib src=../images/b_delete.gif width=53 height=17
							onclick="if (confirm('您确认要删除此图片设定吗?\t')) onclick_icon_delete(document.setting_guest_icon, '<?=$no?>');"
							><td>
							</tr></table>

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

					</tr>
					<?
				}
			?>
			</table>

		</td>

		<td valign=top>

			<table>
			<?
				$sql = "
					select
						no, sortno, name, file, label, width, height, cond, mstr
					from
						t3_".$dbid."_guest_icon
					where
						type = '2'
					order by sortno asc
				";
				// print $sql;
				$result = mysql_query($sql);
				while(list($no, $sortno, $name, $file, $label, $width, $height, $cond, $mstr) = @mysql_fetch_array($result)) {
					if ($width > 60) $width = 60;
					if ($height > 60) $height = 60;
					?>
					<tr>
					<td style="padding:0 0 2 0">

						<table bgcolor=#E8E8E8 width=240><tr>
						<td valign=top style="padding:0 5 5 10">
						<a name="g<?=$no?>"></a>
						<span style="font-family:tahoma;font-size:8pt;color:#404040;"><b>授权给特别的来宾</b></span><br>
						<img src="../attach/icon/<?=$file?>" width="<?=$width?>" height="<?=$height?>"></td>
						<td valign=top style="padding:5 10 5 0">

							<table style="margin:12 0 0 0"><tr>
							<td>向上</td>
							<td><img class=ib src=../images/b_up.gif width=15 height=16
							onclick="onclick_icon_sort(document.setting_guest_icon, 'sortup', '<?=$no?>', '<?=$sortno?>', '2')"
							><td>
							<td>向下</td>
							<td><img class=ib src=../images/b_down.gif width=15 height=16
							onclick="onclick_icon_sort(document.setting_guest_icon, 'sortdown', '<?=$no?>', '<?=$sortno?>', '2')"
							><td>
							</tr></table>

							<? input_block(); ?>

							<table cellpadding=0 cellspacing=0 style="margin:4 0 0 0">

							<td style="padding:0 0 0 3">
							<select name=cond<?=$no?> style="font-size:9pt;font-family:宋体">
							<option value="0">?????</option>
							<option value="1" <? if ($cond == 1) print "selected"; ?> >姓名</option>
							<option value="2" <? if ($cond == 2) print "selected"; ?> >密码</option>
							<option value="3" <? if ($cond == 3) print "selected"; ?> >主页</option>
							</select>
							</td>

							<td style="padding:0 0 0 4"><input type=text name=mstr<?=$no?> class=text style="width:50" value="<?=$mstr?>"></td>
							<td style="padding:3 0 0 4">显示</td>
							</tr></table>

							<table><tr>
							<td><input class=text type=text name=iname<?=$no?> value="<?=$name?>" style="width:90"></td>
							<td style="padding:2 0 0 0"><img class=ib src=../images/b_edit.gif width=53 height=17
							onclick="onclick_icon_edit2(document.setting_guest_icon, '<?=$no?>', document.setting_guest_icon.iname<?=$no?>, document.setting_guest_icon.cond<?=$no?>, document.setting_guest_icon.mstr<?=$no?>);"
							><td>
							</tr></table>

							<? input_block(); ?>

							<table><tr>
							<td style="padding:2 0 0 0">删除图片</td>
							<td><img class=ib src=../images/b_delete.gif width=53 height=17
							onclick="if (confirm('您确定要删除此图像设定吗?\t')) onclick_icon_delete(document.setting_guest_icon, '<?=$no?>');"
							><td>
							</tr></table>

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

					</tr>
					<?
				}
			?>
			</table>

		</td>

		<td valign=top>

			<table>
			<?
				$sql = "
					select
						no, sortno, name, file, label, width, height
					from
						t3_".$dbid."_guest_icon
					where
						type = '3'
					order by sortno asc
				";
				// print $sql;
				$result = mysql_query($sql);
				while(list($no, $sortno, $name, $file, $label, $width, $height) = @mysql_fetch_array($result)) {
					if ($width > 60) $width = 60;
					if ($height > 60) $height = 60;
					?>
					<tr>
					<td style="padding:0 0 2 0">

						<table bgcolor=#E8E8E8 width=240><tr>
						<td valign=top style="padding:0 5 5 10">
						<a name="g<?=$no?>"></a>
						<span style="font-family:tahoma;font-size:8pt;color:#404040;"><b>Admin</b></span><br>
						<img src="../attach/icon/<?=$file?>" width="<?=$width?>" height="<?=$height?>"></td>
						<td valign=top style="padding:5 10 5 0">

							<table style="margin:12 0 0 0"><tr>
							<td>向上</td>
							<td><img class=ib src=../images/b_up.gif width=15 height=16
							onclick="onclick_icon_sort(document.setting_guest_icon, 'sortup', '<?=$no?>', '<?=$sortno?>', '3')"
							><td>
							<td>向下</td>
							<td><img class=ib src=../images/b_down.gif width=15 height=16
							onclick="onclick_icon_sort(document.setting_guest_icon, 'sortdown', '<?=$no?>', '<?=$sortno?>', '3')"
							><td>
							</tr></table>

							<? input_block(); ?>

							<div style="padding:4 0 0 4">修改名称</div>

							<table><tr>
							<td><input class=text type=text name=iname<?=$no?> value="<?=$name?>" style="width:90"></td>
							<td style="padding:2 0 0 0"><img class=ib src=../images/b_edit.gif width=53 height=17
							onclick="onclick_icon_edit(document.setting_guest_icon, '<?=$no?>', document.setting_guest_icon.iname<?=$no?>);"
							><td>
							</tr></table>

							<? input_block(); ?>

							<table><tr>
							<td style="padding:2 0 0 0">删除图片</td>
							<td><img class=ib src=../images/b_delete.gif width=53 height=17
							onclick="if (confirm('您确定要删除此图像设定吗?\t')) onclick_icon_delete(document.setting_guest_icon, '<?=$no?>');"
							><td>
							</tr></table>

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

					</tr>
					<?
				}

			?>
			</table>

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

	</td>
	</tr>
	</form>
	</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();"></td>
	</tr></table>

<?	admin_pop_footer(); ?>