<?php
!function_exists('html') && exit('ERR');
header('Content-Type: text/html; charset=big5');
if($type=='name'){
	if($name==''){
		die("請輸入帳號,不能為空");
	}
	if (strlen($name)>30 || strlen($name)<3){
		die("帳號不能小于3個字符或大于30個字符");
	}
	$S_key=array('|',' ','　',"'",'"','/','*',',','~',';','<','>','$',"\\","\r","\t","\n","`","!","?","%","^");
	foreach($S_key as $value){
		if (strpos($name,$value)!==false){ 
			die("用戶名中包含有禁止的符號“{$value}”"); 
		}
	}
	if($db->get_one("SELECT * FROM $TB[table] WHERE `$TB[username]`='$name'")){
		die("<font color='blue'>$name</font>,已經被注冊了,請更換一個");
	}
	die("<font color=red>恭喜你,此帳號可以使用!</font>");
}elseif($type=='email'){
	if($name==''){
		die("請輸入郵箱,不能為空");
	}
	if (!ereg("^[-a-zA-Z0-9_\.]+\@([0-9A-Za-z][0-9A-Za-z-]+\.)+[A-Za-z]{2,5}$",$name)) {
		die("郵箱不符合規則"); 
	}
	die("<font color=red>恭喜你,此郵箱可以使用!</font>");
}elseif($type=='pwd'){
	if($name==''){
		die("請輸入密碼,不能為空");
	}
	if (strlen($name)>30 || strlen($name)<6){
		die("密碼不能小于6個字符或大于30個字符");
	}
	$S_key=array('|',' ','　',"'",'"','/','*',',','~',';','<','>','$',"\\","\r","\t","\n","`","!","?","%","^");
	foreach($S_key as $value){
		if (strpos($name,$value)!==false){ 
			die("密碼中包含有禁止的符號“{$value}”"); 
		}
	}
	die("<font color=red>恭喜你,此密碼可以使用!</font>");
}
?>