php-注册页面



<!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 charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
<link href="bootstrap/css/bootstrap.css" rel="stylesheet" type="text/css" />
<script src="bootstrap/js/jquery.min.js" type="text/javascript"></script>
<script src="bootstrap/js/bootstrap.js" type="text/javascript"></script>
<title>用户注册</title>
</head>
<body>
<?php


/*
 * Created on 2016年8月23日
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */
//header('content-type:text/html;charset=utf-8');
// 包含ezSQL的核心文件
include_once "/lib/ez_sql_core.php";
// 包含ezSQL具体的数据库文件,这里以mySQL为例
include_once "/lib/ez_sql_mysql.php";
include_once "/lib/config.php";


$sUserId = $_POST["txtUserId"];
$sUserName = $_POST["txtUserName"];
$sPassword1 = $_POST["txtPassword1"];
$sPassword2 = $_POST["txtPassword2"];
$sWeiXin = $_POST["txtWeiXin"];
$sMobile = $_POST["txtMobile"];
$sParentUserId=$_POST["txtParentUserId"];
$sVerification = $_POST["txtVerification"];


if (empty ($sUserId)) {
echo "<script>alert('帐号不能为空!'); </script>";
echo "<script>window.location.href='register.php';</script>";
}


if (empty ($sUserName)) {
echo "<script>alert('昵称不能为空!'); </script>";
echo "<script>window.location.href='register.php'</script>";
}


if (empty ($sPassword1)) {
echo "<script>alert('密码不能为空!')</script>";
echo "<script>window.location.href='register.php'</script>";
}


if (empty ($sPassword2)) {
echo "<script>alert('密码不能为空!')</script>";
echo "<script>window.location.href='register.php'</script>";
}


$result=strcmp($sPassword1,$sPassword2);


if($result<>0)
{
echo "<script>alert('两次密码不相同!')</script>";
echo "<script>window.location.href='register.php'</script>";
}




if( strlen($sPassword1) <6 )
{
echo "<script>alert('密码長度不能小于6個字符')</script>";
echo "<script>window.location.href='register.php'</script>";
}


if(preg_match("/^[A-Za-z0-9]+$/",$sPassword1)){
     echo "<script>alert('密码至少含有一個特殊字符!')</script>";
      echo "<script>window.location.href='register.php'</script>";
}
 
if (empty ($sVerification)) {
echo "<script>alert('验证码不能为空!')</script>";
echo "<script>window.location.href='register.php'</script>";
}


//$SqlInsert = "insert into user_info (user_id,user_name,user_password,user_weixing,user_mobile,parent_user_id) values ('" . $sUserId . "','" . $sUserName ."''.$sPassword1."','".$sWeiXin."','".$sMobile."','".$sParentUserId."')";


$SqlInsert = "insert into user_info (user_id,user_name,user_password,user_weixin,user_mobile,parent_user_id) values('$sUserId','$sUserName','$sPassword1','$sWeiXin','$sMobile','$sParentUserId')";
echo $SqlInsert;


 


echo $dbconfig["DB_NAME"];


// 初始化数据库对象并建立数据库连接
$dbHelper = new ezSQL_mysql($dbconfig["DB_USER"], $dbconfig["DB_PWD"], $dbconfig["DB_NAME"], $dbconfig["DB_HOST"]);


$result=$dbHelper->query($SqlInsert);


if  ($result>0 )
{
echo "<script>alert('注册成功!')</script>";
echo "<script>window.location.href='index.php'</script>";
}
else
{
echo "<script>alert('注册失败!')</script>";
echo "<script>window.location.href='index.php'</script>";
}
?>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值