1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
<?php
/*
* PHP100Job v1.0
* Programmer : Msn/QQ haowubai@hotmail.com (925939)
* www.php100.com Develop a project PHP - MySQL - Apache
* Window 2003 - Preferences - PHPeclipse - PHP - Code Templates
*/
include ( "conn.php" );
if ( $_GET [out]){
setcookie( "cookie" , "out" );
echo "<script language=\"javascript\">location.href='login.php';</script>" ;
}
if ( $_POST [id]== 'admin' ){
$pw =md5( $_POST [pw]);
if ( $pw == 'e1bfd762321e409cee4ac0b6e841963c' ){
setcookie( "cookie" , "ok" );
echo "<script language=\"javascript\">location.href='login.php';</script>" ;
}
}
include ( "head.php" );
if ( $_COOKIE [ 'cookie' ]!= 'ok' ){
?>
<SCRIPT language=javascript>
function Checklogin()
{
if (myform.id.value== "" )
{
alert( "请填写登录名" );
myform.id.focus();
return false;
}
if (myform.pw.value== "" )
{
alert( "密码不能为空" );
myform.pw.focus();
return false;
}
}
</SCRIPT>
<form action= "" method= "post" name= "myform" onsubmit= "return Checklogin();" >
ID:<input type= "text" name= "id" /><br>
PW:<input type= "password" name= "pw" /> <input type= "submit" name= "submit" value= "登陆" />
</form>
<?
} else {
?>
<a href= '?out=login' >退出</a>
//<a href='?out=login'>就是给当前页面提交一个参数, 参数名为'out' ,参数值为login
<?
}
?>
|