注冊頁面,我加了一個驗證碼,出現了問題
我加了驗證碼,就注冊不了,返回的$row=insert("imooc_user",$arr);函數的id為0
function reg(){
$arr=$_POST;
$arr['password']=md5($_POST['password']);
$arr['regTime']=time();
$path="./uploads/userFace";
$uploadFile=uploadFile($path);
print_r($uploadFile);
// $verify=$_SESSION['verify'];
// $verify1=$_POST['verify'];
// if(strtolower($verify)==strtolower($verify1)){
if($uploadFile&&is_array($uploadFile)){
$arr['face']=$uploadFile[0]['name'];
}else{
return "注冊失敗";
}
//print_r($arr);exit;
$row=insert("imooc_user",$arr);
print_r($row);
if($row){
$mes="注冊成功!<br/>3秒鐘后跳轉到登陸頁面!<meta http-equiv='refresh' content='3;url=login.php'/>";
}else{
$filename=$path."/".$uploadFile[0]['name'];
if(file_exists($filename)){
unlink($filename);
}
$mes="注冊失敗!<br/><a href='reg.php'>重新注冊</a>|<a href='index.php'>查看首頁</a>";
}
// }else{
// return "驗證碼錯誤!<br/>3秒鐘后跳轉回注冊頁面!<meta http-equiv='refresh' content='3;url=reg.php'/>";
// }
return $mes;
}