当前位置:首页 > 代码 > 正文

一个简单的注册页面代码(注册页面怎么实现的)

admin 发布:2022-12-19 04:45 124


本篇文章给大家谈谈一个简单的注册页面代码,以及注册页面怎么实现的对应的知识点,希望对各位有所帮助,不要忘了收藏本站喔。

本文目录一览:

求一个最简单的PHP页面注册代码,数据库为MySQL

u_signup.htmhtml

head

/head

title欢迎注册网络图书销售信息管理系统/title

body

p align="center" class="style"会员注册/p

hr

form name="form1" method="post" action="u_signup.php"

p align="center"身份证号input name="u_sfzh" type="text" maxlength="18"/p

p align="center"会员姓名input name="u_hyxm" type="text" /p

p align="center"会员密码input name="u_hymm1" type="password" /p

p align="center"密码确认input name="u_hymm2" type="password" /p

p align="center"联系电话input name="u_lxdh" type="text" /p

p align="center"联系地址input name="u_lxdz" type="text" /p

p align="center"银行名称input name="u_yhmc" type="text" /p

p align="center"银行卡号input name="u_yhkh" type="text" /pp align="center"input name="u_return" type="submit" value="会员注册"/p

/form

/body

/html u_signup.php?php

//验证身份证号

$sfzh=$_POST['u_sfzh'];

if(empty($sfzh))

die("身份证号不能为空");

else if(strlen($sfzh)!=18)

die("身份证号应为18位");

else if(!is_numeric($sfzh))

die("身份证号应为18位数字");//验证会员姓名

$hyxm=$_POST['u_hyxm'];

if(empty($hyxm))

die("会员姓名不能为空");

else if(strlen($hyxm)4)

die("会员姓名应最少2个字符");

//验证会员密码

$hymm1=$_POST['u_hymm1'];

$hymm2=$_POST['u_hymm2'];

if(empty($hymm1) or empty($hymm2))

die("会员密码不能为空");

else if(strlen($hymm1)4 or strlen($hymm2)4 )

die("会员密码至少是4个字符");

else if($hymm1!=$hymm2)

die("两次输入的密码不一致");//验证联系电话

$lxdh=$_POST['u_lxdh'];

if(empty($lxdh))

die("联系电话不能为空");

else if(!is_numeric($lxdh))

die("联系电话应为数字");//验证联系地址

$lxdz=$_POST['u_lxdz'];

if(empty($lxdz))

die("联系地址不能为空");

else if(strlen($lxdz)6)

die("联系地址应最少6个字符");//验证银行名称和银行卡号

$yhmc=$_POST['u_yhmc'];

$yhkh=$_POST['u_yhkh'];

if(empty($yhmc) or empty($yhkh))

die("银行名称和银行卡号不能为空");

else if(strlen($yhmc)4 or strlen($yhkh)4 )

die("银行名称和银行卡号至少是4个字符");//获取系统日期和时间

$v_time=date("Y-m-d H:i:s");include "conn.php";mysql_query("set names 'GB2312'");//判断是否存在相同用户

//查询数据的sql语句形式:select * from member where 身份证号='123456789012345678'

$v_find="select * from member where 身份证号='".$sfzh."'";

//echo($v_find);

//echo("br");

$result=mysql_query($v_find,$conn);

$record=mysql_num_rows($result);

if($record0)

die($sfzh."该会员身份证号已经注册,不得重复,注册失败。");//注册用户

//插入数据的sql语句形式:insert into member values('11111111111111','1111',''...)

$v_insert="insert into member values('".$sfzh."','".$hyxm."','".$hymm1."','".$lxdh."','".$lxdz."','".$yhmc."','".$yhkh."','".$v_time."',0)";//echo($v_insert);

//echo("br");$result=mysql_query($v_insert);echo("注册成功");?conn.php?php

$host="localhost";

$user="root";

$password="123456";$conn=mysql_connect($host,$user,$password);

if(!$conn)

die("连接MySQL服务器失败。".mysql_error());$dbase="bookstore";

$db_select=mysql_select_db($dbase,$conn);

if(!$db_select)

die("连接MySQL数据库失败。".mysql_error());

?

用Dreamweaver做登陆和注册界面的代码?

1、插入一个div,设置为400x300px大小,背景色为米黄色,居中。

2、输入标题文字和用户名、密码,调整位置。

3、继续插入填写部分,插入--表单--文本域,所以需要输入内容的“框”都是文本域。设置用户名文本域ID为username,点击确定。

4、继续同样的方式插入密码的文本域,设置ID为password。因为密码是非明文的,不需要显示,所以我们在属性面板里选择文本域的类型--密码。

5、插入按钮。插入--表单--按钮,插入两个按钮,ID分别设置为login和reg。login按钮设置为登陆,reg按钮设置为注册。

6、初始值是我们未输入内容时,填写框显示的提示文字。

7、这样一个简单的登陆界面就做好了,是不是很简单呢。

asp程序实现简单的注册,登录网页的源代码

1,(index.asp 用户登陆页面)

!-- #include file="conn.asp" --

!-- blog.soowooo.cn 悠悠长假期 --

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

2,(login.asp 用户数据处理文件)

!-- #include file="conn.asp" --

%

'打开数据库判断用户是否存在,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.Timeout=30

set rsc=nothing

response.Redirect("change.asp")

'如果用户不存在,session("username")为空

%

3,(change.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-size: 14px;

}

--

/style/head

center

body

br

%

set rsc=server.createobject("adodb.recordset")

sqlc="select * from info where username='"session("username")"' and password='"session("password")"'"

rsc.open sqlc,conn,1,1

nr=rsc("password")

username=rsc("username")

password=rsc("password")

sex=rsc("sex")

qq=rsc("qq")

mail=rsc("mail")

add=rsc("add")

personalinfo=rsc("personalinfo")

vv=rsc("ntime")

set rsc=nothing

if nr="" then

response.Redirect("index.asp")

end if

if strcomp(nr,request.Form("password"))=0 then

response.Write("欢迎你!"request.Form("username"))

response.Write("你是在"vv"注册的")

session("username")=request.Form("username")

end if

if session("username")="" then

response.Redirect("index.asp")

end if

%

form name="form1" method="post" action="change.asp?ac=ch"

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" value="%=username%"

*/td

/tr

tr

td height="30"密 码:/td

td height="30"input name="password" type="text" id="password" value="%=password%"

*/td

/tr

tr

td height="30"性 别:/td

td height="30"input name="sex" type="text" id="sex" value="%=sex%"/td

/tr

tr

td height="30"QQ:/td

td height="30"input name="qq" type="text" id="qq" value="%=qq%"/td

/tr

tr

td height="30"Mail:/td

td height="30"input name="mail" type="text" id="mail" value="%=mail%"/td

/tr

tr

td height="30"地 址:/td

td height="30"input name="add" type="text" id="add" value="%=add%"/td

/tr

tr

td介绍/td

tdtextarea name="personalinfo" cols="30" rows="6" id="personalinfo"%=personalinfo%/textarea/td

/tr

tr

td /td

tdinput type="submit" name="Submit" value="修改"

a href="change.asp?se=y" target="_self"退出系统/a/td

% if strcomp(request.QueryString("se"),"y")=0 then

session("username")=""

response.Redirect("index.asp")

end if

%

/tr

/table

/form

%

if strcomp(request.QueryString("ac"),"ch")=0 then

set rs=server.createobject("adodb.recordset")

sql="select * from info where username='"session("username")"'"

rs.open sql,conn,1,3

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.update

set rs=nothing

response.Write("修改完成!")

end if

%

/body

/center

/html

4,(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

5,(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="注册错误信息"

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

ck=rsc("username")

set rsc=nothing

if ck"" then

msg=msg"br""用户名被人注册"

response.Redirect("reg.asp?msg="msg)

end if

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

%

center

a href="index.asp" target="_self"注册成功,点击登陆/a

/center

%

end if

%

/body

/html

6,(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="

'创建记录对象

set rs=server.createobject("adodb.recordset")

%

7,(userinfo.mdb ACCESS 数据库)

在ACCESS中建一个表,然后在这个表中建立字段名称

表名:info

字段名称 数据类型

id 自动编号

username 文本

password 文本

sex 文本

quest 文本

qq 文本

mail 文本

personalinfo 文本

ntime 文本

关于一个简单的注册页面代码和注册页面怎么实现的的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。

版权说明:如非注明,本站文章均为 AH站长 原创,转载请注明出处和附带本文链接;

本文地址:http://ahzz.com.cn/post/2594.html


取消回复欢迎 发表评论:

分享到

温馨提示

下载成功了么?或者链接失效了?

联系我们反馈

立即下载