<!--<?php print <<<EOT
-->
<div id="breadCrumb">
		<img src="$imgpath/$stylepath/thread/home-old.gif" align="absmiddle" />&nbsp;<a href="$db_bfn" title="$db_bbsname">$db_bbsname</a> &raquo; <a href="$basename">邀請注冊</a>
</div>
<br />
<table width="$tablewidth" align="center" cellpadding="1" cellspacing="0">
	<tr>
		<td width="23%" valign="top">
			<table width="$tablewidth" align="center" cellpadding="3" cellspacing="1" $i_table>
				<tr>
					<td class="head" colspan="2">管理選項</td>
				</tr>
				<tr>
					<td class="f_one" colspan="2" align="center"><a href="$basename">邀請碼管理</a></td>
				</tr>
				<tr>
					<td class="f_one" colspan="2" align="center"><a href="$basename&action=send">發送邀請碼</a></td>
				</tr>
				<tr>
					<td class="f_one" colspan="2" align="center"><a href="$basename&action=buy">購買邀請碼</a></td>
				</tr>
			</table>
			<br />
			<table width="$tablewidth" align="center" cellpadding="3" cellspacing="1" $i_table>
				<tr>
					<td class="head" colspan="2">基本設置</td>
				</tr>
				<tr class="f_one">
					<td width="60%">邀請碼有效期限(單位:天)</td>
					<td>$inv_days 天</td>
				</tr>
				<tr class="f_one">
					<td>邀請碼購買時間限制</td>
					<td>$inv_limitdays 天</td>
				</tr>
				<tr class="f_one">
					<td>所消耗的積分</td>
					<td>$inv_costs $usrecredit
					</td>
				</tr>
				<tr class="f_one">
					<td>是否有權限購買</td>
					<td>
<!--
EOT;
if($allowinvite){
print <<<EOT
-->
有
<!--
EOT;
}else{
print <<<EOT
-->
無
<!--
EOT;
}
print <<<EOT
-->
					</td>
				</tr>
			</table><br />
			<table width="$tablewidth" align="center" cellpadding="3" cellspacing="1" $i_table>
				<tr>
					<td class="head" colspan="2">基本資料</td>
				</tr>
				<tr class="f_one">
					<td width="60%">$db_rvrcname</td>
					<td>$userrvrc $db_rvrcunit</td>
				</tr>
				<tr class="f_one">
					<td width="30%">$db_moneyname</td>
					<td>$winddb[money] $db_moneyunit</td>
				</tr>
				<tr class="f_one">
					<td width="30%">$db_creditname</td>
					<td>$winddb[credit] $db_creditunit</td>
				</tr>
				<tr class="f_one">
					<td width="30%">$db_currencyname</td>
					<td>$winddb[currency]</td>
				</tr>
			</table>
		</td>
		<td width="*" valign="top">
			<table width="$tablewidth" align="center" cellpadding="3" cellspacing="1" $i_table>
				<tr>
					<td class="head" colspan="2">邀請注冊流程簡介</td></tr>
				<tr class="f_one">
					<td class="smalltxt">1、<b>獲得注冊碼</b><br />
					&nbsp;&nbsp;&nbsp;&nbsp;會員通過支付一定的論壇積分，購買注冊碼<br>
					2、<b>向邀請對象發送郵件</b><br>
					&nbsp;&nbsp;&nbsp;&nbsp;將所得的注冊碼發送給邀請對象<br>
					3、<b>完成注冊</b><br>
					&nbsp;&nbsp;&nbsp;&nbsp;邀請對象點擊郵件里的注冊地址，完成邀請注冊<br>
					<b>注︰</b>開啟邀請注冊功能之後，暫停普通注冊功能
					</td>
				</tr>
			</table><br />
<!--
EOT;
if(!$action){
print <<<EOT
-->
			<form action="$basename" method="post">
			<input type="hidden" name="action" value="delete" />
			<table width="$tablewidth" align="center" cellpadding="4" cellspacing="1" $i_table>
				<tr>
					<td class="head" colspan="6" align="center">邀請碼管理</td>
				</tr>
				<tr class="cbg" align="center">
					<td width="*">邀請碼</td>
					<td width="20%">購買時間</td>
					<td width="10%">注冊用戶</td>
					<td width="20%">注冊日期</td>
					<td width="7%">狀態</td>
					<td width="6%"></td>
				</tr>
<!--
EOT;
foreach($invdb as $key=>$value){
print <<<EOT
-->
				<tr class="f_one" align="center">
					<td>$value[invcode]</td>
					<td>$value[createtime]</td>
					<td>$value[receiver]</td>
					<td>$value[usetime]</td>
<!--
EOT;
if($value['uselate']==1){
print <<<EOT
-->
<td>已過期</td>
<td><input type="checkbox" name="selid[]" value="$value[id]" /></td>
<!--
EOT;
}elseif($value['ifused']==2){print <<<EOT
-->
<td>已邀請</td>
<td><input type="checkbox" name="selid[]" value="$value[id]" /></td>
<!--
EOT;
}elseif($value['ifused']==1 && $value['uselate']==0){
print <<<EOT
-->
<td>已使用</td>
<td>--</td>
<!--
EOT;
}else{
print <<<EOT
-->
<td>未使用</td>
<td><a href="$basename&action=send&id=$value[id]"><font color="blue">邀請</font></td>
<!--
EOT;
}
print <<<EOT
-->
				</tr>
<!--
EOT;
}
print <<<EOT
-->
			</table>
			<br />
			&nbsp;&nbsp;$pages <br />
			<center><input type="button" name="chkall" value="全 選" onclick="CheckAll(this.form)" />
			<input type="submit" value="刪除所選項" onclick="return check(this.form);" /></center></form><br />
<script language="JavaScript">
function CheckAll(form){
	for (var i=0;i<form.elements.length-2;i++){
		var e = form.elements[i];
		e.checked == true ? e.checked = false : e.checked = true;
	}
}
function check(form){
	if(confirm('確定要刪除所選項嗎？')){
		return true;
	}else{
		return false;
	}
}
</script>
<!--
EOT;
}elseif($action=='send'){
print <<<EOT
-->
			<form action="$basename" method="post">
			<input type="hidden" name="action" value="send" />
			<input type="hidden" name="step" value="3" />
			<input type="hidden" name="id" value="$invcode[id]" />
			<table width="$tablewidth" align="center" cellpadding="4" cellspacing="1" $i_table>
				<tr>
					<td class="head" colspan="2">郵件發送</td>
				</tr>
				<tr class="cbg">
					<td>發送者</td>
					<td>$windid</td>
				</tr>
				<tr class="f_one">
					<td>接收者email</td>
					<td><input type="text" name="sendtoemail" size="40" /></td>
				</tr>
				<tr class="f_one">
					<td class="t_one">標題</td>
					<td class="t_one"><input type="text" name="subject" size="65" value="$subject" /></td></tr>
				<tr class="f_one">
					<td>內容</td>
					<td><textarea rows="5" cols="65" name="atc_content">$atc_content</textarea></td>
				</tr>
			</table>
			<br /><center><input type="submit" value="發送邀請碼" /></center></form><br />
<!--
EOT;
}elseif($action=='buy'){
print <<<EOT
-->
			<form action="$basename" method="post">
			<input type="hidden" name="action" value="buy" />
			<input type="hidden" name="step" value="3" />
			<table width="$tablewidth" align="center" cellpadding="3" cellspacing="1" $i_table>
				<tr>
					<td class="head" colspan="2">購買邀請碼</td>
				</tr>
				<tr class="f_one">
					<td width="45%">請輸入要購買的個數</td>
					<td><input type="text" name="invnum" value="1" size="8" /></td>
				</tr>
			</table>
			<br /><center><input type="submit" value="購買邀請碼" /></center></form><br />
<!--
EOT;
}
print <<<EOT
-->
		</td>
	</tr>
</table>
<!--
EOT;
?>-->