Home > Article > Backend Development > PHP user registration (perfect js verification at the front desk)_PHP tutorial
php用户注册(前台完美js验证)
php教程用户注册(前台完美网页特效验证)
/*
create table `member` (
`member_account` varchar(25) collate utf8_unicode_ci not null,
`member_password` varchar(32) collate utf8_unicode_ci not null,
`member_name` varchar(20) collate utf8_unicode_ci not null,
`sex` varchar(1) collate utf8_unicode_ci not null,
`schoolnumber` varchar(10) collate utf8_unicode_ci not null,
`phonenumber` varchar(15) collate utf8_unicode_ci not null,
`email` varchar(50) collate utf8_unicode_ci not null,
unique key `member_account` (`member_account`)
) engine=innodb default charset=utf8 collate=utf8_unicode_ci;
*/
?>
会员注册
会员注册
The above fields marked with "*" are required
register_get.php file
Tips
if(empty($_get['m_acct']))
echo "The account cannot be empty!Return and re-register.";
else if(empty($_get['m_pw']))
echo "Password cannot be empty!Return Register.";
else if($_get['m_pw']!=$_get['pass'])
echo "The passwords entered twice are different,Return to register again.";
else if(empty($_get['m_sex']))
echo "No gender entered,Return and re-register.";
else if(!empty($_get['m_snum'])&&!is_numeric($_get['m_snum']))
echo "The student ID must be all numbers,Return to re-register.";
else if(!empty($_get['m_pnum'])&&!is_numeric($_get['m_pnum']))
echo "Mobile phone numbers must be all digits,Return to re-register.";
else if(!empty($_get['m_email'])&&!ereg("([0-9a-za-z]+)([@])([0-9a-za-z]+)(. )([0-9a-za-z]+)",$_get['m_email']))
echo "The email input is illegal!Return and re-register." ;
else
{
require_once ('inc.php');
$_session['pass']="ok";
$_session['member']=$_get['m_acct'];
$link = getdblink();
$sql="insert into member values('".$_get['m_acct']."','".md5($_get['m_pw'])."','".$_get['m_name'] ."','".$_get['m_sex']."','".$_get['m_snum']."','".$_get['m_pnum']."','".$ _get['m_email']."')";
$result=mysql tutorial_query($sql)or die(mysql_error());
if($result>0)
echo "".$_get['m_name'].", Congratulations on your successful registration, Enter the main page immediately...";
else
{
$_session['pass']="no pass";
echo "Registration failed!Re-register.";
mysql_close();
}
}
?>