不能显示网页,求解,谢谢!
时间:2011-09-17
来源:互联网
PHP,程序的ACTION 用的是<form method="post" action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']); ?>">,就是提交到本页,在FF和chrome浏览器中可以看到提交后的网页,但在IE和360却是“网站无法显示该页面”(IE的错误消息)和“您指定的网页无法访问! 错误类型:500”(360的错误消息),请问是什么原因呢?代码如下:
<?php
include '../justshishi/common.php';
include '../justshishi/db.php';
include '../lib/functions.php';
include 'lib/User.php';
session_start();
header('Cache-control : private');
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<body>
<?php
echo $_POST['submitted'];
if (!isset($_POST['submitted'])){//如果没有提交,一下内容输出:
?>
<form method="post"
action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']); ?>">
<table>
<tr>
<td><label for="username">Username</label></td>
<td><input type="text" name="username" id="username"
value="<?php echo $_POST['username']?>"/></td>
</tr><tr>
<td><label for="password1">Password</label></td>
<td><input type="password" name="password1" id="password1"
value=""/></td>
</tr><tr>
<td><label for="password2">Password Again</label></td>
<td><input type="password" name="password2" id="password2"
value=""/></td>
</tr><tr>
<td><label for="email">Email Address</label></td>
<td><input type="text" name="email" id="email"
value="<?php echo $_POST['email']?> "/></td>
</tr><tr>
<td><label for="captcha">Verify</label></td>
<td>Enter text seen in this image<br>
<img src="img/captcha.php?nocache=<?php echo time();?>" alt="请输入验证码"/><br>
<input type="text" name="captcha" id="captcha"/></td>
</tr><tr>
<td> </td>
<td><input type="submit" value="Sign Up"/></td>
<td><input type="hidden" name="submitted" value="1"/></td>
</tr><tr>
</table>
</form>
<?php
/*}elseif ($_SESSION['username']){
header('Location : main.php');
echo $_SESSION['username']."您好,您已注册,3秒后返回您的主页</br>";
echo "<a href='main.php'>立即返回</a>";*/
}else {
echo "ok?";
echo $_POST['password1'];
if (User::validateUsername($_POST['username'])){
echo "binggo!";
}
$is_password = User::validatePassword($_POST['password1']) && User::validatePassword($_POST['password2']);
$password = ($is_password && $_POST['password1']==$_POST['password2']) ?
md5($_POST['password1']) : '';
$chatcha = ($_SESSION['captcha']==$_POST['captcha']) ? true : false;
echo $is_password;
if ($password && User::validateUsername($_POST['username']) &&
User::validateEmailAddr($_POST['email']) && $captcha) {
$user = User::getByUsername($_POST['username']);
if ($user->userId) {
$user->setInActive();
$html_print = "<p>恭喜,用户名可用!</br>注册成功</br></p>";
}else {
$html_print = "<p>用户名被占用</p>";
}
echo $html_print;
}else {
$html_print = "<p>对不起,您提供的信息不符合要求,请按照要求重新注册。</p>";
echo $html_print;
}
}
?>
</body>
</html>
<?php
include '../justshishi/common.php';
include '../justshishi/db.php';
include '../lib/functions.php';
include 'lib/User.php';
session_start();
header('Cache-control : private');
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<body>
<?php
echo $_POST['submitted'];
if (!isset($_POST['submitted'])){//如果没有提交,一下内容输出:
?>
<form method="post"
action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']); ?>">
<table>
<tr>
<td><label for="username">Username</label></td>
<td><input type="text" name="username" id="username"
value="<?php echo $_POST['username']?>"/></td>
</tr><tr>
<td><label for="password1">Password</label></td>
<td><input type="password" name="password1" id="password1"
value=""/></td>
</tr><tr>
<td><label for="password2">Password Again</label></td>
<td><input type="password" name="password2" id="password2"
value=""/></td>
</tr><tr>
<td><label for="email">Email Address</label></td>
<td><input type="text" name="email" id="email"
value="<?php echo $_POST['email']?> "/></td>
</tr><tr>
<td><label for="captcha">Verify</label></td>
<td>Enter text seen in this image<br>
<img src="img/captcha.php?nocache=<?php echo time();?>" alt="请输入验证码"/><br>
<input type="text" name="captcha" id="captcha"/></td>
</tr><tr>
<td> </td>
<td><input type="submit" value="Sign Up"/></td>
<td><input type="hidden" name="submitted" value="1"/></td>
</tr><tr>
</table>
</form>
<?php
/*}elseif ($_SESSION['username']){
header('Location : main.php');
echo $_SESSION['username']."您好,您已注册,3秒后返回您的主页</br>";
echo "<a href='main.php'>立即返回</a>";*/
}else {
echo "ok?";
echo $_POST['password1'];
if (User::validateUsername($_POST['username'])){
echo "binggo!";
}
$is_password = User::validatePassword($_POST['password1']) && User::validatePassword($_POST['password2']);
$password = ($is_password && $_POST['password1']==$_POST['password2']) ?
md5($_POST['password1']) : '';
$chatcha = ($_SESSION['captcha']==$_POST['captcha']) ? true : false;
echo $is_password;
if ($password && User::validateUsername($_POST['username']) &&
User::validateEmailAddr($_POST['email']) && $captcha) {
$user = User::getByUsername($_POST['username']);
if ($user->userId) {
$user->setInActive();
$html_print = "<p>恭喜,用户名可用!</br>注册成功</br></p>";
}else {
$html_print = "<p>用户名被占用</p>";
}
echo $html_print;
}else {
$html_print = "<p>对不起,您提供的信息不符合要求,请按照要求重新注册。</p>";
echo $html_print;
}
}
?>
</body>
</html>
作者: qijonecrystal 发布时间: 2011-09-17
把html 源代码帖出来瞧瞧涅
作者: PhpNewnew 发布时间: 2011-09-17
引用 1 楼 phpnewnew 的回复:
把html 源代码帖出来瞧瞧涅
把html 源代码帖出来瞧瞧涅
html源代码就是上面选择语句里的那个,开始时显示hmtl,然后如果提交了的话,显示else里的。
作者: qijonecrystal 发布时间: 2011-09-17
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28