首页 > 作文

PHP实现会员注册系统

更新时间:2023-04-09 01:11:50 阅读: 评论:0

分享一个基于php的非常简单基础的注册系统,为了减轻难度没有使用cookie和ssion,数据库大家按照自己需求更改,有问题欢迎联系我。

index.html

<!doctype html><html lang="en"><head> <meta chart="utf-8"> <title>title</title></head><body>  <a href="join_us.html" >  注册 </a> <h2>分开一下</h2> <a href="login.html" > 登录</a></body></html>

join_us.html

注册页面,发一个表单给add_member.php,使用post。

<!doctype html><html lang="en"><head> <meta chart="utf-8"> <title>title</title></head><body><h1>欢迎加入我们</h1><form action="add_member.php" method="post" name="register_form"> <table>  <tr>   <td>    用户名:   &减数和被减数怎么区分lt;/td>   <td>    <input name="member_name" type="text">   </td>  </tr>   <tr>   <td>    输入密码:   </td>   <td>    <input name="member_password" type="password">   </td>  </tr>  <tr>   <td><input type="submit" value="确定" >  </td> </table></form> </body></html>

add_member.php

稍微用了一下js,也可以用header(),仅测试使用,项目不要傻乎乎的给root权限。

<?php$account = $_post["member_name"];$password = $_qq头像 黑白post["member_password"];//获取字段信息 $link = mysqli_connect("127.0.0.1", "root", "") or die("连接失败");//连接数据库 mysqli_lect_db($link, "jack");//连接数据表  $sql = "lect * from info where name='$account'";$result = mysqli_query($link, $sql);//检索数据库同名账户 if (mysqli_num_rows($result) != 0) { mysqli_free_result($result); mysqli_clo($link); //释放空间  echo "<script>alert('该用户名已被使用');history.go(-1);</script>"; //返回 }//同名账户返回注册页 el { $sql = "inrt into info(name,password) values( '$account','$password' )"; mysqli_query($link, $sql); //写入  mysqli_free_result($result); mysqli_clo($link); //释放空间  echo"注册成功";}//非同名写入数据库?>

login.html

登录页面,发表单给check_password.php

<!doctype html><html lang="en"><head> <meta chart="utf-8"> <title>title</title></head><body><h2> 欢迎登录</h2><form action="check_password.php" method="post杜甫的代表作品" name="register_form"> <table>  <tr>   <td>    用户名:   </td>   <td>    <input name="member_name" type="text">   </td>  </tr>   <tr>   <td>    输入密码:   </td>   <td>    <input name="member_password" type="password">   </td>  </tr>  <tr>   <td><input type="submit" value="确定" >   </td> </table></form></body>&颈椎病的症状有哪些lt;/html>

check_password.php

验证密码

<?php$account = $_post["member_name"];$password = $_post["member_password"];//获取字段信息 $link = mysqli_connect("127.0.0.1", "root", "") or die("连接失败");//连接数据库 mysqli_lect_db($link, "jack");//连接数据表 $sql = "lect * from info where name='$account'and password='$password'";$result=mysqli_query($link,$sql); if (mysqli_num_rows($result) == 0) { mysqli_free_result($result); mysqli_clo($link); //释放空间  echo "<script>alert('账户或密码错误');history.go(-1);</script>"; //返回} el{ mysqli_free_result($result); mysqli_clo($link); //释放空间  echo "登录成功";  //建议在此处tcookie();}?>

都是很基础的东西,大家多多交流。

以上就是本文的全部活动标题内容,希望对大家的学习有所帮助,也希望大家多多支持www.887551.com。

本文发布于:2023-04-09 01:11:48,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/zuowen/e904f58c1a0a61b83922edb4ad1cd585.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

本文word下载地址:PHP实现会员注册系统.doc

本文 PDF 下载地址:PHP实现会员注册系统.pdf

标签:账户   空间   数据库   字段
相关文章
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图