<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";
include_once "/lib/aes.php";
// 初始化数据库对象并建立数据库连接
$dbHelper = new ezSQL_mysql($dbconfig["DB_USER"],$dbconfig["DB_PWD"],$dbconfig["DB_NAME"],$dbconfig["DB_HOST"]);
$sUserId=$_POST["txtUserId"];
$sUserName=$_POST["txtUserName"];
$sPassword1=$_POST["txtPassword1"];
if (empty($sUserId))
{
echo "<script>alert('帳號不能為空!')</script>";
echo "<script>history.go(-1);</script>";
return;
}
if (empty($sUserName))
{
echo "<script>alert('帳號不能為空!')</script>";
echo "<script>history.go(-1);</script>";
return;
}
if (empty($sPassword1))
{
echo "<script>alert('密码不能為空!')</script>";
echo "<script>history.go(-1);</script>";
return;
}
$aes = new aes();
$aes->setKey('key');
/*
echo $sPassword1;
echo "加密字符".md5($sPassword1);
echo "加密字符".crypt($sPassword1);
*/
$s=$aes->encryptnew("abc","E","123");
echo "加密字符".$s;
$ss= $aes->encryptnew($s,"D","123");
echo "解密字符".$ss;
$sSqlQuery="select * from user_info where user_id='$sUserId' ";
echo $sSqlQuery;
$result=$dbHelper->query($sSqlQuery);
if ( $result>0 )
{
$sMessage=$sUserId."已存在!";
echo "<script>alert('".$sMessage."')</script>";
echo "<script>history.go(-1);</script>";
return;
}
$sSqlInsert="insert into user_info (user_id,user_name,user_password) values ('$sUserId','$sUserName','$s')";
echo $sSqlInsert;
$dbHelper->query($sSqlInsert);
$result=$dbHelper->query($sSqlInsert);
if ( $result>0 )
{
$sMessage=$sUserId."注册成功!";
echo "<script>alert('".$sMessage."')</script>";
echo "<script>window.location.href='index.php';</script>";
return;
}
else
{
$sMessage=$sUserId."注册失败!";
echo "<script>alert('".$sMessage."')</script>";
echo "<script>history.go(-1);</script>";
return;
}
?>
H5-register
最新推荐文章于 2022-07-31 01:50:02 发布