function GetImage()
{
    // saved data for the specified Captcha object in the application
    $captcha = GetCaptchaObject();
    if (is_null($captcha)) {
        LBD_HttpHelper::BadRequest('Captcha doesn\'t exist');
    }
    // identifier of the particular Captcha object instance
    $instanceId = GetInstanceId();
    if (is_null($instanceId)) {
        LBD_HttpHelper::BadRequest('Instance doesn\'t exist');
    }
    // image generation invalidates sound cache, if any
    ClearSoundData($instanceId);
    // response headers
    LBD_HttpHelper::DisallowCache();
    // MIME type
    $mimeType = $captcha->ImageMimeType;
    header("Content-Type: {$mimeType}");
    // we don't support content chunking, since image files
    // are regenerated randomly on each request
    header('Accept-Ranges: none');
    // image generation
    $rawImage = $captcha->GetImage($instanceId);
    $captcha->Save();
    // record generated Captcha code for validation
    session_write_close();
    // output image bytes
    $length = strlen($rawImage);
    header("Content-Length: {$length}");
    echo $rawImage;
}
 /**
  * Generate a Captcha image.
  *
  * @return image
  */
 public function GetImage()
 {
     if (is_null($this->Captcha)) {
         \LBD_HttpHelper::BadRequest('captcha');
     }
     // identifier of the particular Captcha object instance
     $instanceId = $this->GetInstanceId();
     if (is_null($instanceId)) {
         \LBD_HttpHelper::BadRequest('instance');
     }
     // response headers
     \LBD_HttpHelper::DisallowCache();
     // response MIME type & headers
     $mimeType = $this->Captcha->CaptchaBase->ImageMimeType;
     header("Content-Type: {$mimeType}");
     // we don't support content chunking, since image files
     // are regenerated randomly on each request
     header('Accept-Ranges: none');
     // image generation
     $rawImage = $this->Captcha->CaptchaBase->GetImage($instanceId);
     $this->Captcha->CaptchaBase->Save();
     $length = strlen($rawImage);
     header("Content-Length: {$length}");
     return $rawImage;
 }
예제 #3
0
function GetImage()
{
    // saved data for the specified Captcha object in the application
    $captcha = GetCaptchaObject();
    if (is_null($captcha)) {
        LBD_HttpHelper::BadRequest('captcha');
    }
    // identifier of the particular Captcha object instance
    $instanceId = GetInstanceId();
    if (is_null($instanceId)) {
        LBD_HttpHelper::BadRequest('instance');
    }
    while (ob_get_length()) {
        ob_end_clean();
    }
    ob_start();
    try {
        // response headers
        LBD_HttpHelper::DisallowCache();
        // MIME type
        $mimeType = $captcha->ImageMimeType;
        header("Content-Type: {$mimeType}");
        // we don't support content chunking, since image files
        // are regenerated randomly on each request
        header('Accept-Ranges: none');
        // disallow audio file search engine indexing
        header('X-Robots-Tag: noindex, nofollow, noarchive, nosnippet');
        // image generation
        $rawImage = $captcha->GetImage($instanceId);
        // record generated Captcha code for validation
        $captcha->Save();
        $length = strlen($rawImage);
        header("Content-Length: {$length}");
        echo $rawImage;
    } catch (Exception $e) {
        header('Content-Type: text/plain');
        echo $e->getMessage();
    }
    ob_end_flush();
    exit;
}
 public static function SmartDisallowCache()
 {
     $_Ol2ya434xp5o510g = !empty($_GET["e"]);
     $_0i7w3s9abllni2fl = !empty($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] != "off";
     if ($_Ol2ya434xp5o510g || $_0i7w3s9abllni2fl) {
         LBD_HttpHelper::DisallowCacheSsl();
     } else {
         LBD_HttpHelper::DisallowCache();
     }
 }
 public static function SmartDisallowCache()
 {
     $_0giezrxkmg8gnperrhygj5z9lb = !empty($_GET["e"]);
     $_Osgqltpppcg4fg3f = !empty($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] != "off";
     if ($_0giezrxkmg8gnperrhygj5z9lb || $_Osgqltpppcg4fg3f) {
         LBD_HttpHelper::DisallowCacheSsl();
     } else {
         LBD_HttpHelper::DisallowCache();
     }
 }
 public static function SmartDisallowCache()
 {
     $_lkrqir6u70olex3paufhfwv2qm = !empty($_GET["e"]);
     $_Oe21y7g8pkunmjgihjghm = !empty($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] != "off";
     if ($_lkrqir6u70olex3paufhfwv2qm || $_Oe21y7g8pkunmjgihjghm) {
         LBD_HttpHelper::DisallowCacheSsl();
     } else {
         LBD_HttpHelper::DisallowCache();
     }
 }
예제 #7
0
 public static function SmartDisallowCache()
 {
     $_Ilg51431wanuzq0pvvs24 = !empty($_GET["e"]);
     $_i4dqa4cc4aqqfhzxbm5u0uv79p = !empty($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] != "off";
     if ($_Ilg51431wanuzq0pvvs24 || $_i4dqa4cc4aqqfhzxbm5u0uv79p) {
         LBD_HttpHelper::DisallowCacheSsl();
     } else {
         LBD_HttpHelper::DisallowCache();
     }
 }