Blogger Information
Blog 3
fans 0
comment 0
visits 4603
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
页面跳转问题
猫熊不说话的博客
Original
1064 people have browsed it
<?php
if(isset($_GET['action']))
{
	if($_GET['action'] == 'login')
	{
		if ($_POST['name']=='admin'&& $_POST['pwd']==123456 )
		{
			setcookie('userName',$_POST['name'],time()+3600*24);
			header('Location:index.php');
		}else
		{
			echo '<script> alert("用户名或密码不对");</script>';
		}
	}
	elseif ($_GET['action'] == 'logout')
		{
			setcookie('userName','',time()-3600);
		}
}
?>

<!DOCTYPE html> 
<html>
	<head>
		<meta charset = "utf-8">
		<title>用户登陆</title>
	</head>
	<body>
		<form action = "<?php echo $_SERVER['PHP_SELF'];?>?action=login" method = "post">
			<fieldset>
				<legend>用户登陆:</legend>
				<label for = "name">用户名: </label>
				<input type = "text" name = "name" id = "name">
				<label for = "pwd">密码: </label>
				<input type = "password" name = "pwd" id = "pwd">
				<input type = "submit" value = "提交">
			</fieldset>
		</form>
	</body>
</html>
**************************************************************
action=login  左右两边不能有空格,已经改成


Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post