验证用户名、密码和日期

function is_valid_username($username){
// accepted username length between 5 and 20
 if (preg_match('/^\w{5,20}$/', $username))
 return true;
 else
 return false;
}
function is_valid_password($pwd){
// accepted password length between 5 and 20, start with character.
 if (preg_match("/^[a-zA-Z][0-9a-zA-Z_!$@#^&]{5,20}$/", $pwd))
 return true;
 else
 return false;
}
function is_valid_date($date){
//============ date format dd-mm-yyyy
if(preg_match("/^(\d{2})-(\d{2})-(\d{4})$/", $date, $sdate))
 if(checkdate($sdate[2], $sdate[1], $sdate[3]))
 return true;
}

猜你喜欢

转载自blog.csdn.net/u014413032/article/details/41193363