求助,页面不显示问题

redoffice 2009-05-26 01:11:24
5-3.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>

<body>
<table width="411" border="0" cellspacing="3" cellpadding="0">
<tr>
<td><div align="center">用户登陆</div></td>
</tr>
<tr>
<td><form id="form1" name="form1" method="post" action="5-3action.php">
<label>
<div align="center">用户名:
<input type="text" name="textfield" id="textfield" />
</div>
</label>
</form>
</td>
</tr>
<tr>
<td><form id="form2" name="form2" method="post" action="5-3action.php">
<label>
<div align="center">口令:
<input type="password" name="textfield2" id="textfield2" />
</div>
</label>
</form>
</td>
</tr>
<tr>
<td><form id="form3" name="form3" method="post" action="5-3action.php">
<label>
<div align="center">
<input type="submit" name="button" id="button" value="提交" />
<input type="reset" name="button2" id="button2" value="重置" />
</div>
</label>
</form>
</td>
</tr>
</table>
</body>
</html>



5-3action.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>COOKIE实现用户登陆</title>
</head>

<body>
<?php
$_COOKIE["user_name"]=$_POST["user_name"];
$_COOKIE["user_pw"]=$_POST["user_pw"];
if($_COOKIE["user_name"]=="php" && $_COOKIE["user_pw"]== "php5")
{
echo "恭喜您,用户名和口令正确,登陆成功!";
}
else
{
echo "您输入的用户名为:".$_COOKIE["user_name"];
echo "口令为:".$_COOKIE["user_pw"];
echo "但是不正确,请尝试:php和php5;"
}

?>

<br><a href = "5-3action-check.php">单击检测Cookie的值是否可以页间传递</a>
</body>
</html>


5-3.php 在浏览器中是可以显示的,操作以后跳转到5-3action.php提示无法访问 500 内部服务器错误
另外,单独打开5-3action.php也不能显示。
http://localhost/5-3.php可以显示数据,但是http://localhost/不显示,提示 403 禁止访问
我用apache

请高手指点。
...全文
55 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
redoffice 2009-05-26
  • 打赏
  • 举报
回复
解决了,一个分号位置错了。。。囧
redoffice 2009-05-26
  • 打赏
  • 举报
回复
更正一下5-3.php
传错了:
应该是:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>

<body>
<form name="form1" method="post" action="5-3action.php">
<table width="280" height="96" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#999999">
<tr>
<td colspan="2" align="center" bgcolor="#ffffff">用户登陆</td>
</tr>
<tr>
<td align="right" bgcolor="#ffffff">用户名:</td>
<td align="left" bgcolor="#ffffff">
<input type="text" name="user_name" size="12">
</td>
</tr>
<tr>
<td align="right" bgcolor="#ffffff">口令:</td>
<td align="left" bgcolor="#ffffff">
<input type="password" name="user_pw" size="12">
</td>
</tr>
<tr>
<td colspan="2" align="right" bgcolor="#ffffff">
<input type="submit" name="Submit" value="提交" size="12">
<input type="reset" name="Submit2" value="重置" size="12">
</td>
</tr>
</table>
</form>
</body>
</html>

redoffice 2009-05-26
  • 打赏
  • 举报
回复
更正一下5-3.php
传错了:
应该是:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>

<body>
<form name="form1" method="post" action="5-3action.php">
<table width="280" height="96" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#999999">
<tr>
<td colspan="2" align="center" bgcolor="#ffffff">用户登陆</td>
</tr>
<tr>
<td align="right" bgcolor="#ffffff">用户名:</td>
<td align="left" bgcolor="#ffffff">
<input type="text" name="user_name" size="12">
</td>
</tr>
<tr>
<td align="right" bgcolor="#ffffff">口令:</td>
<td align="left" bgcolor="#ffffff">
<input type="password" name="user_pw" size="12">
</td>
</tr>
<tr>
<td colspan="2" align="right" bgcolor="#ffffff">
<input type="submit" name="Submit" value="提交" size="12">
<input type="reset" name="Submit2" value="重置" size="12">
</td>
</tr>
</table>
</form>
</body>
</html>

phpboy 2009-05-26
  • 打赏
  • 举报
回复


$_COOKIE["user_name"]=$_POST["user_name"];
$_COOKIE["user_pw"]=$_POST["user_pw"];



以上写的有问题, 至于 访问 的问题,你 5-3.php 都能访问, 5-3action.php 应该也是可以的

在 根目录 下是不是 不存在 设置的 默认首页

21,881

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧