コード例 #1
0
ファイル: SetupController.php プロジェクト: laiello/quickbug
 /**
  * 语言切换
  */
 public function langAction()
 {
     $lang = $this->request->getGet('lang');
     // 记录 session
     QP_Session_Session::set('lang', $lang);
     // 跳转到上一个页面
     $url = $this->request->getGet('bgurl');
     $url == '' && ($url = QP_Sys::url('setup'));
     $this->location($url);
 }
コード例 #2
0
ファイル: IndexController.php プロジェクト: laiello/quickbug
 /**
  * 语言切换
  */
 public function langAction()
 {
     $lang = $this->request->getGet('lang');
     // 记录 session
     QP_Session_Session::set('lang', $lang);
     // 如果登录了则记录用户的语言选择
     if ($this->userid > 0) {
         $userModel = new Model_User();
         $userModel->saveSet('lang', $lang);
     }
     $url = $this->request->getGet('bgurl');
     $url == '' && ($url = QP_Sys::url('index'));
     $this->location($url);
 }
コード例 #3
0
ファイル: User.php プロジェクト: laiello/quickbug
 /**
  * 用户登出
  *
  * @return boolean
  */
 public function logout()
 {
     // 写SESSION
     QP_Session_Session::set(array('login_userid' => 0, 'login_username' => '', 'login_truename' => '', 'login_priv' => 0, 'lang' => ''));
     return true;
 }
コード例 #4
0
ファイル: Image.php プロジェクト: laiello/quickbug
 /**
  * 生成图片验证码
  *
  * @param int $length :验证码长度
  * @param int $mode :模型 0:数字 1:小写字母 2:大写字母 3:字母与数字组合
  * @param string $type :指定图片类型,一般用默认值.
  * @param int $width :图片宽
  * @param int $height :图片高
  */
 public static function imgVerify($length = 4, $mode = 3, $type = 'png', $width = 48, $height = 22)
 {
     // 生成随机数保存在 SESSION 中
     $randval = QP_Func_Func::randString($length, $mode);
     QP_Session_Session::set('QP_Verify_Code', md5(strtolower($randval)));
     $width = $length * 9 + 10 > $width ? $length * 9 + 10 : $width;
     if ($type != 'gif' && function_exists('imagecreatetruecolor')) {
         $im = @imagecreatetruecolor($width, $height);
     } else {
         $im = @imagecreate($width, $height);
     }
     $r = array(225, 255, 255, 223);
     $g = array(225, 236, 237, 255);
     $b = array(225, 236, 166, 125);
     $key = mt_rand(0, 3);
     //$backColor = imagecolorallocate($im, $r[$key],$g[$key],$b[$key]);    //背景色(随机)
     $backColor = imagecolorallocate($im, 255, 255, 255);
     //背景白色
     $borderColor = imagecolorallocate($im, 100, 100, 100);
     //边框色
     //$pointColor = imagecolorallocate($im,mt_rand(0,255),mt_rand(0,255),mt_rand(0,255));                 //点颜色
     $pointColor = imagecolorallocate($im, 255, 255, 255);
     @imagefilledrectangle($im, 0, 0, $width - 1, $height - 1, $backColor);
     @imagerectangle($im, 0, 0, $width - 1, $height - 1, $borderColor);
     $stringColor = imagecolorallocate($im, mt_rand(0, 200), mt_rand(0, 120), mt_rand(0, 120));
     // 干扰
     for ($i = 0; $i < 10; $i++) {
         //$fontcolor=imagecolorallocate($im,mt_rand(0,255),mt_rand(0,255),mt_rand(0,255));
         //imagearc($im,mt_rand(-10,$width),mt_rand(-10,$height),mt_rand(30,300),mt_rand(20,200),55,44,$fontcolor);
     }
     for ($i = 0; $i < 25; $i++) {
         $fontcolor = imagecolorallocate($im, mt_rand(0, 255), mt_rand(0, 255), mt_rand(0, 255));
         imagesetpixel($im, mt_rand(0, $width), mt_rand(0, $height), $pointColor);
     }
     @imagestring($im, 5, 5, 3, $randval, $stringColor);
     header("Content-type: image/" . $type);
     $ImageFun = 'Image' . $type;
     $ImageFun($im);
     imagedestroy($im);
 }