[英]I cannot get my PHP/XHTML page to fully load. I think it is a syntax error but I cannot find it
My Change Password Page does not fully load. 我的更改密码页面未完全加载。 I have been searching for errors for hours. 我已经找了好几个小时的错误了。 Only the <html>
and <body>
tags load. 仅加载<html>
和<body>
标签。 I removed the PHP inside the <form>
and the page loads fine. 我在<form>
删除了PHP,页面加载正常。 I have been up and down all lines for hours. 我在所有线路上上下走了几个小时。 I also ran through a code checker, plus I use Notepad++ so it also checks for errors. 我还运行了一个代码检查器,再加上我使用Notepad ++,因此它也检查错误。 I did have this loading ealier just fine, but as I was making changes the problem occurred. 我确实确实有这种加载方式,但是在进行更改时出现了问题。 Thanks for any help. 谢谢你的帮助。
My file change_pass.php
contains XHTML
. 我的文件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>
My pass.php
file 我的pass.php
文件
<?php
session_start() ;
$_SESSION["username"] = "user" ;
$_SESSION["pass"] = "pass" ;
$_SESSION["point"] ;
?>
...also since the PHP requires to be logged in. A link from another page links to the Change Password Page . ...也因为PHP需要登录。另一个页面的链接链接到更改密码页面 。 isset($_SESSION["point"])
You have 1 extre close bracket after the 3 echoes, remove it 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> ' ) ;
}
?>
Just guessing, but... your error may be simply that you wrote 只是猜测,但是...您的错误可能只是您写的
$user_sess = $_SESSION["userbame"] ;
instead of 代替
$user_sess = $_SESSION["username"] ;
("userbame" instead of "username"). (用“用户名”代替“用户名”)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.