当前位置:学学看123知识中心电脑教学数据库教程一个基于mysql的登陆验证程序» 正文

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

[06-11 18:14:50]   来源:http://www.xxk123.com  数据库教程   阅读:8428

导读: <? /** 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="javas

一个基于mysql的登陆验证程序,标签:sql数据库教程,access数据库教程,http://www.xxk123.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 "<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">

[1] [2]  下一页


Tag:数据库教程sql数据库教程,access数据库教程电脑教学 - 数据库教程
《一个基于mysql的登陆验证程序》相关文章

Copyright 学学看123 All Right Reserved.

1 2 3 4 5 6 7 8 9 10