<!--<?php
include_once PrintEot('left');
if(empty($action)){print <<<EOT
-->
<table width=98% align=center cellspacing=1 cellpadding=3 class=i_table>
	<tr><td class=head colspan=2>{#guide}</td></tr>
	<tr><td class=b><br><ul>{#attachment_info}</ul></td></tr>
</table><br>
<form action="$basename&" method=post name="form1">
<input type=hidden name=action value=search>
<table width=98% align=center cellspacing=1 cellpadding=3 class=i_table>
<tr><td class=head colspan=2>{#attachment_title}</td></tr>
<tr><td class=b width=20%>{#attachment_forum}</td>
<td class=b><select name='fid'><option value=all>{#attachment_all_forum}</option>$forumcache</select></td></tr>
<tr><td class=b width=20%>{#username}</td>
<td class=b><input type=text size=20 name="username"></td></tr>
<tr><td class=b width=20%>{#attachment_filename}</td>
<td class=b><input type=text size=20 name="filename"></td></tr>
<tr><td class=b>{#attachment_hits}</td>
<td class=b><input type=text size=20 name="hits">
<input type=radio size=20 name="ifmore" value='1' checked>{#attachment_less}
<input type=radio size=20 name="ifmore" value='0'>{#attachment_more}
</td></tr>
<tr><td class=b>{#attachment_size}(K) </td>
<td class=b><input type=text size=20 name="filesize">
<input type=radio size=20 name="ifless" value='1' checked>{#attachment_less}
<input type=radio size=20 name="ifless" value='0'>{#attachment_more}
</td></tr>
<tr><td class=b>{#attachment_time} </td>
<td class=b><input type=text size=20 name="postdate1" value="2004-01-01"> - <input type=text size=20 name="postdate2" value="$postdate2">
</td></tr>
<tr><td class=b>{#attachment_order}</td>
<td class=b><select name='orderway'>
<option value='uploadtime'>{#attachment_time}</option>
<option value='size'>{#attachment_size}</option>
<option value='rvrc'>{#attachment_rvrc}</option>
<option value='name'>{#attachment_name}</option>
<option value='hits'>{#attachment_hits}</option>
</select>
<input type=radio size=5 name="asc" value=''>{#_asc}
<input type=radio size=5 name="asc" value='DESC' checked>{#_desc}</td></tr>
	<tr>
		<td class=b><div id="info1">{#attachment_schnum}</div></td>
		<td class=b>
			<input type=text size=10 name="pernum" value="20">
			<input type=checkbox id="direct" name="direct" value=1 onclick="deldirect(this.form,'info1','{#attachment_schnum}');">
			{#attach_direct}
		</td>
	</tr>
</table>
<br><center><input type=submit value="{#submit}"></center></form>

<table width="98%" align="center" cellspacing=1 cellpadding=3 class="i_table">
<tr><td class=head colspan=2>{#guide}</td></tr>
<tr><td class=b><br>
<ul>{#attach_schdir}</ul>
</td></tr></table><br>
 &nbsp; &nbsp;<a href="$basename&action=list">{#attach_viewold}</a>
<form action="$basename&" method="post" name="form2">
<input type="hidden" name="action" value="schdir">
<table width="98%" align=center cellspacing=1 cellpadding=3 class="i_table">
<tr><td class=head colspan=2>{#attachment_title}</td></tr>

<tr><td class=b width=20%>{#attachment_filename}</td>
<td class=b><input type=text size=20 name="filename"></td></tr>
<tr><td class=b>{#attachment_size}(K) </td>
<td class=b><input type=text size=20 name="filesize">
<input type=radio size=20 name="ifless" value='1' checked>{#attachment_less}
<input type=radio size=20 name="ifless" value='0'>{#attachment_more}
</td></tr>
<tr><td class=b>{#attachment_visit} </td>
<td class=b><input type=text size=20 name="postdate1" value="2004-01-01"> - <input type=text size=20 name="postdate2" value="$postdate2"></td></tr>
<tr><td class=b><div id="info2">{#attachment_pernum}</div></td>
<td class=b><input type=text size=20 name="pernum" value=1000><input type=checkbox id="direct" name="direct" value=1 onclick="deldirect(this.form,'info2','{#attachment_pernum}');">{#attach_direct}</td></tr>
</table>
<br><center><input type=submit value="{#submit}"></center></form>
<br>
<form action="$basename&" method="post" name="form2">
<input type="hidden" name="action" value="delattach">
<table width="98%" align="center" cellspacing=1 cellpadding=3 class="i_table">
	<tr><td class=head colspan=2>{#attachment_title}</td></tr>
	<tr><td class=b colspan=2>{#attach_delfile}</td></tr>
	<tr>
		<td class=b width=20%>{#attachment_pernum}</td>
		<td class=b><input type=text size=20 name="pernum" value=1000></td>
	</tr>
</table>
<br>
<center><input type=submit value="{#submit}"></center></form>

<script language="JavaScript">
function deldirect(form,tar,msg){
	if (form.direct.checked == true){
		document.getElementById(tar).innerHTML = '<b><font color=blue>{#deldirect_msg}</font></b>';
	}else{
		document.getElementById(tar).innerHTML = msg;
	}
}
</script>
<!--
EOT;
} elseif($action=='list'){
print <<<EOT
-->
 &nbsp; &nbsp;$pages
<form action="$basename&" method="post">
<input type="hidden" name="action" value="delfile"> 
<table width="98%" align=center cellspacing=1 cellpadding=3 class="i_table">
<tr><td class=head colspan=7>{#attachment_list}</td></tr>
<tr class=head_2 align=center>
<td>ID</td>
<td>{#attachment_name}</td>
<td>{#attachment_visit}</td>
<td>{#attachment_size}(k)</td>
<td width=4%>{#attachment_del}</td>
</tr>
<!--
EOT;
$id=($page-1)*$db_perpage;
foreach($attachdb as $attach){
$id++;
print <<<EOT
-->
<tr class=b align=center>
<td>$id</td>
<td><a href="$attachpath/$attach[name]" target="_blank">$attach[name]</a></td>
<td>$attach[time]</td>
<td>$attach[size]</td>
<td>
<!--
EOT;
if($attach[exists]){print <<<EOT
-->
<input type="checkbox" name="delfile[]" value="$attach[name]">
<!--
EOT;
} else{print <<<EOT
-->
<font color="red">{#attach_noexists}</font>
<!--
EOT;
}print <<<EOT
-->
</td>
</tr>
<!--
EOT;
}print <<<EOT
-->
</table><br>
<center><input type="button" name="chkall" value="{#sel_all}" onclick="CheckAll(this.form)">
<input type="submit" name="hello" value="{#submit}"></center></form><br>
<!--
EOT;
} else{
print <<<EOT
-->
 &nbsp; &nbsp;$pages
<form action="$basename&" method="post">
<input type="hidden" name="action" value="delete"> 
<table width=98% align=center cellspacing=1 cellpadding=3 class=i_table>
<tr><td class=head colspan=7>{#attachment_list}</td></tr>
<tr class=head_2 align=center>
<td>ID</td>
<td width="20%">{#attachment_name}</td>
<td width="15%">{#attachment_size}</td>
<td width="15%">{#attachment_time}</td>
<td width="20%">{#view_topic}</td>
<td width="20%">{#attachment_forum}</td>
<td width=4%>{#attachment_del}</td>
</tr>
<!--
EOT;
$id=($page-1)*$pernum;
foreach($attachdb as $key=>$value){
$view_topic=$value[tid]?"<a href='read.php?tid=$value[tid]' target='_blank'>{#view_topic}</a>":'-';
$id++;
print <<<EOT
-->
<tr class=b align=center>
<td>$id</td>
<td><a href="$attachpath/$value[url]" target="_blank">$value[name]</a></td>
<td>$value[filezie]</td>
<td>$value[uploadtime]</td>
<td>$view_topic</td>
<td><a href="$value[where]" target="_blank">$value[forum]</a></td>
<td><input type='checkbox' name='aidarray[]' value=$value[aid]></td>
</tr>
<!--
EOT;
}print <<<EOT
-->
</table><br>
<center><input type="button" name="chkall" value="{#sel_all}" onclick="CheckAll(this.form)">
<input type="submit" name="hello" value="{#submit}"></center></form>
 &nbsp; &nbsp;$pages
<!--
EOT;
}include_once PrintEot('adminbottom');
?>-->