Esempio n. 1
0
 public function __construct($type = 1, $size = 6)
 {
     Oraculum_Request::init_sess();
     if (is_null(Oraculum_Request::sess("captcha"))) {
         if ($type == 3) {
             $letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
             $max = 61;
         } elseif ($type == 2) {
             $letters = 'abcdefghijklmnopqrstuvwxyz0123456789';
             $max = 35;
         } else {
             $letters = '0123456789';
             $max = 9;
         }
         $string = NULL;
         for ($i = 0; $i < $size; $i++) {
             $string .= $letters[mt_rand(0, $max)];
         }
         Oraculum_Request::setsess("captcha", $string);
     } else {
         $string = Oraculum_Request::sess("captcha");
     }
     $img = imagecreate(10 * $size, 25);
     $backcolor = imagecolorallocate($img, 255, 255, 255);
     $textcolor = imagecolorallocate($img, 00, 00, 00);
     imagefill($img, 0, 0, $backcolor);
     imagestring($img, 10, 0, 5, $string, $textcolor);
     header("Content-type: image/jpeg");
     imagejpeg($img);
 }
Esempio n. 2
0
 public function RecordSession($redirect = FALSE)
 {
     if (!is_null($this->_key)) {
         $obj = $this->_register;
         foreach ($this->_fields as $field) {
             //if (property_exists(get_class($obj),$field)) {
             $user[$field] = Oraculum_Crypt::strcrypt($obj->{$field});
             //}
         }
         $user['ip'] = Oraculum_Crypt::strcrypt(Oraculum_HTTP::ip());
         $user['key'] = Oraculum_Crypt::strcrypt($this->_key);
         $user['user'] = Oraculum_Crypt::strcrypt($this->_user);
         Oraculum_Request::init_sess();
         Oraculum_Request::setsess($this->_sessname, $user);
         if ($redirect) {
             Oraculum_HTTP::redirect($this->_homeurl);
         }
         return true;
     } else {
         return false;
     }
 }
Esempio n. 3
0
function init_sess()
{
    return Oraculum_Request::init_sess();
}