2012-11-20 73 views
-3

这是什么意思?解析错误语法错误意外的文件结尾,使用PHP

我的页面一直工作正常,但我更新XAMPP到新的版本,1.8.1。从那以后,我只收到此错误信息:

Parse error: syntax error, unexpected end of file in C:\xampp\index.php on line 106

<?php 
    if (isset($_POST['submit'])) 
    { 
     include('Mysql.php'); 

     // Include database connection settings 
     $username=$_POST['username']; 
     $password=$_POST['password']; 
     $username = stripslashes($username); 
     $password = stripslashes($password); 
     $username = mysql_real_escape_string($username); 
     $password = mysql_real_escape_string($password); 

     // Retrieve username and password from database according to user's input 

     $subm = mysql_query("SELECT * FROM usercreation WHERE (UserId = '" .$username. "') and (Password = '" .$password. "')"); 

     // Check username and password match 
     if (mysql_num_rows($subm) == 1) 
     { 
      session_start(); 

      // Set username session variable 
      $_SESSION['username']=$username; 
      //$ss=$_SESSION['username']; 

      // Check, if user is already login, then jump to secured page 
      if (isset($_SESSION['username'])) 
      { 
       header('Location:master.php'); 
      } 
     } 
     else 
     { 
?> 

<script type="text/javascript"> 
    alert("The username or password you entered is incorrect."); 
    document.location='index.php'; 
</script> 

<? 
     } 
    } 
?> 

<!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" /> 
     <link rel="stylesheet" type="text/css" href="css/style.css" /> 
     <title>Mani</title> 
    </head> 

    <body> 
     <center> 
      <div style="width:980px;" class="mod-container"> 
       <div style="width:980px; height:50px;"> 
       </div> 

       <div style="width:980px; height:130px; float:none;"> 
        <div style="width:250px; height:130px; float:left; background-image:url(img/logo_mani.png);"> 
        </div> 
       </div> 

       <div style="width:980px; height:350px; float:none;"> 
        <div style="width:270px; height:350px; margin-left:10px; float:left;"> 
        </div> 

        <div style="width:400px; height:350px; background-image:url(img/loginbg.png); margin-left:10px;float:left;"> 
         <!-- Form start here--> 
         <form method="POST" action="<?php $_PHP_SELF ?>"> 
          <div style="width:369px; height:275px; margin-left:17px; margin-top:59px; float:left;"> 
           <div style="width:321px; height:48px; background-image:url(img/uid.png); margin-left:27px; margin-top:30px; float:left;" class="log"> 
            <input type="text" placeholder="Username" onBlur="this.value=!this.value?'Username':this.value;" onFocus="this.select()" onClick="this.value='';" name="username" value="Username"> 
           </div> 
           <div style="width:321px; height:48px; background-image:url(img/pw.png); margin-left:27px; margin-top:29px; float:left;" class="log"> 
            <input type="password" placeholder="Password" onBlur="this.value=!this.value?'Password':this.value;" onFocus="this.select()" onClick="this.value='';" name="password" value="Password"> 
           </div> 
           <div style="width:321px; height:29px; margin-left:27px; margin-top:15px; float:left;" class="logforgot"> 
            <!-- <a href="#" style="">Forgot Password ?</a>--> 
           </div> 
           <div style="width:321px; height:48px; margin-left:27px; margin-top:19px; float:left;"> 
            <input class="logbutton" type="submit" value="Login" name="submit"> 
           </div> 
          </div> 
         <!-- Form end here--> 
         </form> 
        </div> 

        <div style="width:270px; height:350px; margin-left:10px;float:left;"> 
        </div> 
       </div> 
      </div> 

      <div id="footer-wrap"> 
       <div style="width: 980px; height:20px; float:none;"> 
        <div style="width: 580px; height:20px; float:left;"class="footercontainer"><p>© 2012 Amara Raja Batteries Limited.</p></div> 
        <div style="width: 210px; height:20px; float:right;"class="footercontainer"><p>All Rights Reserved | Privacy Policy</p></div> 
       </div> 
      </div> 
     </center> 
    </body> 
</html> 
+0

您可能需要更改'<''到

回答

8

看来你有不同的PHP配置。

在php.ini文件中启用short tags

或转换全部<? s在<?php

+0

@lanzz,如果你看到的第一个PHP开放标签......你呢?会看到,它是有效的(长) –

+0

感谢你的朋友。它工作正常。 –

0

确保所有PHP代码里面<?php标签:

// Line 37 
<?php 
    } 
} 
?> 
相关问题