PHP头条
热点:

php用户注册(前台完美js验证)


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;

*/
?>

<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>会员注册</title>
</head>

<body>
<div align="center"><font face="楷书" size="+3">会员注册</font></div>
<form id="form1" name="form1" method="get" action="register_get.php">
  <table width="695" border="1" align="center" cellpadding="1" cellspacing="1">
    <tr>
      <td width="167">账号:(account)</td>
      <td width="416"><input name="m_acct" type="text" id="m_acct" value="<?php if(!empty($_get['m_acct']))
echo $_get['m_acct'];
?>" maxlength="20" />
  <font color="#ff0000"> *</font>(由20个数字或字母组成)</td>
    </tr>
    <tr>
      <td>密码:(password)</td>
      <td><input name="m_pw" type="password" id="m_pw" maxlength="20" />
      <font color="#ff0000"> *</font>(由20个数字或字母组成)</td>
    </tr>
    <tr>
      <td>确认密码(password)</td>
      <td><input type="password" name="pass" id="pass" />
      <font color="#ff0000"> *</font>(再次输入密码)</td>
    </tr>
    <tr>
      <td>真实姓名:(name)</td>
      <td><input type="text" name="m_name" id="m_name" value="<?php if(!empty($_get['m_name']))
echo $_get['m_name'];
?>" /></td>
    </tr>
    <tr>
      <td>性别:(sex)</td>
      <td align="left"><p>
        <label>
          <input name="m_sex" type="radio" id="radiogroup1_0" value="男" />
          男</label>
        <label>
          <input type="radio" name="m_sex" value="女" id="radiogroup1_1" />
          女&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ff0000"> *</font></label>
</td>
    </tr>
    <tr>
      <td>学号:(school number)</td>
      <td><input type="text" name="m_snum" id="m_snum" value="<?php if(!empty($_get['m_snum']))
echo $_get['m_snum'];
?>" /></td>
    </tr>
    <tr>
      <td>手机号码:(mobil phone)</td>
      <td><input type="text" name="m_pnum" id="m_pnum" value="<?php if(!empty($_get['m_pnum']))
echo $_get['m_pnum'];
?>"/></td>
    </tr>
    <tr>
      <td>电子邮箱:(email)</td>
      <td><input type="text" name="m_email" id="m_email" value="<?php if(!empty($_get['m_email']))
echo $_get['m_email'];
?>"/></td>
    </tr>
    <tr>
      <td colspan="2" align="center"><input type="reset" name="button" id="button" value="重置表单" />
      <input type="submit" name="button2" id="button2" value="确定注册" /></td>
    </tr>
  </table>
</form></p>
<p align="center">以上打"*"为必填项</p>
</body>
</html>

register_get.php文件
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>提示</title>
</head>
<?php
if(empty($_get['m_acct']))
echo "账号不能为空!<a href='register.php?m_name=".$_get['m_name']."&m_sex=".$_get['m_sex']."&m_snum=".$_get['m_snum']."&m_pnum=".$_get['m_pnum']."'>返回重新注册。</a></p>";
else if(empty($_get['m_pw']))
echo "密码不能为空!<a href='register.php?m_acct=".$_get['m_acct']."&m_name=".$_get['m_name']."&m_sex=".$_get['m_sex']."&m_snum=".$_get['m_snum']."&m_pnum=".$_get['m_pnum']."&m_email=".$_get['m_email']."'>返回重新注册。</a></p>";
else if($_get['m_pw']!=$_get['pass'])
echo "两次输入的密码不一样,<a href='register.php?m_acct=".$_get['m_acct']."&m_name=".$_get['m_name']."&m_sex=".$_get['m_sex']."&m_snum=".$_get['m_snum']."&m_pnum=".$_get['m_pnum']."'>返回重新注册。</p>";
else if(empty($_get['m_sex']))
echo "未输入性别,<a href='register.php?m_acct=".$_get['m_acct']."&m_name=".$_get['m_name']."&m_snum=".$_get['m_snum']."&m_pnum=".$_get['m_pnum']."'>返回重新注册。</a></p>";
else if(!empty($_get['m_snum'])&&!is_numeric($_get['m_snum']))
echo "学号必须全为数字,<a href='register.php?m_acct=".$_get['m_acct']."&m_name=".$_get['m_name']."&m_sex=".$_get['m_sex']."&m_pnum=".$_get['m_pnum']."'>返回重新注册。</a></p>";
else if(!empty($_get['m_pnum'])&&!is_numeric($_get['m_pnum']))
echo "手机号码必须全为数字,<a href='register.php?m_acct=".$_get['m_acct']."&m_name=".$_get['m_name']."&m_sex=".$_get['m_sex']."&m_snum=".$_get['m_snum']."'>返回重新注册。</a></p>";
else if(!empty($_get['m_email'])&&!ereg("([0-9a-za-z]+)([@])([0-9a-za-z]+)(.)([0-9a-za-z]+)",$_get['m_email']))
echo "邮箱输入不合法!<a href='register.php?m_acct=".$_get['m_acct']."&m_name=".$_get['m_name']."&m_sex=".$_get['m_sex']."&m_snum=".$_get['m_snum']."&m_pnum=".$_get['m_pnum']."'>返回重新注册。</a></p>";
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'].",恭喜你注册成功,<a href='member_index.php'>马上进入主页面...</p>";
else
{
 $_session['pass']="no pass";
 echo "注册失败!<a href-'register.php'>重新注册。</a></p>";
 mysql_close();
}
}
?>
<body>
</body>
</html>

www.phpzy.comtrue/php/25672.htmlTechArticlephp用户注册(前台完美js验证) php用户注册(前台完美js验证) php教程用户注册(前台完美网页特效验证) /* create table `member` ( `member_account` varchar(25) collate utf8_unicode_ci not null, `member_...

相关文章

    暂无相关文章

PHP之友评论

今天推荐