public function Run()
 {
     //-- Session will be started also by set
     SmartSession::set('Samples_Benchmark_WithSession (just for admin)', true);
     //--
     //--
     $this->PageViewSetCfg('template-path', '@');
     // set template path to this module
     $this->PageViewSetCfg('template-file', 'template-benchmark.htm');
     // the default template
     //--
     //--
     $this->PageViewSetVar('title', 'Benchmark with Session Test URL');
     //--
     $this->PageViewSetVar('main', SmartMarkersTemplating::render_file_template($this->ControllerGetParam('module-path') . 'views/benchmark.htm', ['BENCHMARK-TITLE' => '[ Benchmark Test URL with PHP Session ]<br>use this URL to run a benchmark of this PHP framework with the PHP Session started ...']));
     //--
 }
Esempio n. 2
0
 public function draw_image($y_form)
 {
     //--
     $y_form = trim((string) $y_form);
     //--
     //--
     $out = '';
     //--
     ob_start();
     //--
     if ((string) $this->mode == 'hashed') {
         $captcha_arr = (array) $this->generate_captcha_hashed();
     } else {
         // 'dotted'
         $captcha_arr = (array) $this->generate_captcha_dotted();
     }
     //end if else
     //--
     $captcha_image = $captcha_arr['rawimage'];
     $captcha_word = $captcha_arr['word'];
     $captcha_arr = array();
     //--
     $err = ob_get_contents();
     ob_end_clean();
     //--
     if ((string) $err != '') {
         // trigger errors
         Smart::log_warning('#Captcha / Draw Image [' . $intext . '] Errors/Output: ' . $err);
     }
     //end if
     //--
     ob_start();
     //-
     switch (@strtolower($this->format)) {
         case "png":
             //header: "Content-type: image/png"
             imagepng($captcha_image);
             break;
         case "gif":
             //header: "Content-type: image/gif"
             imagegif($captcha_image);
             break;
         case "jpg":
         case "jpeg":
         default:
             //header: "Content-type: image/jpeg"
             imagejpeg($captcha_image, '', $this->quality);
     }
     //end switch
     //-
     $out = ob_get_contents();
     //-
     ob_end_clean();
     //-
     @imagedestroy($captcha_image);
     // free resources
     //--
     //--
     @setcookie(SmartCaptchaFormCheck::chkcookiename($y_form), sha1($y_form . SMART_FRAMEWORK_SECURITY_KEY), 0, '/');
     //--
     if (SmartCaptchaFormCheck::validate_form_name($y_form) === 1) {
         if ((string) $this->store == 'session') {
             SmartSession::set(SmartCaptchaFormCheck::cookiename($y_form), SmartCaptchaFormCheck::checksum($captcha_word));
         } else {
             @setcookie(SmartCaptchaFormCheck::cookiename($y_form), SmartCaptchaFormCheck::checksum($captcha_word), 0, '/');
         }
         //end if else
     }
     //end if
     //--
     //--
     return $out;
     //--
 }