-4
extract($_POST);
// determine whether phone number is valid and print
// an error message if not
if ([email protected]("^[0-9]{3}-[0-9]{7}$", $phone))
{
echo("<SCRIPT LANGUAGE='JavaScript'>
window.alert('Please insert a valid phone number with (xxx-xxxxxxx) format.')
window.location.href='';
</SCRIPT>");
}
else if ([email protected]_match('/^(?=.*\d{3,})(?=.*[A-Za-z]{5,})[[email protected]#$%]{8,32}$/', $pass))
{
echo("<SCRIPT LANGUAGE='JavaScript'>
window.alert('Password must be at least 8 characters long and must contain at least 1 number and 1 letter')
window.location.href='';
</SCRIPT>");
}
我不確定上面的代碼有什麼問題,但我似乎無法得到正確的密碼值?它持續顯示相同的錯誤消息正則表達式PHP與密碼長度爲8,至少有一個大寫字母,數字nd字母
'extract($ _ POST)'是非常危險的,你一定會用你的代碼破解你的服務器。 –
看看答案是否適合你 – rock321987