<?php /** * RUWT page controller */ include __DIR__ . '/config.php'; $settings = array('imageDir' => __DIR__ . DIRECTORY_SEPARATOR . 'img' . DIRECTORY_SEPARATOR, 'cacheDir' => __DIR__ . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR, 'maxWidth' => 2000, 'maxHeight' => 2000); $img = new CImage($settings); $img->Show();
$verify_code = trim($_SESSION['verify_code']); $len = strlen($verify_code); //---- $x = 3; $y = 3; $w = imagefontwidth(5); mt_srand($this->MakeSeed()); //---- for ($i = 0; $i < $len; ++$i) { imagestring($im, 5, $x, $y + mt_rand(0, 4) - 2, $verify_code[$i], $black); //---- $x += $w; } //---- output the image imagegif($im); //---- exit; } function Show() { } function MakeSeed() { list($usec, $sec) = explode(' ', microtime()); return (double) $sec + (double) $usec * 100000; } } //--- show captcha $image = new CImage(); $image->Show(); //+------------------------------------------------------------------+