Location: PHPKode > projects > Uchome and Discuz > template/default/do_register.htm
<!--{eval $_TPL['nosidebar']=1;}-->
<!--{template header}-->

<script>
	function register(id, result) {
		if(result) {
			$('registersubmit').disabled = true;
			window.location.href = "$jumpurl";
		} else {
			updateseccode();
		}
	}
</script>

<form id="registerform" name="registerform" action="do.php?ac=$_SCONFIG[register_action]&$url_plus&ref" method="post" class="c_form">
<table cellpadding="0" cellspacing="0" class="formtable">
<tr><td><img src="\image\ureg.png"></td>
<td><h1>Hi there!</h1>
<p>We'll get you set up your account! In one easy step! Just answer a few simple questions.<br> Select an ID and password, and you'll be all set</td></tr>
	<caption>
		<h2>Create an Account</h2>
		<p>Connect & Share with your friends or MEet new Cool Peoples, share Photo,Blogs,Music or anything from all over the web,Create your own Profile, get the latest update about them, you can even play interesting games together. Becuase here all Fun and share matters. Fill in the form below to get started (all fields are required)¡£</p>
	</caption>
	<!--{if $invitearr}-->
	<tr>
		<th width="100">Friend invitation</th>
		<td>
			<a href="space.php?$url_plus" target="_blank"><!--{avatar($invitearr[uid],small)}--></a>
			<a href="space.php?$url_plus" target="_blank">{$_SN[$invitearr[uid]]}</a>
		</td>
	</tr>
	<!--{/if}-->
	
	<!--{if $_SCONFIG['seccode_register']}-->
	<!--{if $_SCONFIG['questionmode']}-->
	<tr>
		<th style="vertical-align: top;">Answer the below Question</th>
		<td>
			<p><!--{eval question();}--></p>
			<input type="text" id="seccode" name="seccode" value="" class="t_input" onBlur="checkSeccode()" tabindex="1" autocomplete="off" />&nbsp;<span id="checkseccode">&nbsp;</span>
		</td>
	</tr>
	<!--{else}-->
	<tr>
		<th style="vertical-align: bottom;">Verification Code</th>
		<td>
			<script>seccode();</script>
			<p>Type 4 letters or numbers<br>Can't read above? <a href="javascript:updateseccode()">Try different image</a></p>
			<input type="text" id="seccode" name="seccode" value="" class="t_input" onBlur="checkSeccode()" tabindex="1" autocomplete="off" />&nbsp;<span id="checkseccode">&nbsp;</span>
		</td>
	</tr>
	<!--{/if}-->
	<!--{/if}-->
	
	<tr><th width="100">User Name: </th><td><input type="text" id="username" name="username" value="" class="t_input" onBlur="checkUserName()" tabindex="2" />&nbsp;<span id="checkusername">&nbsp;</span></td></tr>
	<tr>
		<th>Password: </th>
		<td>
			<input type="password" name="password" id="password" value="" class="t_input" onBlur="checkPassword()" onkeyup="checkPwd(this.value);" tabindex="3" />&nbsp;<span id="checkpassword">&nbsp;</span><br/>
			<style>
				.psdiv0,.psdiv1,.psdiv2,.psdiv3,.psdiv4{position:relative;height:30px;color:#666}/*ÃÜÂëÇ¿¶ÈÈÝÆ÷*/
				.strongdepict{position:absolute; width:300px;left:0px;top:3px}/*ÃÜÂëÇ¿¶È¹Ì¶¨ÎÄ×Ö*/
				.strongbg{position:absolute;left:0px;top:22px;width:235px!important;width:234px;height:10px;background-color:#E0E0E0; font-size:0px;line-height:0px}/*»ÒÉ«Ç¿¶È±³¾°*/
				.strong{float:left;font-size:0px;line-height:0px;height:10px}/*É«¿é±³¾°*/
				
				.psdiv0 span{display:none}
				.psdiv1 span{display:inline;color:#F00}
				.psdiv2 span{display:inline;color:#C48002}
				.psdiv3 span{display:inline;color:#2CA4DE}
				.psdiv4 span{display:inline;color:#063}
				
				.psdiv0 .strong{ width:0px}
				.psdiv1 .strong{ width:25%;background-color:#F00}
				.psdiv2 .strong{ width:50%;background-color:#F90}
				.psdiv3 .strong{ width:75%;background-color:#2CA4DE}
				.psdiv4 .strong{ width:100%;background-color:#063}
			</style>
			<div class="psdiv0" id="chkpswd">
				<div class="strongdepict">Password security Level: <span id="chkpswdcnt">Too short</span></div>
				<div class="strongbg">
					<div class="strong"></div>			
				</div>		
			</div>
		</td>
	</tr>
	<tr><th>Re-type password: </th><td><input type="password" id="password2" name="password2" value="" class="t_input"  onBlur="checkPassword2()" tabindex="4" />&nbsp;<span id="checkpassword2">&nbsp;</span></td></tr>
	<tr><th>E-mail</th><td><input type="text" id="email" name="email" value="@" class="t_input" tabindex="5" />
		<br><strong>Warning:</strong> Provide valid e-mail address</td></tr>
	
	<!--{if $register_rule}-->
	<tr><th>Terms of Service</th>
		<td><div name="rule" style="border:1px solid #C3C3C3;width:500px;height:100px;overflow:auto;padding:5px;">$register_rule</div>
		<input type="checkbox" name="accede" id="accede" value="1"> I accept the Terms of Use
		<script type="text/javascript">
			function checkClause() {
				if($('accede').checked) {
					return true;
				} else {
					alert("You must agree to the Terms of Service before registration");
					return false;
				}
			}
		</script>
		</td>
	</tr>
	<!--{/if}-->

	<tr><th>&nbsp;</th>
		<td>
		<input type="hidden" name="refer" value="space.php?do=home" />
		<input type="submit" id="registersubmit" name="registersubmit" value="Create My Account" class="submit" onclick="<!--{if $register_rule}-->if(!checkClause()){return false;}<!--{/if}-->ajaxpost('registerform', 'register');" tabindex="6" />
		</td>
	</tr>
	<tr><th>&nbsp;</th><td id="__registerform" style="color:red; font-weight:bold;"></td></tr>
</table>
<input type="hidden" name="formhash" value="<!--{eval echo formhash();}-->" /></form>

<script type="text/javascript">
<!--
	$('username').focus();
	var lastUserName = lastPassword = lastEmail = lastSecCode = '';
	function checkUserName() {
		var userName = $('username').value;
		if(userName == lastUserName) {
			return;
		} else {
			lastUserName = userName;
		}
		var cu = $('checkusername');
		var unLen = userName.replace(/[^\x00-\xff]/g, "**").length;

		if(unLen < 3 || unLen > 15) {
			warning(cu, unLen < 3 ? 'Username should be beteen 3 to 15 characters inlcuing number');
			return;
		}
		ajaxresponse('checkusername', 'op=checkusername&username=' + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(userName) : userName));
	}
	function checkPassword(confirm) {
		var password = $('password').value;
		if(!confirm && password == lastPassword) {
			return;
		} else {
			lastPassword = password;
		}
		var cp = $('checkpassword');
		if(password == '' || /[\'\"\\]/.test(password)) {
			warning(cp, 'Password empty or contains illegal characters');
			return false;
		} else {
			cp.style.display = '';
			cp.innerHTML = '<img src="image/check_right.gif" width="13" height="13">';
			if(!confirm) {
				checkPassword2(true);
			}
			return true;
		}
	}
	function checkPassword2(confirm) {
		var password = $('password').value;
		var password2 = $('password2').value;
		var cp2 = $('checkpassword2');
		if(password2 != '') {
			checkPassword(true);
		}
		if(password == '' || (confirm && password2 == '')) {
			cp2.style.display = 'none';
			return;
		}
		if(password != password2) {
			warning(cp2, 'password do not match in above both field, it should be same');
		} else {
			cp2.style.display = '';
			cp2.innerHTML = '<img src="image/check_right.gif" width="13" height="13">';
		}
	}
	function checkSeccode() {
		var seccodeVerify = $('seccode').value;
		if(seccodeVerify == lastSecCode) {
			return;
		} else {
			lastSecCode = seccodeVerify;
		}
		ajaxresponse('checkseccode', 'op=checkseccode&seccode=' + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(seccodeVerify) : seccodeVerify));
	}
	function ajaxresponse(objname, data) {
		var x = new Ajax('XML', objname);
		x.get('do.php?ac=$_SCONFIG[register_action]&' + data, function(s){
			var obj = $(objname);
			s = trim(s);
			if(s.indexOf('succeed') > -1) {
				obj.style.display = '';
				obj.innerHTML = '<img src="image/check_right.gif" width="13" height="13">';
				obj.className = "warning";
			} else {
				warning(obj, s);
			}
		});
	}
	function warning(obj, msg) {
		if((ton = obj.id.substr(5, obj.id.length)) != 'password2') {
			$(ton).select();
		}
		obj.style.display = '';
		obj.innerHTML = '<img src="image/check_error.gif" width="13" height="13"> &nbsp; ' + msg;
		obj.className = "warning";
	}

	function checkPwd(pwd){

		if (pwd == "") {
			$("chkpswd").className = "psdiv0";
			$("chkpswdcnt").innerHTML = "";
		} else if (pwd.length < 3) {
			$("chkpswd").className = "psdiv1";
			$("chkpswdcnt").innerHTML = " Too short ";
		} else if(!isPassword(pwd) || !/^[^%&]*$/.test(pwd)) {
			$("chkpswd").className = "psdiv0";
			$("chkpswdcnt").innerHTML = "";
		} else {
			var csint = checkStrong(pwd);
			switch(csint) {
				case 1:
					$("chkpswdcnt").innerHTML = "Weak";
					$( "chkpswd" ).className = "psdiv"+(csint + 1);
					break;
				case 2:
					$("chkpswdcnt").innerHTML = "Ordinary";
					$( "chkpswd" ).className = "psdiv"+(csint + 1);
					break;
				case 3:		
					$("chkpswdcnt").innerHTML = "Strong";
					$("chkpswd").className = "psdiv"+(csint + 1);
					break;
			}
		}
	}
	function isPassword(str){
		if (str.length < 3) return false;
		var len;
		var i;
		len = 0;
		for (i=0;i<str.length;i++){
			if (str.charCodeAt(i)>255) return false;
		}
		return true;
	}
	function charMode(iN){ 
		if (iN>=48 && iN <=57) //Êý×Ö 
		return 1; 
		if (iN>=65 && iN <=90) //´óд×Öĸ 
		return 2; 
		if (iN>=97 && iN <=122) //Сд 
		return 4; 
		else 
		return 8; //ÌØÊâ×Ö·û 
	} 
	//¼ÆËã³öµ±Ç°ÃÜÂëµ±ÖÐÒ»¹²ÓжàÉÙÖÖģʽ 
	function bitTotal(num){ 
		modes=0; 
		for (i=0;i<4;i++){ 
			if (num & 1) modes++; 
			num>>>=1; 
		} 
		return modes; 
	} 

	//·µ»ØÃÜÂëµÄÇ¿¶È¼¶±ð 
	function checkStrong(pwd){ 
		modes=0; 
		for (i=0;i<pwd.length;i++){ 
			//²âÊÔÿһ¸ö×Ö·ûµÄÀà±ð²¢Í³¼ÆÒ»¹²ÓжàÉÙÖÖģʽ. 
			modes|=charMode(pwd.charCodeAt(i)); 
		} 
		return bitTotal(modes);
	}
//-->
</script>

<!--{template footer}-->
Return current item: Uchome and Discuz