500内部错误,我的代码出了什么问题


500 Internal Error, Whats wrong with my code?

我的编码有点问题,当我运行这个脚本时,我一直收到500个错误:

<?php
include_once("../../includes/connect.php");
if (isset($_POST['action']) && $_POST['action'] == "check"){
$email = mysql_real_escape_string(strip-tags($_POST['email']));
$username = mysql_real_escape_string(strip_tags($_POST['username']));
if (strpos($email,"@")!== false){
    $check_email = explode("@",$email);
    if (strpos($check_email[1],".")=== false){
        echo 3;
        exit();
    }
} else {
    echo 3;
    exit();
}
$email_query = mysql_query("SELECT id FROM users WHERE email='$email' LIMIT 1");
if (mysql_num_rows($email_query)== 1){
    //Email already exists
    echo 1;
    exit();
} else {
    $username_query = mysql_query("SELECT username FROM users WHERE username='$username' LIMIT 1");
    if (mysql_num_rows($username_query)== 1){
        //Username already exists
        echo 2;
        exit();
    } else {
        //Everything is fine
        echo 0;
        exit();
    }
}
}
if (isset($_POST['action']) && $_POST['action'] == "register"){
    $username = mysql_real_escape_string(strip_tags($_POST['username']));
    $password = mysql_real_escape_string(strip_tags($_POST['password']));
    $email = mysql_real_escape_string(strip_tags($_POST['email']));
    $activation_code = md5($username.$password);
    $reg_query = mysql_query("INSERT INTO users (username, password, email, activfation_code) VALUES ('$username', '".md5($password)."', '$email', '$activation_code')");
    if ($reg_query){
        //Successfully registered
        $new_userid = mysql_insert_id();
        //Create new users folder
        #mkdir("../users/$new_userid", 0755);
        //Create new users images folder
        #mkdir("../users/$new_userid/images", 0755);
        //Create new users media folder
        #mkdir("../users/$new_userid/media", 0755);
        $to = $email;
        $from = "noreply@atradiesinc.com";
        $subject = "Activate your Account!";
        $message = "<h3>Welcome to Atradies Inc Gaming Community, ".$username."!</h3>
        <p>To complete registration you must verify and activate your account. Click the link below and the magic shall happen.</p>
        <p><a href='http://www.atradiesinc.com/network/?id=$new_userid&activate=$activation_code'>http://www.atradiesinc.com/network/?id=$new_userid&activate=$activation_code</a></p>
        <p>Once your account has been activated, you may login and join in with the community with the details below:<br />
        <strong>Username: </strong>$username<br />
        <strong>Password: </strong><i>Password you supplied on registration</i></p>
        <p>Thank you and enjoy the community!</p>";
        $headers = 'MIME-Version: 1.0' . "'r'n";
        $headers .= 'Content-type: text/html; charset=iso-8859-1' . "'r'n";
        $headers .= "From: $from'r'nReply-To: $from";
        mail($to, $subject, $message, $headers);
        echo 1;
        exit();
    } else {
        //Registration failed
        echo 0;
        exit();
    }
}
?>

怎么了?我似乎找不到任何问题。是代码问题,还是我尝试的服务器问题?我试过Chrome Inspect Element控制台,它在该文件上没有提供比"500内部服务器错误"更多的信息。

谢谢!

您在第三行中有一个小错误:

$email = mysql_real_escape_string(strip-tags($_POST['email']));

应该是

$email = mysql_real_escape_string(strip_tags($_POST['email']));

看看这些评论,它们非常重要。