当前位置:七道奇文章资讯数据防范MySQL防范
日期:2011-05-02 15:44:00  来源:本站整理

一个基于mysql的登陆考证程序[MySQL防范]

赞助商链接



  本文“一个基于mysql的登陆考证程序[MySQL防范]”是由七道奇为您精心收集,来源于网络转载,文章版权归文章作者所有,本站不对其观点以及内容做任何评价,请读者自行判断,以下是其具体内容:
 

<?

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

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 "<HTML><body 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>

<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">

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

<tr bgcolor="#0000ff">

<td colspan="4">

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

</td>

</tr>

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

<td width="71" >

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

</td>

<td colspan="3" align=middle>

<input size="14" >

</td>

</tr>

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

<td width="71" >

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

</td>

<td colspan="3" align=middle>

<input type="password" size="14" >

</td>

</tr>

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

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

<div align="center">

<input type="submit" 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\">\n";

echo "<!-- \n";

echo "history.back () ;\n";

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')\n";

echo "--> \n";

echo "</script> \n";

exit;

}

?>

Example:

<? require("login_chk.php3"); ?>

<!--file name: sample.php3-->

<html>

<head></head>

<body>

Success! You have pass the checking.

</body>

<html>

  以上是“一个基于mysql的登陆考证程序[MySQL防范]”的内容,如果你对以上该文章内容感兴趣,你可以看看七道奇为您推荐以下文章:
  • 一个基于mysql的登陆考证程序
  • 本文地址: 与您的QQ/BBS好友分享!
    • 好的评价 如果您觉得此文章好,就请您
        0%(0)
    • 差的评价 如果您觉得此文章差,就请您
        0%(0)

    文章评论评论内容只代表网友观点,与本站立场无关!

       评论摘要(共 0 条,得分 0 分,平均 0 分) 查看完整评论
    Copyright © 2020-2022 www.xiamiku.com. All Rights Reserved .