一个基于mysql的登陆验证程序(一)
时间:2007-02-17 来源:PHP爱好者
<?
/******************************************************
file name: login.PHP3
Login Check
编码: PHP 4
作者: Kevin Lee <[email protected] >
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>" ;
}
?>
php爱好者站 http://www.phpfans.net php动态|php基础|php进阶|php模板.
/******************************************************
file name: login.PHP3
Login Check
编码: PHP 4
作者: Kevin Lee <[email protected] >
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>" ;
}
?>
php爱好者站 http://www.phpfans.net php动态|php基础|php进阶|php模板.
相关阅读 更多 +