PHP development small forum tutorial registration PHP page
This page is to store the data passed from the registration page into the database

##The code is as follows
<?php
header("Content-type:text/html;charset=utf-8"); //设置编码
$servername = "localhost";
$username = "root";
$password = "root";
$dbname = "mybbs";
// 创建连接
$conn = mysqli_connect($servername, $username, $password, $dbname);
mysqli_set_charset($conn,'utf8'); //设定字符集
$username=$_POST['username'];
$password=md5($_POST['password']);
$email=trim($_POST['email']);
$log_time=date("Y-m-d H:i:s");
$sql1="SELECT * from menber where username='$username'";
$que=mysqli_query($conn,$sql1);
if($num){
echo"<script>alert('用户名已经被注册');location.href='reg.html';</script>";
}else{
$sql="INSERTinto member(username,password,email,log_time)VALUES
('$username','$password','$email','$log_time')";
$que=mysqli_query($conn,$sql);
$_SESSION['username']=$username;
echo "<script>console.log('注册成功');location.href='index.php';</script>";
}
?>Now our login and registration page is complete, hurry up and try it
new file
<?php
header("Content-type:text/html;charset=utf-8"); //设置编码
$servername = "localhost";
$username = "root";
$password = "root";
$dbname = "mybbs";
// 创建连接
$conn = mysqli_connect($servername, $username, $password, $dbname);
mysqli_set_charset($conn,'utf8'); //设定字符集
$username=$_POST['username'];
$password=md5($_POST['password']);
$email=trim($_POST['email']);
$log_time=date("Y-m-d H:i:s");
$sql1="select * from menber where username='$username'";
$que=mysqli_query($conn,$sql1);
if($num){
echo"<script>alert('用户名已经被注册');location.href='reg.html';</script>";
}else{
$sql="insert into member(username,password,email,log_time)VALUES
('$username','$password','$email','$log_time')";
$que=mysqli_query($conn,$sql);
$_SESSION['username']=$username;
echo "<script>console.log('注册成功');</script>";
}
?>
Preview
Clear
Students who have watched this course are also learning
Let's briefly talk about starting a business in PHP
Quick introduction to web front-end development
Large-scale practical Tianlongbabu development of Mini version MVC framework imitating the encyclopedia website of embarrassing things
Getting Started with PHP Practical Development: PHP Quick Creation [Small Business Forum]
Login verification and classic message board
Computer network knowledge collection
Quick Start Node.JS Full Version
The front-end course that understands you best: HTML5/CSS3/ES6/NPM/Vue/...[Original]
Write your own PHP MVC framework (40 chapters in depth/big details/must read for newbies to advance)





![Getting Started with PHP Practical Development: PHP Quick Creation [Small Business Forum]](https://img.php.cn/upload/course/000/000/035/5d27fb58823dc974.jpg)










The courseware is not available for download at the moment. The staff is currently organizing it. Please pay more attention to this course in the future~ 