当前位置:首页 » 编程语言 » php登录注册系统

php登录注册系统

发布时间: 2022-11-03 10:56:34

A. php 实现注册登录系统

其实楼主要的代码网上有很多。你没有给出具体要实现注册的信息,所以只找了这个代码。楼主可以根据具体情况自己修改代码。
①注册模块:
http://hi..com/oldjunren/blog/item/2709e606841fbfca7a894774.html
②登陆模块
http://hi..com/oldjunren/blog/item/79c827cf1e398c3eb700c871.html
③PHP 防范sql注入漏洞http://hi..com/oldjunren/blog/item/6540b734b207be1691ef3961.html
希望楼主成功。

B. 如何用PHP制作一个邀请注册+登陆系统

这个和验证码是一个道理啊 0123456789随机排列然后登陆验证就可以

C. php实现用户注册和登入,不用做效果求大牛指导

登陆界面 login.php
<form action="logincheck.php" method="post">
用户名:<input type="text" name="user"/><br/>
密码:<input type="password" name="pass"/><br/>
<input type="submit" name="sub" value="登陆"/>
<a href="register.php">注册</a>
</form>
登陆处理界面logincheck.php
<?php
mysql_connect('localhost','root','');
mysql_select_db('test');
mysql_query("set names 'gbk'");
$nsql="select username,passwd,nick from userinfo where username = '$_POST[user]' and passwd = '$_POST[pass]'";
$result = mysql_query($nsql);
$num = mysql_num_rows($result);
if($num){
$row = mysql_fetch_array($result);
echo "欢迎您,$row[2]";

}else{
echo"<script>alert('用户名或密码不正确');history.go(-1);</script>";
}
?>
注册界面register.php
<form action="regcheck.php" method="post">
用户名:<input type="text" name="user"/><br/>
密码:<input type="password" name="pass"/><br/>
昵称:<input type="text" name="nick"/><br/>
<input type="submit" name="sub" value="注册"/>
</form>
注册处理界面regcheck.php
<?php
mysql_connect('localhost','root','');
mysql_select_db('test');
mysql_query("set names 'gbk'");
$nsql="select username from userinfo where username = '$_POST[user]'";
$result = mysql_query($nsql);
$num = mysql_num_rows($result);
if($num){
echo "<script>alert('用户名已存在注册失败');history.go(-1);</script>";
}else{
$isql = "insert into userinfo values('$_POST[user]','$_POST[pass]','$_POST[nick]')";
mysql_query($isql);
echo"<script>alert('注册成功');history.go(-1);</script>";
}
?>

D. 用PHP做登陆注册页面

登录页:login.php
<?php
include("conn.php");
$username=$_POST['name'];
$password=$_POST['password'];
$yanzheng=$_POST['yanzheng'];

if(isset($_POST['submit']))
{
$sql=("select username,password from member where username='$username' and password='$password'") or die("sql语句执行失败");
//print_r($sql);
$ar=mysql_query($sql);
if($ar)
{
if($row=mysql_fetch_array($ar))
{
session_start();
if($_POST["yanzheng"])
{
if($yanzheng!=$_session[pic]||$yanzheng=="")
{
echo "验证码输入有误";
exit;
}
if($yanzheng==$_session[pic])
{
header("location:index.php");
}
}
}
else
{
echo "用户名或密码错误";
}
}
}

?>

<form action="login.php" method="post">
<table border=1 align=center width=500 height=300 bgColor=#DFFFDF bordercolor=#fffbec>
<tr>
<td colspan=2 align=center>用户登录</td>
</tr>
<tr>
<td>用户姓名:</td>
<td><input type="text" name="name" id="name"/></td>
</tr>
<tr>
<td>用户密码:</td>
<td><input type="password" name="password" id="password"/></td>
</tr>
<tr>
<td>验证码:</td>
<td><input type="text" name="yanzheng" id="yanzheng"/>
<img src="yanzheng1.php" width="50" height="30"></img>
</td>
</tr>
<tr>
<td colspan=3 align=center>
<input type="submit" name="submit" value="登录"/>
<input type="reset" name="reset" value="重置"/>
<a href="register.php">注册</a>
</td>
</tr>
</table>
</form>

注册页:register.php

<?php
include("conn.php");
if(isset($_POST['submit'])&&$_POST['submit']) {
if($_POST['username']=='')
{
echo "用户名不能为空";
exit();
}
if($_POST['password']=='')
{
echo "密码不能为空";
exit();
}
if($_POST['realpass']!=$_POST['password'])
{
echo "两次密码输入不一致";
exit();
}

$sql="insert into member(username,real_name,password,email,headimg) values('$_POST[username]','$_POST[username]','$_POST[password]','$_POST[email]','')";
$ar=mysql_query($sql);
if($ar)
{
header("location:index.php");
}
else
{
echo mysql_error();
}
}
?>
<body>
<form action="register.php" method="post">
<table border=1 align=center width=500>
<tr>
<td height=40 bgColor=#DFFFDF colspan=2>会员注册 [<a href="login.php">返回登录页</a>]</td>
</tr>
<tr>
<td height=40 bgColor=#fffbec >会员ID</td>
<td><input type="text" name="username" id="username"/></td>
</tr>
<tr>
<td height=40 bgColor=#fffbec>密码</td>
<td><input type="password" name="password" id="password"/></td>
</tr>
<tr>
<td height=40 bgColor=#fffbec>确认密码</td>
<td>
<input type="password" name="realpass" id="realpass"/>
</td>
</tr>
<tr>
<td height=40 bgColor=#fffbec>EMAIL</td>
<td><input type="text" name="email" id="email"/>

</tr>
<tr>
<td height=40 bgColor=#fffbec></td>
<td><input type="submit" name="submit" value="注册"/><input type="reset" value="重置"></td>
</tr>
</table>
</form>
</body>

主页显示:index.php
<?php
include("conn.php");
function cutstr($str,$cutleng)
{
$str = $str; //要截取的字符串
$cutleng = $cutleng; //要截取的长度
$strleng = strlen($str); //字符串长度
if($cutleng>$strleng)return $str;//字符串长度小于规定字数时,返回字符串本身
$notchinanum = 0; //初始不是汉字的字符数
for($i=0;$i<$cutleng;$i++)
{
if(ord(substr($str,$i,1))<=128)
{
$notchinanum++;
}
}
if(($cutleng%2==1)&&($notchinanum%2==0)) //如果要截取奇数个字符,所要截取长度范围内的字符必须含奇数个非汉字,否则截取的长度加一
{
$cutleng++;
}
if(($cutleng%2==0)&&($notchinanum%2==1)) //如果要截取偶数个字符,所要截取长度范围内的字符必须含偶数个非汉字,否则截取的长度加一
{
$cutleng++;
}
return substr($str,0,$cutleng);
}
?>
<html>
<head>
<script type="text/javascript">
function All(e, itemName)
{
var aa = document.getElementsByName(itemName);
for (var i=0; i<aa.length; i++)
aa[i].checked = e.checked; //得到那个总控的复选框的选中状态
}
function Item(e, allName)
{
var all = document.getElementsByName(allName)[0];
if(!e.checked) all.checked = false;
else
{
var aa = document.getElementsByName(e.name);
for (var i=0; i<aa.length; i++)
if(!aa[i].checked) return;
all.checked = true;
}
}
</script>
</head>
<?php
include("conn.php");
if(isset($_POST['del']))
{
$mm = $_POST["selected"];
$id =implode(",",$mm);
$sql = "delete from forums where id in(".$id.")";
//echo $sql;
$result=mysql_query($sql);
echo $result?"删除成功":"删除失败";
}
?>
<table style="BORDER-BOTTOM-WIDTH: 1px; BORDER-COLLAPSE: collapse" cellSpacing=0 cellPadding=0 width=600 align=center border=1 bordercolor=#ddddff>
<tr align=middle>
<td height=40 bgColor=#DFFFDF colspan=3>论坛列表</td>
</tr>
<tr>
<td colspan=3><a href="login.php" style="float:right">[退出系统]</a><a href="add_forum.php" style="float:right">[添加论坛]</a></td>
<td></td>
</tr>
<tr align=middle>
<td height=40 bgColor=#DFFFDF width=80>状态</td>
<td height=40 bgColor=#DFFFDF>论坛</td>
<td height=40 bgColor=#DFFFDF>最后更新</td>
</tr>
<?php
$sql="select * from forums";
$result=mysql_query($sql);
$num=mysql_num_rows($result);
if($num>0)
{
while($row=mysql_fetch_array($result)){
?>
<tr align=middle>
<td bgColor=#fffbec><input type="checkbox" name="selected" value="1"/></td>
<td height=50 bgColor=#fffbec width=300>
<?php
echo "<div><a href=\"forums.php?F=".$row['ID']."\">".$row['forum_name']."</a></div>";
echo cutstr($row['forum_description'],24);//最多显示24个字节,12个字,多余部分用省略号代替
echo "……";
?>
</td>
<td height=50 bgColor=#fffbec><div><?php echo $row['last_post_time']."by".$row['last_post_author']?></div></td>

</tr>
<?php
}
}
else
{
echo "<tr bgColor=#fffbec><td colspan=3>对不起,论坛尚在创建中……</td></tr>";
}
?>
<tr>
<td colspan=3> <input type="checkbox" name="selected" value="1" onclick="All(this,'selected')"/>全选/不全选</td>
</tr>
<tr>
<td><input type="button" name="del" id="del" value="删除选中项"/>
<?php

?>
</td>
</tr>
</table>
</html>

数据库你就自己建,望采纳~

E. php简单网站的登录和注册怎么写

  • 注册:

    用户名 :手机号或者邮箱

    密码:规定6-16位字符或者6-12位,不能出现_、等字符,规定只能数字和英文字符组成

    验证码:随机图片

    ajax提交时验证用户名是否合法(邮箱或手机号验证)。去掉首尾空白。判断数据格式(过滤html标签,防止sql注入)

    判断密码格式和长度

    判断验证码正确

    三者都正确。提交到后台处理:

    查询用户名是否存在,如果存在,不能注册,返回页面。如果不存在则将密码加密处理(md5或者哈希加密生成一段密文,然后输入密码拼接生成的密文存入数据库更保险)

    插入成功成功,返回登录界面。

  • 登录:

    和注册一样判断用户名。

    提交到后台

    后台可以用mysql_real_escape_string()函数对用户名和密码进行转义,防止sql注入

    密码同样道理加密。去数据库查询用户名和密码,返回成功,则将用户id号和用户名存入session里。跳转页面。

F. 怎么用PHP+MYSQL做注册和登陆系统,要详细哦!

login.html
<body>
<form action="index.php" method="post">
<input type="text" name="username" id="username" />
<input type="submit" name="Submit" id="Submit" value="登陆" />
</form>
</body>

index.php

<?php
if($_POST['username'] == '')
echo '您的登陆名不能为空。<a href="login.html">请重新填写</a>';
else
echo '您的登陆名是:' . $_POST['username'];
?>

<?
include "conn/conn.php";
$UserName=$_POST["UserName"];
$mima1=$_POST["mima1"];
$mima2=$_POST["mima2"];
$xin=$_POST["xin"];
$nian=$_POST["nian"];
$dianhua=$_POST["dianhua"];
$email=$_POST["email"];
$qq=$_POST["qq"];
$sql="INSERT INTO 'my_china'.'chuche' ('id','UserName' ,'mima1' ,'mima2' ,'xin' ,'nian' ,'dianhua' ,'email' ,'qq' )VALUES (NULL , '$UserName', '$mima1', '$mima2', '$xin', '$nian', '$dianhua', '$email', '$qq')";
mysql_query($sql);
echo "<script> alert('用户注册成功!');</script>";
echo "<script> window.location='zc.php';</script>";
?>

G. 做一个简单的php 注册登陆界面

你会php吗?会的话这边给你个思路,然后根据这思路来写。首先注册效果是;1、做好注册页面,放置你要的表单,给你的每一个表单取一个名字(名字自定义,不重复即可)。2、用$_post或$_get来提交到php接收页面。3、在php页面里面首先是接收你注册页面过来的信息,用$_POST["表单名字"]或$_GET["表单名字"]方法来接。4、执行sql语句了,把接过来的内容写进数据库就ok了。(insert into );登陆页就是提交过来的数据跟数据库里面的数据进行比对的过程,这个没多少代码。把提交过来的数据,通过php接过来之后跟数据库里面的数据库进行查找比对。一致就登陆成功,否则登陆失败。

H. 怎么用PHP MYSQL做注册和登陆系统,要详细哦!

这些都是很简单的东西,看看就明白,熟悉一下常用的函数就是了
mysql_connect()
mysql_select_db()

mysql_query()

mysql_fetch_array()

$_SESSION['']
$_POST['']

I. 请教用PHP做登录注册系统的经验,并有些小问题

新手差不多都这样写,不过你没有过滤get的值,所以容易产生注入,另外也可以分表,比如一个表存取用户id,另外一个存用户具体信息,然后联合查询,其实无所谓,另外登陆注册一般是一套程序的一个模块功能,你可以再扩展下,比如使用cookie和session来保存登陆,都是学习,可以将你能想到的功能尽量完善
最后么,我建议你将变量名取规范好记一点。

J. 求一PHP注册登录系统

注册登录很好做的具体的你可以在后盾人视频平台看看,那里老师有专门讲这个的,很清楚的,你多看几遍不就会了,希望能帮到你,给个采纳吧

热点内容
android服务是什么 发布:2025-05-20 02:19:31 浏览:201
什么手机可以升到安卓十 发布:2025-05-20 02:19:24 浏览:570
手机U盘安卓的系统目录里有什么 发布:2025-05-20 02:13:08 浏览:849
python多进程锁 发布:2025-05-20 02:12:23 浏览:293
n皇后算法 发布:2025-05-20 01:49:15 浏览:66
如何配置图形电脑 发布:2025-05-20 01:47:51 浏览:392
及解压 发布:2025-05-20 01:44:49 浏览:416
如何用计算器刷安卓 发布:2025-05-20 01:09:29 浏览:577
移动宽带密码重置后怎么办 发布:2025-05-20 01:02:04 浏览:808
php不是内部命令 发布:2025-05-20 00:41:09 浏览:97