PHP页面为空,源代码为空

PHP页面为空,源代码为空,php,html,Php,Html,当我在浏览器中打开PHP文件时,它是空白的。而且,当我打开源代码时,它也是空的 这是我正在关注的问题 代码如下: <?php error_reporting(E_ALL ^ E_NOTICE); ?> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title

当我在浏览器中打开PHP文件时,它是空白的。而且,当我打开源代码时,它也是空的

这是我正在关注的问题

代码如下:

<?php

error_reporting(E_ALL ^ E_NOTICE);

?>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Member System - Register</title>
</head>
<body>
<?php

if ($_POST['registerbtn']) {
    $getuser = $_POST['user'];
    $getemail = $_POST['email'];
    $getpass = $_POST['pass'];
    $getconfirmpass = $_POST['confirmpass'];

    if ($getuser) {
        if ($getemail) {
            if ($getpass) {
                if ($getconfirmpass) {
                    if ($getpass === $getconfirmpass) {
                        if (strlen($getemail) >= 7) && (strstr($getemail, "@")) && (strstr($getemail, ".")) {
                            require("./connect.php");

                            $query = mysql_query("SELECT * FROM users WHERE username='$getuser'");
                            $numrows = mysql_num_rows($query);
                            if ($numrows == 0) {
                                $query = mysql_query("SELECT * FROM users WHERE email='$getemail'");
                                $numrows = mysql_num_rows($query);
                                if ($numrows == 0) {

                                    $password = md5 (md5("kjfiufj".$getpass."Fjf56fj"));
                                    $date = date("F d, Y");
                                    $code = md5(rand());

                                    mysql_query("INSERT INTO users VALUES (
                                        '', '$getuser', '$password', '$getemail', '0', '$code', '$date'
                                    )");

                                    $query = mysql_query("SELECT * FROM users WHERE username='$getuser'");
                                    $numrows = mysql_num_rows($query);
                                    if ($numrows == 1) {

                                        $site = "http://localhost/PHP Projects/Member System";
                                        $webmaster = "Askman <donotreply@askmanproducts.com>";
                                        $headers = "From: $webmaster";
                                        $subject = "Activate Your New Account!";
                                        $message = "Thanks for regisntering. Click the link below to activate your account!\n";
                                        $message .= "$site/activate?user=$getuser&code=$code\n";
                                        $message .= "You must activate your account to login.";

                                        if (mail($getemail, $subject, $message, $headers)){
                                            $errormsg = "You have been registered. You must activate your account from the activation link sent to <b>$getemail</b>";
                                            $getuser = "";
                                            $getemail = "";
                                        }
                                        else 
                                            $errormsg = "An error has occured. Your activation email was not sent.";

                                    }
                                    else
                                        $errormsg = "An error has occured. Your account was not created.";

                                }
                                else
                                    $errormsg = "There is already a user with that email.";
                            }
                            else
                                $errormsg = "There is already a user with that username.";

                            mysql_close();
                        }
                        else
                            $errormsg = "You must enter a valid email address to register.";
                    }
                    else
                        $errormsg = "Your passwords did not match.";
                }
                else 
                    $errormsg = "You must confirm your password to register.";
            }
            else
                $errormsg = "You must enter your password to register.";
        }
        else
            $errormsg = "You must enter your email to register.";
    }
    else 
        $errormsg = "You must enter your username to register.";

}

$form = "<form action='./register' method='post'>
<table>
<tr>
    <td</td>
    <td><font color='red'>$errormsg</font></td>
</tr>
<tr>
    <td>Username:</td>
    <td><input type='text' name='user' value='$getuser' /></td>
</tr>
<tr>
    <td>Email:</td>
    <td><input type='text' name='email' value='$getemail' /></td>
</tr>
<tr>
    <td>Password:</td>
    <td><input type='password' name='pass' value='' /></td>
</tr>
<tr>
    <td>Confirm Password:</td>
    <td><input type='password' name='confirmpass' value='' /></td>
</tr>
<tr>
    <td></td>
    <td><input type='submit' name='registerbtn' value='Register' /></td>
</tr>
</table>
</form>";

echo $form;

?>
</body>
</html>

你在这行有错误 如果strlen$getemail>=7&&strstr$getemail,@&&str$getemail。{

如果strlen$getemail>=7&&strstr$getemail,@&&str$getemail{

另外,浏览器中的源代码将向您显示html代码,而不是php。php是服务器端,因此其代码位于服务器内部,浏览器无法看到 php代码

完整代码

<?php

error_reporting(E_ALL ^ E_NOTICE);

?>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Member System - Register</title>
</head>
<body>
<?php

if ($_POST['registerbtn']) {
    $getuser = $_POST['user'];
    $getemail = $_POST['email'];
    $getpass = $_POST['pass'];
    $getconfirmpass = $_POST['confirmpass'];

    if ($getuser) {
        if ($getemail) {
            if ($getpass) {
                if ($getconfirmpass) {
                    if ($getpass === $getconfirmpass) {
                        if ((strlen($getemail) >= 7) && (strstr($getemail, "@")) && (strstr($getemail, "."))) {
                            require("./connect.php");

                            $query = mysql_query("SELECT * FROM users WHERE username='$getuser'");
                            $numrows = mysql_num_rows($query);
                            if ($numrows == 0) {
                                $query = mysql_query("SELECT * FROM users WHERE email='$getemail'");
                                $numrows = mysql_num_rows($query);
                                if ($numrows == 0) {

                                    $password = md5 (md5("kjfiufj".$getpass."Fjf56fj"));
                                    $date = date("F d, Y");
                                    $code = md5(rand());

                                    mysql_query("INSERT INTO users VALUES (
                                        '', '$getuser', '$password', '$getemail', '0', '$code', '$date'
                                    )");

                                    $query = mysql_query("SELECT * FROM users WHERE username='$getuser'");
                                    $numrows = mysql_num_rows($query);
                                    if ($numrows == 1) {

                                        $site = "http://localhost/PHP Projects/Member System";
                                        $webmaster = "Askman <donotreply@askmanproducts.com>";
                                        $headers = "From: $webmaster";
                                        $subject = "Activate Your New Account!";
                                        $message = "Thanks for regisntering. Click the link below to activate your account!\n";
                                        $message .= "$site/activate?user=$getuser&code=$code\n";
                                        $message .= "You must activate your account to login.";

                                        if (mail($getemail, $subject, $message, $headers)){
                                            $errormsg = "You have been registered. You must activate your account from the activation link sent to <b>$getemail</b>";
                                            $getuser = "";
                                            $getemail = "";
                                        }
                                        else
                                            $errormsg = "An error has occured. Your activation email was not sent.";

                                    }
                                    else
                                        $errormsg = "An error has occured. Your account was not created.";

                                }
                                else
                                    $errormsg = "There is already a user with that email.";
                            }
                            else
                                $errormsg = "There is already a user with that username.";

                            mysql_close();
                        }
                        else
                            $errormsg = "You must enter a valid email address to register.";
                    }
                    else
                        $errormsg = "Your passwords did not match.";
                }
                else
                    $errormsg = "You must confirm your password to register.";
            }
            else
                $errormsg = "You must enter your password to register.";
        }
        else
            $errormsg = "You must enter your email to register.";
    }
    else
        $errormsg = "You must enter your username to register.";

}

$form = "<form action='./register' method='post'>
<table>
<tr>
    <td</td>
    <td><font color='red'>$errormsg</font></td>
</tr>
<tr>
    <td>Username:</td>
    <td><input type='text' name='user' value='$getuser' /></td>
</tr>
<tr>
    <td>Email:</td>
    <td><input type='text' name='email' value='$getemail' /></td>
</tr>
<tr>
    <td>Password:</td>
    <td><input type='password' name='pass' value='' /></td>
</tr>
<tr>
    <td>Confirm Password:</td>
    <td><input type='password' name='confirmpass' value='' /></td>
</tr>
<tr>
    <td></td>
    <td><input type='submit' name='registerbtn' value='Register' /></td>
</tr>
</table>
</form>";

echo $form;

?>
</body>
</html>

您在此行中缺少一个;$site=http://localhost/PHP 项目/成员系统使用PHP的空白页通常意味着服务器端出现错误。打开错误报告,检查日志等。确定错误是什么。如何打开错误报告?代码转储答案和代码转储问题一样糟糕。请解释您所做的更改对不起,我改了