会员注册系统代码php(会员注册页面代码)
admin 发布:2022-12-19 20:32 182
本篇文章给大家谈谈会员注册系统代码php,以及会员注册页面代码对应的知识点,希望对各位有所帮助,不要忘了收藏本站喔。
本文目录一览:
- 1、用PHP做登陆注册页面
- 2、php网站会员注册管理系统方法
- 3、PHPCMS 前台会员注册
- 4、求一用php写的注册和登录页面代码
- 5、求一个简单会员注册系统代码, 包括access文件。
- 6、求用户注册代码,HTM,ASP,PHP都行
用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
tdinput type="text" name="name" id="name"//td
/tr
tr
td用户密码:/td
tdinput type="password" name="password" id="password"//td
/tr
tr
td验证码:/td
tdinput 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
tdinput type="text" name="username" id="username"//td
/tr
tr
td height=40 bgColor=#fffbec密码/td
tdinput 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=#fffbecEMAIL/td
tdinput type="text" name="email" id="email"/
/tr
tr
td height=40 bgColor=#fffbec/td
tdinput 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; iaa.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; iaa.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=3a href="login.php" style="float:right"[退出系统]/aa 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($num0)
{
while($row=mysql_fetch_array($result)){
?
tr align=middle
td bgColor=#fffbecinput type="checkbox" name="selected" value="1"//td
td height=50 bgColor=#fffbec width=300
?php
echo "diva 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=#fffbecdiv?php echo $row['last_post_time']."by".$row['last_post_author']?/div/td
/tr
?php
}
}
else
{
echo "tr bgColor=#fffbectd colspan=3对不起,论坛尚在创建中……/td/tr";
}
?
tr
td colspan=3 input type="checkbox" name="selected" value="1" onclick="All(this,'selected')"/全选/不全选/td
/tr
tr
tdinput type="button" name="del" id="del" value="删除选中项"/
?php
?
/td
/tr
/table
/html
数据库你就自己建,望采纳~
php网站会员注册管理系统方法
我的处理方式是session+COOKIE
session浏览器关闭就关闭了
COOKIE是设置时间的
我帐号存在一个COOKIE里面
(MD5(帐号+密码+ip+算法))在来个算法 存在以个COOKIE
先判断session存在就是登录了
不纯在
判断COOKIE对不对,对了存session,也就登录了
网友们也帮我看看这样安全不~~
PHPCMS 前台会员注册
可以删掉HTML代码,或者由PHP生产的HTML代码。但是建议不要这么做,人家的还比较完善,自己弄的话,只能是学习了。想快速做项目,最好是二次开发。
求一用php写的注册和登录页面代码
reg.php文件
?php
header("Content-type:text/html;charset=utf-8");
if($_POST){
$dsn = 'mysql:dbname=1104javab;host=127.0.0.1';
$user = 'root';
$password = '';
try{
$pdo = new pdo($dsn,$user,$password,array(PDO::MYSQL_ATTR_INIT_COMMAND = 'SET NAMES \'UTF8\'')
);
}catch(Exception $e){
echo '错误'.$e-getmessage();
}
$name = $_POST['name'];
$pwd = md5($_POST['pwd']);
$sql = "insert into 表 (username,password) values ('$name','$pwd')";
$exec = $pdo-query($sql);
if($exec){
echo "scriptalert('成功');location.href='reg.html'/script";
}else{
echo "scriptalert('失败');location.href='reg.html'/script";
}
}
?
reg.html文件
form action='reg.php' method='post'
用户名:input type='text' name='name'
密码:input type='password' name='pwd'
input type='submit' value='submit'
/form
login.html文件
form action='reg.php' method='post'
用户名:input type='text' name='name'
密码:input type='password' name='pwd'
input type='submit' value='submit'
/form
login.php文件
header("Content-type:text/html;charset=utf-8");
if($_POST){
$dsn = 'mysql:dbname=1104javab;host=127.0.0.1';
$user = 'root';
$password = '';
try{
$pdo = new pdo($dsn,$user,$password,array(PDO::MYSQL_ATTR_INIT_COMMAND = 'SET NAMES \'UTF8\'')
);
}catch(Exception $e){
echo '错误'.$e-getmessage();
}
$name = $_POST['name'];
$pwd = $_POST['pwd'];
$sql = "select user_id from 表名 where username='$name' and password='$pwd'";
$stmt = $pdo-query($sql);
$info = $stmt-fetch(PDO::FETCH_ASSOC);
if($info){
echo "登录成功";
}else{
echo "登录失败";
}
}
大概这样
求一个简单会员注册系统代码, 包括access文件。
简单会员注册系统,实际上是VB编程最起码的一个要求,它不是十分复杂,是一个简单的数据库操作实例。
必须知道:
1、如何连接数据库
2、如何连接数据表
3、如何在数据表添加新记录
一、连接Access中的A.mdb数据库:
Dim dbP As String
dbP = App.Path "\A.mdb"
GSL = "ms access;pwd=abcd" '数据库A.mdb设置了abcd的密码保护
Set WorkDefault = DBEngine.Workspaces(0)
Set db = DBEngine.Workspaces(0).OpenDatabase(dbP, False, False, GSL)
二、连接A.mdb数据库中的“会员注册”数据表:
strSQL = "SELECT * FROM 会员注册" '数据表连接字符串
Set RS = db.OpenRecordset(strSQL) '连接数据表
三、在“会员注册”数据表中添加新记录,即会员注册:
RS.AddNew '添加一条新记录
’这里填写更新内容
' 例如:RS("会员名称")=Text1.Text
'Text1.Text 是注册界面会员名称的输入文本框内容
'RS("登录密码")=Text2.Text
'Text2.Text 是注册界面会员密码的输入文本框内容
RS.UpDate '更新数据表数据
四、千万别忘了关闭数据表记录集对象:
RS.Close
Set RS=NotHing
求用户注册代码,HTM,ASP,PHP都行
'conn.asp
%
'连接数据库开始
dim conn,rs,sql
'on error resume next
dbpath=server.mappath("userinfo.mdb")
set conn=server.createobject("adodb.connection")
conn.open "PROVIDER=Microsoft.jet.OLEDB.4.0;data source="dbpath
'创建记录对象
set rs=server.createobject("adodb.recordset")
%
'index.asp
!-- #include file="conn.asp" --
html
head
meta http-equiv="Content-Type" content="text/html; charset=gb2312"
title会员/title
style type="text/css"
!--
body,td,th {
font-family: 宋体;
font-size: 14px;
}
--
/style
/head
body
center
p会员注册系统/p
form name="form1" method="post" action="login.asp"
table width="34%" border="0"
tr
td width="33%" height="30"用户名:/td
td width="67%" height="30"input name="username" type="text" id="username" size="15"/td
/tr
tr
td height="30"密 码:/td
td height="30"input name="password" type="password" id="password" size="15"/td
/tr
tr
td colspan="2" align="center"input type="submit" name="Submit" value="确定"
input type="reset" name="Submit" value="重置"/td
/tr
tr
td colspan="2"a href="reg.asp" target="_self"注册/a/td
/tr
/table
/form
/center
/body
/html
'reg.asp
html
head
meta http-equiv="Content-Type" content="text/html; charset=gb2312"
title用户注册/title
style type="text/css"
!--
body,td,th {
font-family: 宋体;
font-size: 14px;
}
--
/style
/head
body
center
用户注册br
%
=request.QueryString("msg")
%
form name="form1" method="post" action="addnewdata.asp?ac=adduser"
table width="39%" height="105" border="0"
tr
td width="27%" height="30"用户名:/td
td width="73%" height="30"input name="username" type="text" id="username"
*/td
/tr
tr
td height="30"密码:/td
td height="30"input name="password" type="password" id="password"
*/td
/tr
tr
td height="30"确定密码:/td
td height="30"input name="password2" type="password" id="password2"
*/td
/tr
tr
td height="30"性别:/td
td height="30"input name="sex" type="text" id="sex"/td
/tr
tr
td height="30"QQ:/td
td height="30"input name="qq" type="text" id="qq"/td
/tr
tr
td height="30"Mail:/td
td height="30"input name="mail" type="text" id="mail"/td
/tr
tr
td height="30"地址:/td
td height="30"input name="add" type="text" id="add"/td
/tr
tr
td个人介绍/td
tdtextarea name="personalinfo" cols="30" rows="6" id="personalinfo"/textarea/td
/tr
tr
td /td
tdinput type="submit" name="Submit" value="提交"/td
/tr
/table
/form
/center
/body
/html
'addnewdata.asp
!-- #include file="conn.asp" --
html
head
meta http-equiv="Content-Type" content="text/html; charset=gb2312"
title成功/title
/head
body
%
ac=request.QueryString("ac")
msg="注册错误信息"
msg2="注册成功"
if request.Form("username")="" then
msg=msg"br""用户名不能为空"
end if
if strcomp(cstr(request.Form("password")),cstr(request.Form("password2")))0 then
msg=msg"br""两次密码输入不同"
end if
if len(request.Form("password"))6 then
msg=msg"br""密码太简单"
end if
if strcomp(msg,"注册错误信息")0 then
response.Redirect("reg.asp?msg="msg)
end if
if ac="adduser" then
set rsc=server.createobject("adodb.recordset")
sql="select * from info where username='"request.Form("username")"'"
rsc.open sql,conn,1,1
if not rsc.eof then
msg=msg"?""用户名被人注册"
response.Redirect("reg.asp?msg="msg)
response.end
end if
rsc.close
set rsc=nothing
dsql="select * from info where id is null"
set rs=server.createobject("adodb.recordset")
rs.open dsql,conn,1,3
rs.addnew
rs("username")=request.Form("username")
rs("password")=request.Form("password")
rs("mail")=request.Form("mail")
rs("sex")=request.Form("sex")
rs("qq")=request.Form("qq")
rs("add")=request.Form("add")
rs("personalinfo")=request.Form("personalinfo")
rs("ntime")=now
rs.update
set rs=nothing
msg2=msg2"?""注册成功"
response.Redirect("reg.asp?msg2="msg2)
response.end
'response.write "scriptalert('注册成功!');window.location.href='index.asp';/script"
'response.end
%
center
a href="index.asp" target="_self"注册成功,点击登陆/a
/center
%
end if
%
/body
/html
'login.asp
!-- #include file="conn.asp" --
%
ac=request.QueryString("ac")
msg3="登录错误信息"
'打开数据库判断用户是否存在,info为表名,username为字段名
set rsc=server.createobject("adodb.recordset")
sqlc="select * from info where username='"request.Form("username")"' and password='"request.Form("password")"'"
rsc.open sqlc,conn,1,1
session("username")=rsc("username")
session("password")=rsc("password")
session("ltime")=""
session("ltime")=now()
session.Timeout=300
rsc.close
set rsc=nothing
if session("username")"" then
response.write ("登录成功")
else
msg3=msg3"?""用户名或密码错误"
response.Redirect("login.asp?msg3="msg3)
response.end
end if
response.Redirect("index.asp")
'如果用户不存在,session("username")为空
%
关于会员注册系统代码php和会员注册页面代码的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。
版权说明:如非注明,本站文章均为 AH站长 原创,转载请注明出处和附带本文链接;
相关推荐
- 05-18seo积分系统,seo评分
- 05-16如何做一个网站,如何做一个网站系统
- 05-15永久免费个人网站注册,免费注册com的网站
- 05-14百度账号免费注册,手机注册百度账号 免费
- 05-14上海网站推广系统,上海网站推广服务公司
- 05-13电脑系统优化软件哪个好用,电脑系统优化在哪里
- 05-12网站自然优化,网站自动优化系统
- 05-12cms系统,喜来健CMS系统
- 05-11自助建站系统源码,自助建站源码php
- 05-09网页代码,网页代码快捷键
取消回复欢迎 你 发表评论:
- 标签列表
- 最近发表
- 友情链接