带有自定义PHPBB登录页的验证码

带有自定义PHPBB登录页的验证码,php,captcha,phpbb,Php,Captcha,Phpbb,我试图在屏幕上弹出一个验证码,当你多次输入错误的密码,但不知道如何去做。我已经找到了很多关于这个的页面,但是它们都涉及到使用模板,并且没有一个页面解释我必须在表单中输入什么 这是我到目前为止得到的 define('IN_PHPBB', true); global $auth, $db, $cache, $config, $user, $phpbb_root_path, $phpEx, $template; $phpbb_root_path = (defined('PHPBB_RO

我试图在屏幕上弹出一个验证码,当你多次输入错误的密码,但不知道如何去做。我已经找到了很多关于这个的页面,但是它们都涉及到使用模板,并且没有一个页面解释我必须在表单中输入什么

这是我到目前为止得到的

define('IN_PHPBB', true);
    global $auth, $db, $cache, $config, $user, $phpbb_root_path, $phpEx, $template;
    $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : '../main/';
    $phpEx = substr(strrchr(__FILE__, '.'), 1);
    include($phpbb_root_path . 'common.' . $phpEx);

    $user->session_begin();
    $auth->acl($user->data);

    $remember = $remember==1?true:false;
    $result = $auth->login($username, $password, $remember);

    if ($result['status'] == LOGIN_SUCCESS){
        return "LOGIN_SUCCESS";
        //Launch captcha
    }else{
        if($result['status']==LOGIN_ERROR_ATTEMPTS){
            return "LOGIN_ERROR_ATTEMPTS";
        }
        if($result['status'] == LOGIN_ERROR_EXTERNAL_AUTH){
            return "No profile exists.";
        }elseif($result['status'] == LOGIN_BREAK){
            return "Failed to create session.";
        }elseif($result['status'] == LOGIN_ERROR_PASSWORD){
            return "Incorrect Password.";
        }elseif($result['status'] == LOGIN_ERROR_USERNAME){
            return "Invalid Username.";
        }elseif($result['status'] == LOGIN_ERROR_PASSWORD_CONVERT){
            return "Internal error, failed to convert password.";
        }elseif($result['status'] == LOGIN_ERROR_ACTIVE){
            return "User is inactive.";
        }
    }
define('IN_PHPBB',true);
全局$auth、$db、$cache、$config、$user、$phpbb\u root\u path、$phpEx、$template;
$phpbb_root_path=(已定义('phpbb_root_path'))?PHPBB_根路径:'./';
$phpEx=substr(strrchr(_文件,'.'),1);
包括($phpbb_root_path.'common..$phpEx);
如果(!class_存在('phpbb_验证码工厂'))
{
包括($phpbb_root_path.'includes/captcha/captcha_factory.$phpEx);
}
$user->session_begin();
$auth->acl($user->data);
$username=isset($\u POST['username'])$_帖子['username']:'';
$password=isset($\u POST['password'])$_POST['password']:'';
$memore=isset($\u POST['memore'])$_贴子[‘记住’]:“”;
$membert=$membert==1?真:假;
$result=$auth->login($username、$password、$memory);
$err='';
开关($result['status']))
{
案例登录成功:
$err.=“欢迎”。$user->data['username'];
打破
案例登录\u错误\u外部\u身份验证:
$err.='不存在配置文件';
打破
案例登录\u错误\u尝试:
$err.=''。“/n”
“.”“/n”
“.”“/n”
“
”。“/n” “.”“/n” “.”“/n” “.”“/n” . ''; $err.='LOGIN\u ERROR\u尝试'; 打破 案例登录\u错误\u密码\u转换: $err.='内部错误,无法转换密码'; 打破 案例登录中断: $err.=“未能创建会话。”; 打破 案例登录\u错误\u密码: $err.=“密码不正确。”; 打破 案例登录\u错误\u用户名: $err.=“无效的用户名。”; 打破 案例登录\u错误\u活动: $err.=“用户处于非活动状态。”; 打破 } 返回$err;
定义('IN_PHPBB',true);
全局$auth、$db、$cache、$config、$user、$phpbb\u root\u path、$phpEx、$template;
$phpbb_root_path=(已定义('phpbb_root_path'))?PHPBB_根路径:'./';
$phpEx=substr(strrchr(_文件,'.'),1);
包括($phpbb_root_path.'common..$phpEx);
如果(!class_存在('phpbb_验证码工厂'))
{
包括($phpbb_root_path.'includes/captcha/captcha_factory.$phpEx);
}
$user->session_begin();
$auth->acl($user->data);
$username=isset($\u POST['username'])$_帖子['username']:'';
$password=isset($\u POST['password'])$_POST['password']:'';
$memore=isset($\u POST['memore'])$_贴子[‘记住’]:“”;
$membert=$membert==1?真:假;
$result=$auth->login($username、$password、$memory);
$err='';
开关($result['status']))
{
案例登录成功:
$err.=“欢迎”。$user->data['username'];
打破
案例登录\u错误\u外部\u身份验证:
$err.='不存在配置文件';
打破
案例登录\u错误\u尝试:
$err.=''。“/n”
“.”“/n”
“.”“/n”
“
”。“/n” “.”“/n” “.”“/n” “.”“/n” . ''; $err.='LOGIN\u ERROR\u尝试'; 打破 案例登录\u错误\u密码\u转换: $err.='内部错误,无法转换密码'; 打破 案例登录中断: $err.=“未能创建会话。”; 打破 案例登录\u错误\u密码: $err.=“密码不正确。”; 打破 案例登录\u错误\u用户名: $err.=“无效的用户名。”; 打破 案例登录\u错误\u活动: $err.=“用户处于非活动状态。”; 打破 } 返回$err;
在旁注中,为什么不使用switch、case和break而不是这么多其他的呢?是的,我也计划更改,但这个验证码现在对我来说是一个更大的问题。在旁注中,为什么不使用switch、case和break而不是这么多其他的?是的,我也曾计划改变这一点,但现在这个验证码对我来说是一个更大的问题我以前有过这样的人,但是$captcha->get\u template()将返回false或'captcha\u default.html'不确定我如何在表单中实现它?我甚至不确定“captcha\u default.html”页面是什么。我该如何命名它的输入字段?该代码不处理验证码文本的输入。包含验证码的唯一方法是使用phpbb模板,或者您可以始终使用自己的验证码,或者有其他方法来完成与下面所示相同的操作。使用
login_框(请求变量('redirect','index.$phpEx')
或发帖子到
。/main/ucp.php?mode=login&redirect=myredirect
我以前有过这样的人,但是$captcha->get\u template()将返回false或'captcha\u default.html'不确定我如何在表单中实现它?我甚至不确定“captcha\u default.html”页面是什么。我该如何命名它的输入字段?该代码不处理验证码文本的输入。包含验证码的唯一方法是使用phpbb模板,或者您可以始终使用自己的验证码,或者有其他方法来完成与下面所示相同的操作。使用
login_框(请求变量('redirect','index.$phpEx')
或发帖子到
。/main/ucp.php?mode=login&redirect=myredirect
define('IN_PHPBB', true);
global $auth, $db, $cache, $config, $user, $phpbb_root_path, $phpEx, $template;
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
if (!class_exists('phpbb_captcha_factory'))
{
    include($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx);
}
$user->session_begin();
$auth->acl($user->data);
$username = isset($_POST['username']) ? $_POST['username'] : '';
$password = isset($_POST['password']) ? $_POST['password'] : '';
$remember = isset($_POST['remember']) ? $_POST['remember'] : '' ;
$remember = $remember==1?true:false;
$result = $auth->login($username, $password, $remember);
$err = '';

    switch ($result['status'])
    {
        case LOGIN_SUCCESS:
            $err .= 'Welcome ' . $user->data['username'];
        break;

        case LOGIN_ERROR_EXTERNAL_AUTH:
            $err .= 'No profile exists';
        break;

        case LOGIN_ERROR_ATTEMPTS:
            $err .= '<script type="text/javascript" src="http://www.google.com/recaptcha/api/challenge?k=your_public_key">' . "/n"
            . '</script>' . "/n"
            . '<noscript>' . "/n"
            . '<iframe src="http://www.google.com/recaptcha/api/noscript?k=your_public_key" height="300" width="500" frameborder="0"></iframe><br>' . "/n"
            . '<textarea name="recaptcha_challenge_field" rows="3" cols="40">' . "/n"
            . ' </textarea>' . "/n"
            . ' <input type="hidden" name="recaptcha_response_field" value="manual_challenge">' . "/n"
            . '</noscript>';
            $err .= 'LOGIN_ERROR_ATTEMPTS';
        break;

        case LOGIN_ERROR_PASSWORD_CONVERT:
            $err .= 'Internal error, failed to convert password.';
        break;

        case LOGIN_BREAK:
            $err .= "Failed to create session.";
        break;

        case LOGIN_ERROR_PASSWORD:
            $err .= "Incorrect Password.";
        break;

        case LOGIN_ERROR_USERNAME:
            $err .= "Invalid Username.";
        break;

        case LOGIN_ERROR_ACTIVE:
            $err .= "User is inactive.";
        break;
    }
return $err;