我的更改密码页未完全加载。我一直在寻找错误数小时。仅加载<html>
和<body>
标记。我删除了<form>
中的PHP,页面加载正常。我几个小时都在上下线。我还运行了代码检查程序,另外我使用 Notepad ++ ,因此它还会检查错误。我确实有这个装载ealier就好了,但是当我进行更改时,问题就出现了。谢谢你的帮助。
我的文件change_pass.php
包含XHTML
。
<?php include("pass.php") ; ?>//Session username and password.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-us" xml:lang="en-us" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Change Password</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<link rel="stylesheet" type="text/css" href="http://website.com/connect.css" />
<style type="text/css">
body {
padding-top:50px;
}
input.frm {
display:block;
margin-top:15px;
}
table, input.frm {
margin-left:auto;
margin-right:auto;
}
td {
padding:25px;
}
div.denyer_i {
margin-right:0px;
}
#log_out_chpw {
position:absolute;
top:35px;
right:20%;
}
</style>
</head>
<body class="change">
<a class="footer_hme" href="http://website.com"></a>
<a id="log_out_chpw" href="http://website.com/log_out.php">Log Out</a>
<br /><br /><br />
<form id="chpw_frm" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]) ; ?>" method="post">
<?php
if ( isset($_SESSION["point"]) )//Username and password check
{
$user_sess = $_SESSION["username"] ;
$pass_sess = $_SESSION["pass"] ;
$usr = $_POST["usr"] ;
$old = $_POST["oldpass"] ;
$new = $_POST["newpass"] ;
$conf = $_POST["confpass"] ;
$usr_in = '<input id="usr_in" class="frm" type="text" name="usr" size="25" maxlength="30" />' ;
$old_in = '<input id="old_in" class="frm" type="text" name="oldpass" size="25" maxlength="30" />' ;
$new_in = '<input id="new_in" class="frm" type="text" name="newpass" size="25" maxlength="30" />' ;
$conf_in = '<input id="conf_in" class="frm" type="text" name="confpass" size="25" maxlength="30" />' ;
echo( ' <table><tr><td> ' ) ;
echo( ' <h3>User Name</h3> ' ) ;
echo( $usr_in ) ;
echo( ' </td> ' ) ;
echo( ' <td> ' ) ;
echo( ' <h3>Old Password</h3> ' ) ;
echo( $old_in ) ;
echo( ' </td></tr> ' ) ;
echo( ' <tr><td> ' ) ;
echo( ' <h3>New Password</h3> ' ) ;
echo( $new_in ) ;
echo( ' </td> ' ) ;
echo( ' <td> ' ) ;
echo( ' <h3>Confirm Password</h3> ' ) ;
echo( $conf_in ) ;
echo( ' </td></tr> ' ) ;
echo( ' <tr><td colspan="2"> ' ) ;
if ( $old === $pass_sess && $usr === $user_sess )
{
if ( $new === $conf )
{
echo ( '
<div style="color:#6f6bb6;">Your Password has been changed!</div>
<br />
' ) ;
}
else
{
if ( $usr !== $user_sess )
{
echo ( '
<div class="denyer_i">Incorrect User Name!</div>
<br /><br />
' ) ;
}
if ( $new !== $conf )
{
echo ( '
<div class="denyer_i">Your Confirmation Password does not match!</div>
<br /><br />
' ) ;
}
}
}
else
{
echo ( '
<div class="denyer_i">Incorrect!</div>
<br /><br />
' ) ;
}
}
echo ( ' <input class="log_sub" name="Sub" type="submit" value="Change Password" /> ' ) ;
echo ( ' <input class="log_sub" name="res" type="reset" value="Clear" style="margin-right:0px;" /> ' ) ;
echo ( ' </td></tr></table> ' ) ;
}
?>
</form>
<p class="cpy">2014-<?php echo date("Y") ; ?> website. All rights reserved.</p>
</body>
</html>
我的pass.php
文件
<?php
session_start() ;
$_SESSION["username"] = "user" ;
$_SESSION["pass"] = "pass" ;
$_SESSION["point"] ;
?>
...也因为PHP需要登录。来自其他页面的链接链接到更改密码页。
isset($_SESSION["point"])
答案 0 :(得分:0)
在3个回波之后你有1个极端近距离支架,将其移除
$usr_in = '<input id="usr_in" class="frm" type="text" name="usr" size="25" maxlength="30" />' ;
$old_in = '<input id="old_in" class="frm" type="text" name="oldpass" size="25" maxlength="30" />' ;
$new_in = '<input id="new_in" class="frm" type="text" name="newpass" size="25" maxlength="30" />' ;
$conf_in = '<input id="conf_in" class="frm" type="text" name="confpass" size="25" maxlength="30" />' ;
echo( ' <table><tr><td> ' ) ;
echo( ' <h3>User Name</h3> ' ) ;
echo( $usr_in ) ;
echo( ' </td> ' ) ;
echo( ' <td> ' ) ;
echo( ' <h3>Old Password</h3> ' ) ;
echo( $old_in ) ;
echo( ' </td></tr> ' ) ;
echo( ' <tr><td> ' ) ;
echo( ' <h3>New Password</h3> ' ) ;
echo( $new_in ) ;
echo( ' </td> ' ) ;
echo( ' <td> ' ) ;
echo( ' <h3>Confirm Password</h3> ' ) ;
echo( $conf_in ) ;
echo( ' </td></tr> ' ) ;
echo( ' <tr><td colspan="2"> ' ) ;
if ( $old === $pass_sess && $usr === $user_sess )
{
if ( $new === $conf )
{
echo ( '
<div style="color:#6f6bb6;">Your Password has been changed!</div>
<br />
' ) ;
}
else
{
if ( $usr !== $user_sess )
{
echo ( '
<div class="denyer_i">Incorrect User Name!</div>
<br /><br />
' ) ;
}
if ( $new !== $conf )
{
echo ( '
<div class="denyer_i">Your Confirmation Password does not match!</div>
<br /><br />
' ) ;
}
}
}
else
{
echo ( '
<div class="denyer_i">Incorrect!</div>
<br /><br />
' ) ;
}
//}
echo ( ' <input class="log_sub" name="Sub" type="submit" value="Change Password" /> ' ) ;
echo ( ' <input class="log_sub" name="res" type="reset" value="Clear" style="margin-right:0px;" /> ' ) ;
echo ( ' </td></tr></table> ' ) ;
}
?>
答案 1 :(得分:0)
猜猜,但......你的错误可能只是你写的
$user_sess = $_SESSION["userbame"] ;
而不是
$user_sess = $_SESSION["username"] ;
(“userbame”而不是“username”)。