php代码没有在html代码中执行(.php文件)

时间:2013-11-14 21:29:58

标签: php html web hosting

我正在创建一个网站,我已经在XAMPP上测试了几个星期了,它一直在工作。但是,自从我将所有内容放入文件管理器(godaddy主机)后,我购买了域名和托管。突然,当我把它放在上下文中时,带有.php的文件无法读取php代码。或者至少它读取到第一行,但在php标签之外的所有内容(甚至是html代码)都是空的,页面显示为空白。我不知道为什么会发生这种情况,我现在已经搞砸了一段时间,似乎无法搞清楚!有人想拍吗?非常感谢!

<?php
session_start();
include($_SERVER["DOCUMENT_ROOT"].'/admin/classes/classes.php');            

$log= new log($_SERVER["PHP_SELF"]);

if($_GET['logout']=='1'){
    $sess = new SessionData();                     
    $sess->Logout();
}

if($_SERVER['REQUEST_METHOD'] == "POST"){
    $auth = new Authenticate();
    extract($_POST);
    if($auth->login($email,$pass)){
            header('Location: index.php');
    }else{
            $error="<p class='red'>Invalid email or password.</p>";
    }
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<title>Login Page</title>
<style>
<!-- I took this part out because I didn't want anyone to compromise my project -->
</style>
<center>
<table border="0" cellpadding="0" cellspacing="0" class="bordertable" width="700">
<tbody>
    <tr>
        <td>
        <table border="0" cellpadding="0" cellspacing="0" class="bottomborder" width="100%">
            <tbody>
                <tr>
                    <td bgcolor="#3B5998" width="350"><img src="../images/logo-left.jpg" /></td>
                    <td>
                    <table border="0" cellpadding="0" cellspacing="0" width="100%">
                        <tbody>
                            <tr>
                                <td>
                                <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                    <tbody>
                                        <tr>
                                            <td><a href="index.php?PHPSESSID="><img border="0" src="../images/logo-right.jpg" /></a></td>
                                            <td bgcolor="#3B5998" width="100%">&nbsp;</td>
                                        </tr>
                                    </tbody>
                                </table>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                <table border="0" cellpadding="4" cellspacing="0" width="100%">
                                    <tbody>
                                        <tr height="21"><!--<td bgcolor=#3B5998 width=10>&nbsp;</td>-->
                                            <td bgcolor="#3B5998" valign="bottom">&nbsp;<a class="menu" href="../login.php?PHPSESSID=&lt;?PHP echo session_id(); ?&gt;">login</a></td>
                                            <td bgcolor="#3B5998" valign="bottom">&nbsp;<a class="menu" href="../register.php?PHPSESSID=&lt;?PHP echo session_id(); ?&gt;">register</a></td>
                                            <td bgcolor="#3B5998" valign="bottom">&nbsp;<a class="menu" href="../about.php?PHPSESSID=&lt;?PHP echo session_id(); ?&gt;">about</a></td>
                                            <td bgcolor="#3B5998" width="100%">&nbsp;</td>
                                        </tr>
                                    </tbody>
                                </table>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                    </td>
                </tr>
            </tbody>
        </table>
        </td>
    </tr>
    <tr>
        <td>
        <table border="0" cellpadding="2" cellspacing="0" width="100%">
            <tbody>
                <tr>
                    <td valign="top">
                    <table border="0" cellpadding="0" cellspacing="0" width="105">
                        <tbody>
                            <tr>
                                <td>
                                <table cellpadding="2" cellspacing="0" class="dashedtable" width="100%">
                                    <tbody>
                                        <tr>
                                            <td align="right">
                                            <p>&nbsp;</p>

                                            <form action="login.php" method="post"><input name="PHPSESSID" type="hidden" value="&lt;?PHP echo session_id(); ?&gt;" /> Email:<br />
                                            <input class="inputtext" name="email" size="20" type="text" /><br />
                                            Password:<br />
                                            <input class="inputtext" name="pass" size="20" type="password" />
                                            <center><input class="inputsubmit" onclick="javascript:document.location='register.php';" type="button" value="register" /> &nbsp;<input class="inputsubmit" type="submit" value="login" /></center>
                                            </form>
                                            <!--<br>--></td>
                                        </tr>
                                    </tbody>
                                </table>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                    </td>
                    <td valign="top" width="595">
                    <table border="1" cellpadding="0" cellspacing="0" class="bordertable" width="100%">
                        <tbody>
                            <tr>
                                <td>
                                <table border="0" cellpadding="2" cellspacing="0" width="100%">
                                    <tbody>
                                        <tr>
                                            <td bgcolor="#3B5998" class="white">Login</td>
                                        </tr>
                                    </tbody>
                                </table>

                                <center>
                                <table>
                                    <tbody>
                                        <tr>
                                            <td><!--?PHP echo $error;?-->
                                            <form action="login.php" method="post"><input name="PHPSESSID" type="hidden" value="&lt;?PHP echo session_id(); ?&gt;" /><br />
                                            <br />
                                            <br />
                                            <br />
                                            &nbsp;</form>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                                </center>
                                </td>
                            </tr>
                        </tbody>
                    </table>

                    <center>
                    <p><a href="../about.php?PHPSESSID=&    lt;?PHP echo session_id(); ?&gt;">about</a>&nbsp;&nbsp; <a href="../contact.php?PHPSESSID=&lt;?PHP echo session_id(); ?&gt;">contact</a>&nbsp;&nbsp; <a href="../faq.php?PHPSESSID=&lt;?PHP echo session_id(); ?&gt;">faq</a>&nbsp;&nbsp; <a href="../terms.php?PHPSESSID=&lt;?PHP echo session_id(); ?&gt;">terms</a>&nbsp;&nbsp; <a href="../policy.php?PHPSESSID=&lt;?PHP echo session_id(); ?&gt;">privacy</a><br />
Developed by Fyre_Ph0x8<br />
PhyreByte Security Labs &copy; 2013</p>
</center>
</td>
</tr>
</tbody>
</table> 
</td>
</tr>
</tbody>
</table>
</center>

1 个答案:

答案 0 :(得分:0)

您可以仔细检查所有包含文件的大小写。我在过去遇到过一些问题,生产服务器在文件名包含方面是区分大小写的,但我的本地测试服务器却没有。此外,您应该仔细检查您的PHP版本和配置文件是否在测试服务器和生产服务器之间匹配。