当前位置: 首页 > 知识库问答 >
问题:

解析错误:语法错误,文件意外结束(注册脚本)[关闭]

苏宾鸿
2023-03-14

我的脚本有问题:S

这是错误:解析错误:语法错误,意外的文件结尾

这是完整的代码。我搜索了没有闭合的支架或其他东西,但没有找到: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";
?>

共有2个答案

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

if没有闭合大括号。

卞经业
2023-03-14

您忘记了此语句的结束括号:

if (!$resp->is_valid) {
    die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." . "(reCAPTCHA said: " . $resp->error . ")");
}
 类似资料:
  • 问题内容: 我有一个SQL查询,当将其放入函数中时,它将停止处理此错误消息。从功能中删除它会使它再次开始工作。 为什么是这样? 问题答案: 缩进的Heredoc分隔符将其破坏。说: 代替

  • 问题内容: 我得到了以下代码 请注意,我对数据值进行了硬编码。数据被很好地推送到数据库中。但是,我不断收到错误“解析错误语法错误,输入意外结束”。我确定我的数据使用正确的JSON语法。当我在Chrome检查器的网络上进行检查时,saveProduct请求显示数据正确。 此POST请求没有响应。因此,我对于解析错误的来源一无所知。我尝试使用FireFox浏览器。同样的事情发生了。 任何人都可以对什么

  • 我不知道为什么我得到这个错误:解析错误:语法错误,意外的文件结束在C:\xampp\htdocs\sitelink\top_links.php行60 分析错误:语法错误,C:\xampp\htdocs\sitelinks\top\u links中的文件意外结束。php在线60 有人能帮我吗?? 谢谢你uuuu

  • 问题内容: 我收到一个错误: 使用此代码: 有什么问题? 问题答案: 您应该避免这种情况(在代码末尾): 和这个: 您不应该将方括号直接放在open / close 标记附近,但要用空格隔开: 也避免和使用

  • 我读过任何与此相关的问题,答案说这是因为“丢失了相当多的分号”。我已经检查了我的代码,认为没有丢失分号...但是这个问题仍然发生在我身上。我的朋友,用和我一样的代码,不会遇到同样的问题。 这是我的代码(第115行是

  • 我有以下代码: 它在我的大多数服务器上运行良好,但在其中一个服务器上,我收到一个错误: PHP解析错误:语法错误,文件在第19行 /var/www/dokuwiki/lib/plugins/bez/tpl/issue_causes.php中意外结束, 这个代码有什么问题? 整个文件issue_cause.php: