<?php
// +-------------------------------------------------+
// © 2002-2004 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net)
// +-------------------------------------------------+
// $Id: Controller.php,v 1.2.8.2 2026/05/21 09:13:00 gneveu Exp $

namespace Pmb\Common\Opac\Controller;

use Pmb\Common\Controller\Controller as ControllerBase;
use Pmb\Common\Models\CaptchaModel;

if (stristr($_SERVER['REQUEST_URI'], basename(__FILE__))) {
	die("no access");
}

class Controller extends ControllerBase
{

    protected function check_captcha(string $value)
    {
        global $msg;

        $check = CaptchaModel::verify($value);
        if(!$check) {
            $flag = false;
            $message = $msg['animation_registration_verifcode_mandatory'];
        }

        // Remove random value
        $_SESSION['image_random_value'] = '';

        return array(
            "success" => $flag,
            "message" => $message
        );
    }
}
