一个基于mysql的登陆验证程序

2016-02-19 19:20 1 1 收藏

想要天天向上,就要懂得享受学习。图老师为大家推荐一个基于mysql的登陆验证程序,精彩的内容需要你们用心的阅读。还在等什么快点来看看吧!

【 tulaoshi.com - 编程语言 】

/******************************************************

file name: login.php3

Login Check

编码: PHP 4

作者: Kevin Lee webwing@21cn.com

Database: MySQL。

Host: localhost Database : mydb

Table structure for table 'user'

--------------------------------------------------------

CREATE TABLE user (

id smallint(6) NOT NULL auto_increment,

user varchar(12) NOT NULL,

passwd varchar(12) NOT NULL,

name varchar(20),

email varchar(30),

level char(1),

status char(1),

UNIQUE id (id)

);

--------------------------------------------------------

*******************************************************/

script language="javascript"

function back(){

history.back();

}

function winclose(){

setTimeout("self.close()",10000);

}

/script

$db_id = mysql_pconnect("localhost", "root", "");

$sql="select id, user, passwd from user where user='".$name."' and passwd='".$pwd."'";

$result = mysql_db_query("mydb",$sql);

$row = mysql_fetch_array($result);

$id = $row[id] ;

if ($id!="") {

session_start();

session_register("yn");

$yn="yes"  ;

echo "htmlbody onload="javascript:winclose()"";

echo "你已经成功登陆。。。"."p";

echo "center"."窗口10秒钟后自动关闭"."/center";

echo "/body/html";

}

else {

echo "帐号或密码错误!!!";

echo "P";

echo "center";

echo "a href="#" onclick="javascript:back()"back/a";

echo "/center" ;

}

!--

file name: login.htm

--

html

(本文来源于图老师网站,更多请访问https://www.tulaoshi.com/bianchengyuyan/)

head

title系统登陆/title

meta http-equiv="Content-Type" content="text/html; charset=gb2312"

style type="text/css"

!--

.css1 {  font-size: 10pt; color: #FFCC66}

--

/style

/head

body bgcolor="#ffffff" topmargin=0 leftmargin=0

form method="post" action="login.php3"

(本文来源于图老师网站,更多请访问https://www.tulaoshi.com/bianchengyuyan/)

table width="210" bgcolor="#ffffff" height="106" bordercolor="navajowhite" border="1" style="WIDTH: 210px"

tr bgcolor="#0000ff"

td colspan="4"

div align="center"bfont color="#ffffff" face="楷体_GB2312"系统登陆/font/b/div

/td

/tr

tr bgcolor="#f9fde1" bordercolor="#cccccc"

td width="71" class="css1"

div align="center"用户帐号/div

/td

td colspan="3" align=middle

input name="name" size="14"

/td

/tr

tr bgcolor="#f9fde1" bordercolor="#cccccc"

td width="71" class="css1"

div align="center"用户密码/div

/td

td colspan="3" align=middle

input type="password" name="pwd" size="14"

/td

/tr

tr bgcolor="#f9fde1" bordercolor="#cccccc"

td colspan="4" height="26" style="HEIGHT: 26px"

div align="center"

input type="submit" name="Submit1" value="  登 陆 " height="20" style="FONT-SIZE: smaller; HEIGHT: 22px"

/div

/td

/tr

/table

/form

/body

/html

/************************

file name: login_chk.php3

************************/

if ($yn!="yes") {

echo "script language="javascript"";

echo "!-- ";

echo "history.back () ;";

echo "window.open ('../login/login.htm','login','height=116,width=210,top=120,left=200,toolbar=no,menubar=no,scrobllbar=no,resizable=no,location=no,status=no')";

echo "-- ";

echo "/script ";

exit;

}

Example:

? require("login_chk.php3"); ?

!--file name: sample.php3--

html

(本文来源于图老师网站,更多请访问https://www.tulaoshi.com/bianchengyuyan/)

head/head

body

Success! You have pass the checking.

/body

html

(本文来源于图老师网站,更多请访问https://www.tulaoshi.com/bianchengyuyan/)

来源:https://www.tulaoshi.com/n/20160219/1620739.html

延伸阅读
表单的验证一直是网页设计者头痛的问题,表单验证类 Validator就是为解决这个问题而写的,旨在使设计者从纷繁复杂的表单验证中解放出来,把精力集中于网页的设计和功能上的改进上。 Validator是基于JavaScript技术的伪静态类和对象的自定义属性,可以对网页中的表单项输入进行相应的验证,允许同一页面中同时验证多个表单,熟悉接口之...
Validator 完整代码: <title表单验证类 Validator v1.0</title <style body,td{font:normal 12px Verdana;color:#333333} input,textarea,select,td{font:normal 12px Verdana;color:#333333;border:1px solid #999999;background:#ffffff} table{border-collapse:collapse;} td{padding:3px} input{height:20;} texta...
标签: ASP
  用于处理xmlhttp请求的asp程序,看看时不是很简单啊!?? ===== <%on error resume next Response.ContentType="text/xml"     if Request.ServerVariables("REQUEST_METHOD")="POST" then set req=Server.CreateObject("Microsoft.XMLDOM")     ...
标签: PHP
前几天看见DEV-CLUB实行了验证码登陆校验.昨晚在PHP中进行了实现.欢迎大家和我讨论polygame@163.net 原理:生成一个图片,并且保存图片中显示的字符到SESSION.在登陆时判断输入的校验码是否和SESSION中校验码相同. 演示地址: http://www.bingdu.net/bbs/ 这是生成校验码和图片的文件checkNumber.php <?php session_start()...
标签: PHP
  该程序的一些功能有几点: 1:完整的搜索引擎 2:三种排序对象.(加入时间,下载次数,程序名字).及两种排序方法(倒序,顺序). 3:管理员随时修改. 4:报告链接错误.供管理员随时修正. 5:分页功能. 创建表: CREATE TABLE download (    author varchar(15),    title varchar(30),    u...

经验教程

795

收藏

54
微博分享 QQ分享 QQ空间 手机页面 收藏网站 回到头部