php用户注册(前台完美js验证)
程序员文章站
2022-05-27 10:16:18
...
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;
*/
?>
会员注册
会员注册
以上打"*"为必填项
register_get.php文件
提示
if(empty($_get['m_acct']))
echo "账号不能为空!返回重新注册。";
else if(empty($_get['m_pw']))
echo "密码不能为空!返回重新注册。";
else if($_get['m_pw']!=$_get['pass'])
echo "两次输入的密码不一样,返回重新注册。";
else if(empty($_get['m_sex']))
echo "未输入性别,返回重新注册。";
else if(!empty($_get['m_snum'])&&!is_numeric($_get['m_snum']))
echo "学号必须全为数字,返回重新注册。";
else if(!empty($_get['m_pnum'])&&!is_numeric($_get['m_pnum']))
echo "手机号码必须全为数字,返回重新注册。";
else if(!empty($_get['m_email'])&&!ereg("([0-9a-za-z]+)([@])([0-9a-za-z]+)(.)([0-9a-za-z]+)",$_get['m_email']))
echo "邮箱输入不合法!返回重新注册。";
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教程_query($sql)or die(mysql_error());
if($result>0)
echo "".$_get['m_name'].",恭喜你注册成功,马上进入主页面...";
else
{
$_session['pass']="no pass";
echo "注册失败!重新注册。";
mysql_close();
}
}
?>