简体   繁体   English

我无法完全加载PHP / XHTML页面。 我认为这是语法错误,但我找不到它

[英]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.

相关问题 jQuery:无法使用 .load 缩放 img。 它填满了整个页面。 我想缩小它以适应 - jQuery: cannot scale img with .load. It fills the entire page. I want to scale it down to fit 为什么我不能在XHTML页面内的对话框中打开XHTML内容? - Why cannot I open XHTML content in dialog inside XHTML page? 选项按钮不会在 PHP 中自动重新加载页面,我在代码中找不到错误 - Option buttons don't reload page automatically in PHP, I cannot find the error in my code JavaScript语法错误(我认为) - JavaScript syntax error (I think) 我无法显示我网站的页面,我尝试调试未捕获的语法错误 1: import { useState } from 'react' - I cannot display a page of my website, i tried debugging Uncaught Syntax Error 1: import { useState } from 'react' Selenium Python执行JavaScript单击链接,我得到一个错误。 我认为我的语法是错误的 - Selenium Python Execute JavaScript click link i get an error. I think my syntax is wrong HMLHttpRequest无法加载。 我正在尝试POST请求一个JSON对象到firebase - HMLHttpRequest cannot load. I'm trying to POST request a JSON object to firebase 我想在页面加载之前加载JavaScript代码。 - I want to load a javascript code before page load. XMLHttpRequest无法加载。? - XMLHttpRequest cannot load.? 我无法获取ProcessingJS Sketch来加载外部资源 - I cannot get my ProcessingJS Sketch to load External resources
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM