2012-12-20 96 views
-3

我有我的腳本一個問題:S解析錯誤:語法錯誤,意外的文件結尾(註冊腳本)

This is the error:Parse error: syntax error, unexpected end of file

以下是完整的code.I搜索沒有關閉bracklets或東西,但沒」發現任何:S 我希望你們中的一些人可以找到問題。

<?php 
include "header.php"; 
include "menu.php"; 
?> 
<div class="wrapper"> 
<table width=100%> 
    <td valign=top width=230px> 
     <div class="login"> 
     <form name="register" method="post" action="$_SERVER[PHP_SELF]" onsubmit="return validateregister()"> 
     <input type="text" name="username" placeholder="Username"/><br /> 
     <input type="password" name="password" placeholder="Password"/><br /> 
     <input type="password" name="passwordagain" placeholder="Password again"/><br /> 
     <input type="text" name="email" placeholder="E-mail"/><br /> 
     <input type="text" name="mcname" placeholder="Minecraft Name"/><br /> 
     <?php 
     $captchaquery = mysql_query('SELECT * FROM general'); 
     $captcha = mysql_fetch_array($captchaquery); 
     if($captcha['captcha'] == 'enabled') 
     { 
      require_once('functions/recaptchalib.php'); 
      $publickey = $captcha['captchapublic']; 
      echo recaptcha_get_html($publickey); 
     } 
     ?> 
     <input class="btn" type="submit" name="register" value="Register" /> 
     </form> 
     </div> 
    </td> 
    <td valign=top> 
     <div id="errors" style="width:80%; margin-left:auto; margin-right:auto;"></div> 
    </td> 
</table> 
<?php 
if(isset($_POST['register'])) 
{ 
    if($captcha['captcha'] == 'enabled') 
    { 
     require_once('recaptchalib.php'); 
     $privatekey = $captcha['captchaprivate']; 
     $resp = recaptcha_check_answer ($privatekey, 
           $_SERVER["REMOTE_ADDR"], 
           $_POST["recaptcha_challenge_field"], 
           $_POST["recaptcha_response_field"]); 

     if (!$resp->is_valid) { 
     die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." . "(reCAPTCHA said: " . $resp->error . ")"); 
    } 
    else 
    { 
    registerUser($_POST['username'], $_POST['password'], $_POST['passwordagain'], $_POST['email'], $_POST['mcname']); 
    } 
} 
include "footer.php"; 
?> 
+0

一個IDE會發現這個問題。 [Coda](http://panic.com/coda/)或[Netbeans](http://netbeans.org/downloads/)是很好的PHP IDE。 –

回答

5

你忘了這句話結束括號:

if (!$resp->is_valid) { 
    die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." . "(reCAPTCHA said: " . $resp->error . ")"); 
} 
+1

這就是爲什麼你_always_ indent正確:) – Basic

+1

所以你是基本的 –

0
if (!$resp->is_valid) { 
    die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." . "(reCAPTCHA said: " . $resp->error . ")"); 

的,如果沒有右大括號。

+0

謝謝:)真的很快回復 – IcEaGe

相關問題