<!--<?php
!$webPageTitle && $webPageTitle = $db_bbsname;
$metaVersion = $wind_version;
$wind_repair && $metaVersion .= '(' . $wind_repair . ')';
print <<<EOT
-->
<!doctype html>
<html>
<head>
<meta charset="$db_charset" />
<title>$webPageTitle - Powered by phpwind</title>
<meta name="generator" content="phpwind v{$metaVersion}" />
<meta name="description" content="$metaDescription" />
<meta name="keywords" content="$metaKeywords" />
<base id="headbase" href="$db_bbsurl/" />
<link rel="stylesheet" href="$imgpath/pw_core.css?{$GLOBALS['wind_repair']}" />
<!--
EOT;
@include Pcv($css_path);
print <<<EOT
-->
<link rel="stylesheet" href="$imgpath/register/register.css?{$GLOBALS['wind_repair']}" />
<script type="text/javascript" src="js/core/core.js"></script>
<script type="text/javascript" src="js/pw_ajax.js"></script>
</head>
<body onKeyDown="try{keyCodes(event);}catch(e){}">
<div class="wrap">
<div id="header">
	<div class="head_top"></div>
		 <div id="head" class="cc">
				<a href="$db_bbsurl/"><img src="$imgpath/$stylepath/logo.png" class="fl" title="phpwind" /></a>
		</div>
</div>
<script type="text/javascript">
var imgpath = '$imgpath';
var winduid = '$winduid';
var windid	= '$windid';
var groupid	= '$groupid';
var basename = '$basename';
</script>
<div class="main-wrap">
<div id="main">
<!--
EOT;
print<<<EOT
-->
<div id="pw_content">
	<div class="p20">
		<div class="regTitle cc">
			<h5>找回密碼</h5>
		</div>
		<table width="100%"><tr><td class="vt" height="300" style="padding-bottom:30px;">
		<form action="sendpwd.php?" method="POST">
		<input type="hidden" value="2" name="step" />
		<div class="regForm">
<!-- 
EOT;
if($db_authstate && $db_authgetpwd){print <<<EOT
-->
			<dl class="cc">
				<dt><select onChange="switchSetpwdType(this.value)" name="type" class="fr" id="setPwdType"><option value="1">手機找回</option><option value="2">郵箱找回</option></select></dt>
				<dd style="line-height:30px;" class="s6">請輸入您注冊時填寫的用戶名及聯系資料</dd>
			 </dl>
<!-- 
EOT;
}print <<<EOT
-->
				<dl class="cc" id="dl_pwusername" style="display:$authStep_1">
					<dt>用戶名</dt>
					<dd class="ip"><div><input type="text" class="input" name="pwuser" id="pwuser" value="$verifyUsername" /></div></dd>
				</dl>
<!-- 
EOT;
if($db_authstate && $db_authgetpwd){print <<<EOT
-->
			<div id="setbyemail" style="display:none">
				<dl class="cc">
					<dt>電子郵箱</dt>
					<dd class="ip"><div><input type="text" class="input" name="email" /></div></dd>
				</dl>
			</div>
			<div id="setbymobile">
				<div id="mobileBox" style="display:$authStep_1">
					 <dl class="cc">
						<dt>手機號碼</dt>
						<dd class="ip"><div><input type="text" class="input" name="authmobile" id="authmobile" value="$mobile" /></div></dd>
						<dd><span class="bt"><span><button type="button" id="btnGetVerify">獲取驗證碼</button></span></span></dd>
					 </dl>
					 <!--dl class="cc">
						<dt>&nbsp;</dt>
						<dd class="s6 tp" id="mobileauth_info">此服務免費，驗證碼將以手機短信的形式發送到您的手機上</dd>
					 </dl-->
				</div>
				<div id="verifyBox" style="display:$authStep_2">
			         <dl class="cc" style="min-height:auto;height:auto;">
			            <dt id="pw_sername">用戶名</dt>
			            <dd class="ip"><span class="f14 b" style="line-height:28px;" id="usernameView">$verifyUsername</span></dd>
			         </dl>
			         <div style="border:1px solid #e4e4e4;background:#f7fbff;margin-bottom:15px;padding:10px 0;">
			            <div style="padding:0 0 5px 115px;color:#666;">
			            		驗證碼已發送到<span id="mobileNumber">$mobile</span>，如果超過{$waitTime}秒未收到驗證碼，您可以免費重新獲取。
			            		<p>
			            			<span class="bt2" style="margin:5px 0;">
			            				<span><button type="button" id="timeRemainTips">
<!-- 
EOT;
if($remainTime > 0){print <<<EOT
-->
			            				<font color="red">{$remainTime}秒</font>後重獲驗證碼
<!--
EOT;
}else{print <<<EOT
-->
重獲驗證碼
<!--
EOT;
}print <<<EOT
-->
			            				</button></span>
			            			</span>
			            		</p>
			            </div>
			            <dl class="cc" style="height:auto;min-height:inherit;margin-bottom:5px;">
			               <dt><label for="authverify">手機驗證碼</label></dt>
			               <dd class="ip"><div style="background:#fff;"><input type="text" maxlength="75" name="authverify" id="authverify" autocomplete="off" /></div></dd>
			               <dd class="tp"><span class="bt"><span><button type="button" id="verify">驗證</button></span></span></dd>
			            </dl>
			         </div>
	         	</div>

				<div id="passwordBox" style="display:none">
			         <dl class="cc">
			            <dt>&nbsp;</dt>
			            <dd class="ip"><span class="f14 b" style="line-height:28px;color:#008800;">驗證完成，請重新設置新密碼</span></dd>
			         </dl>
			         <dl class="cc">
			            <dt>新密碼</dt>
			            <dd class="ip"><div><input type="password" name="new_pwd" /></div></dd>
			         </dl>
			         <dl class="cc">
			            <dt>重復新密碼</dt>
			            <dd class="ip"><div><input type="password" name="pwdreapt" /></div></dd>
			         </dl>
				</div>
				<dl class="cc" style="min-height:auto;height:auto;">
					<dt>&nbsp;</dt>
					<dd class="s6 tp" id="mobileauth_info" style="width:auto;">此服務免費，驗證碼將以手機短信的形式發送到您的手機上</dd>
					<!--錯誤的話，把前面這些文字替換成後面的錯誤代碼<div class="wrong">用戶名與手機號碼不匹配，請重新輸入</div>-->
				</dl>
			</div>

<!-- 
EOT;
}else{print <<<EOT
-->
			<dl class="cc">
				<dt>電子郵箱</dt>
				<dd class="ip"><div><input type="text" class="input" name="email" /></div></dd>
			</dl>
<!--
EOT;
}
if($db_ifsafecv){print <<<EOT
-->
			<dl class="cc">
				<dt>安全問題</dt>
				<dd class="ip">
					<select name="question" onChange="showcustomquest_0(this.value)" style="width:230px;margin-top:3px;">
						<option value="0">無安全問題</option><option value="1">我爸爸的出生地</option><option value="2">我媽媽的出生地</option><option value="3">我的小學校名</option><option value="4">我的中學校名</option><option value="5">我最喜歡的運動</option><option value="6">我最喜歡的歌曲</option><option value="7">我最喜歡的電影</option><option value="8" >我最喜歡的顏色</option><option value="-1">自定義問題</option>
					</select>
				</dd>
			</dl>
			<dl class="cc" id="customquest_o" style="display:none">
				<dt>自定義問題</dt>
				<dd class="ip">
        	<div><input type="text" class="input" name="customquest" /></div>
				</dd>
      </dl>
			<dl class="cc">
				<dt>您的答案</dt>
				<dd class="ip">
        	<div><input type="text" class="input" name="answer" /></div>
				</dd>
				<dd><div class="p5 s6">如果您設置了安全問題，需要填寫正確的答案才能找回密碼</div></dd>
      </dl>
<!--
EOT;
}if($db_gdcheck & 16){
$checkCode = L::loadClass('checkcode', 'site');
$checkCodeString = $checkCode->getCheckCodeTemplate();
print <<<EOT
-->
			<dl class="cc">
				<dt>驗證碼</dt>
				<dd class="ip ck">
					<div><input id="gdcode" class="input" name="gdcode" value="" onFocus="showgd();" /></div>
					<span id="ckcode" style="display:none"></span>
$checkCodeString
				</dd>
				<dd></dd>
			</dl>
<!--
EOT;
}print <<<EOT
-->
			<dl class="cc">
				<dt>&nbsp;</dt>
				<dd><span class="btn"><span><button type="submit">提 交</button></span></span></dd>
			</dl>
			
		</div>
		</form>
		</td></tr></table>
	</div>
</div>
<!-- 
EOT;
if($db_authstate && $db_authgetpwd){print <<<EOT
-->
<script>
var waitTime = parseInt('$waitTime');
var timeRemain = parseInt('$remainTime');
var authStep = parseInt('$authStep');
var authInfo = new Array("",
		"與服務器通信失敗,請稍候再試",
		"手機號碼輸入有誤",
		"您的帳戶尚未綁定手機認證",
		"你今天獲取驗證碼次數已達到上限",
		"驗證碼輸入有誤",
		"手機驗證碼不能為空",
		"手機號碼不匹配",
		"您的手機號碼已被列入黑名單"
);
function switchSetpwdType(type){
	if(type == 1){
		//手機取回
		getObj("setbyemail").style.display = 'none';
		getObj("setbymobile").style.display = '';
		if(getObj('verifyBox').style.display != 'none' || getObj('passwordBox').style.display != 'none'){
			getObj("dl_pwusername").style.display = 'none'
		}
	}else{
		getObj("setbyemail").style.display = '';
		getObj("setbymobile").style.display = 'none';
		getObj("dl_pwusername").style.display = ''
	}
}

/*手機認證找回密碼*/
var intval = null;
var btnGetVerify = getObj('btnGetVerify');
var mobile = getObj('authmobile');
var pwuser = getObj('pwuser');
var mobileTips = getObj('mobileauth_info');
var defaultMobileTips = '此服務免費，驗證碼將以手機短信的形式發送到您的手機上';
btnGetVerify.onclick = function(){/*獲取驗證碼事件*/
	if(pwuser.value == ''){
		mobileTips.innerHTML = '<div class="wrong">請輸入用戶名</div>';
	}else if(!/^1\d{10}$/.test(mobile.value)){
		mobileTips.innerHTML = '<div class="wrong">'+authInfo[2]+'</div>';
		mobile.onfocus = function(){mobileTips.innerHTML = defaultMobileTips;}
	}else{
		btnGetVerify.disabled = true;
		verify(mobile.value,pwuser.value);
	}
	return false;
}

if(authStep == 2){
	intval = setInterval("setCheckTime()",1000);
}

/*驗證*/
var authVerify = getObj('authverify');
getObj('verify').onclick = function(){
	getObj('verify').disabled = true;
	if(authVerify.value == ''){
		mobileTips.innerHTML = '<div class="wrong">請輸入驗證碼</div>';
		authVerify.onfocus = function(){mobileTips.innerHTML = defaultMobileTips;}
	}else{
		var url 	= location.href;
		var data 	= "action=checkverify&authmobile="+mobile.value+"&pwuser="+pwuser.value+"&authverify="+authVerify.value;
		ajax.send(url,data,function(){
			var response = parseInt(ajax.request.responseText);
			if (response > 0){
				getObj('mobileauth_info').innerHTML = '<div class="wrong">'+authInfo[response]+'</div>';;
			}else{
				/*驗證碼正確*/
				getObj('verifyBox').style.display = 'none';
				getObj('passwordBox').style.display = '';
				mobileTips.innerHTML = defaultMobileTips;
			}
		});
	}
	getObj('verify').disabled = false;
}

function setCheckTime() {
	timeRemain -= 1;
	if (timeRemain > 0) {
		getObj("timeRemainTips").innerHTML = '<font color="red">'+timeRemain+'秒</font>後重獲驗證碼';
	} else {
		clearInterval(intval);
		intval = null;
		timeRemain = waitTime;
		getObj("timeRemainTips").disabled = false;
		getObj("timeRemainTips").innerHTML = '重獲驗證碼';
		getObj("timeRemainTips").onclick=function(){
			getObj("timeRemainTips").disabled = true;
			verify(mobile.value,pwuser.value);
		};
	}
}

function verify(mobileNumber,username){
	var url 	= location.href;
	var data 	= "action=getverify&authmobile="+mobileNumber+"&pwuser="+pwuser.value;
	getObj('mobileauth_info').innerHTML = defaultMobileTips;
	ajax.send(url,data,function(){
		var response = parseInt(ajax.request.responseText);
		if (response > 0){
			getObj('mobileauth_info').innerHTML = '<div class="wrong">'+authInfo[response]+'</div>';;
		}else{
			/*成功獲取驗證碼*/
			getObj('verifyBox').style.display = '';
			getObj('mobileBox').style.display = 'none';
			getObj('dl_pwusername').style.display = 'none';
			getObj('mobileNumber').innerHTML = mobileNumber;
			getObj('usernameView').innerHTML = username;
			if(intval == null) intval = setInterval("setCheckTime()",1000);
		}
		getObj('btnGetVerify').disabled = false;
	});
}
setTimeout(
	function(){
		var obj = getObj('setPwdType');
		for(i=0;i<obj.options.length;i++){
			if(obj.options[i].value == obj.value){
				obj.options[i].selected=true;
			}
		}
		switchSetpwdType(obj.value);
	},100
);

//
//end 
</script>
<!--
EOT;
}print <<<EOT
-->
<script>
function showcustomquest_0(qid){
	getObj("customquest_o").style.display = qid==-1 ? '' : 'none';
}
</script>
</div></div><!--.main-wrap,#main End-->

</div>

</body></html>
<!--
EOT;
?>-->