2 Star 5 Fork 0

学生党蓝猫 蓝猫科技工作室账号 / 蓝猫智慧云社区

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
Clone or Download
register.php 1.56 KB
Copy Edit Raw Blame History
<?php
header('content-type:text/html;charset=utf-8');
//注册页面
require 'login_db_connect.php';//连接数据库
//判断表单是否提交,用户名密码是否提交
if (isset($_POST['username'])&&isset($_POST['pwd'])){//登录表单已提交
//获取用户输入的用户名密码
$user=$_POST["username"];
$pwd=$_POST["pwd"];
//判断提交账号密码是否为空
if ($user=='' || $pwd==''){
exit('草,你账号或密码没输,快点输入!');
}else {
$sql="insert into user(username,password) values ('$user','$pwd');";//添加账户sql语句
$select="select username from user where username='$user'";
$result=mysqli_query($con, $select);//执行sql语句
$row=mysqli_num_rows($result);//返回记录数
if(!$row){//记录数不存在则说明该账户没有被注册过
if (mysqli_query($con,$sql)){//查询insert语句是否成功执行,成功将返回 TRUE。如果失败,则返回 FALSE。
//跳转登录页面
echo "<script>alert('注册成功,我懒得帮你登录,你自己登录吧');location='demo/login.php'</script>";
}else{//失败则重新跳转注册页面
echo "<script>alert('服务器被砸了,没法注册');location='demo/regsiter.php'</script>";
}
}else{//存在记录数则说明注册的用户已存在
echo "<script>alert('你为什么非要重名啊啊啊');location='demo/login.php'</script>";
}
}
}
require './register.php';
PHP
1
https://gitee.com/Mycatblue/cat-discu.git
git@gitee.com:Mycatblue/cat-discu.git
Mycatblue
cat-discu
蓝猫智慧云社区
master

Search