响应式注册登录代码(响应式注册登录代码是什么)
admin 发布:2022-12-19 21:57 121
今天给各位分享响应式注册登录代码的知识,其中也会对响应式注册登录代码是什么进行解释,如果能碰巧解决你现在面临的问题,别忘了关注本站,现在开始吧!
本文目录一览:
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 文本
求一用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 "登录失败";
}
}
大概这样
如何用eclipse写登录注册页面的代码
java写的用户登录实例,实际页面展示使用的jsp,那么下面是jsp的登录页面代码:
1、login.jsp代码
%
string name = request.getparameter("username");
string pwd = request.getparameter("password");
//out.println(name+pwd);
string sql ="select * from info where username='"+name+"' and password='"+pwd+"'";
//out.println(sql);
statement stm= null;
resultset rs =null;
try
{
stm = conn.createstatement();
rs = stm.executequery(sql);
if(rs.next())
{
session.setattribute("username",name);
response.sendredirect("index.html");
}
else
{
response.sendredirect("index1.html");
}
}
catch(sqlexception e)
{
e.printstacktrace();
}
%
!--登录的表单--
form name="form1" method="post" action="login.jsp"
p
label for="username"/label 用户名
input type="text" name="username" id="username"
/p
p
label for="passwrod"/label 密码
input type="text" name="passwrod" id="passwrod"
/p
p
input type="submit" name="button" id="button" value="提交"
/p
/form
2、用户信息表,存放用户名和密码:
user_info 表
create table if not exists `test` (
`id` int(8) not null auto_increment,
`username` char(150) default null,
`password` varchar(32),
`times` int(4) not null,
primary key (`id`)
) engine=myisam default charset=utf8 auto_increment=1 ;
c#用代码实现注册登录代码
/*
*
输入用户名的文本框是txt_UserName;
*
输入真实姓名的文本框时txt_UserRegName
*
输入密码的文本框是txt_Password
*
注册提交按钮是btn_Register
*/
//注册提交按钮点击事件
private
void
btn_Register_Click(object
sender,
EventArgs
e)
{
using(SqlConnection
connection
=
new
SqlConnection("[数据库连接字符串]"))//初始化到数据库的连接
{
try
{
connection.Open();//打开此数据库连接
SqlCommand
sqlText
=
new
SqlCommand("insert
into
[用户名表]
values
(@nm,@rn,@pw)",
connection);//建立数据库命令对象
//添加数据库命令参数
sqlText.Parameters[0].Value
=
txt_UserName.Text;
sqlText.Parameters[1].Value
=
txt_UserRegName.Text;
sqlText.Parameters[2].Value
=
txt_Password.Text;
if
(sqlText.ExecuteNonQuery())
MessageBox.Show(this,
"注册失败",
"错误",
MessageBoxButtons.OK,
MessageBoxIcon.Error,
MessageBoxDefaultButton.Button1);
else
MessageBox.Show(this,
"恭喜您,注册成功!",
"成功",
MessageBoxButtons.OK,
MessageBoxIcon.Information,
MessageBoxDefaultButton.Button1);
}
catch
(SqlException
exception)
{
MessageBox.Show(this,
"注册失败:\n"
+
exception.Message,
"错误",
MessageBoxButtons.OK,
MessageBoxIcon.Error,
MessageBoxDefaultButton.Button1);
}
finally
{
connection.Close();
}
}
}
[]的不是代码,是要根据你自己情况写的
同样,SQL语句的参数也是.
关于响应式注册登录代码和响应式注册登录代码是什么的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。
版权说明:如非注明,本站文章均为 AH站长 原创,转载请注明出处和附带本文链接;
相关推荐
- 05-13现在什么app引流效果好,现在什么app引流效果好呢
- 05-13神马推广登录,神马推广是什么
- 05-13优化关键词的方法包括,优化关键词是什么
- 05-13web前端开发工程师,Web前端开发工程师是做什么的
- 05-13新冠咳嗽一般要咳多少天,十一个月咳嗽有痰吃什么好得快
- 05-13alexa排名是什么意思,alexa排名第一的是
- 05-13sem搜索引擎营销是什么,sem搜索引擎营销是什么意思
- 05-13网站权重什么意思,网站权重数值越大说明什么
- 05-12网页设计需要学什么,网页设计学什么语言
- 05-12关键词排名优化怎么样,关键词排名优化登录
取消回复欢迎 你 发表评论:
- 标签列表
- 最近发表
- 友情链接