Пример #1
0
 public static function newVerify($width = 60, $height = 25)
 {
     $im = imagecreate($width, $height);
     $backgroundcolor = imagecolorallocate($im, 255, 255, 255);
     $mCheckCodeNum = 4;
     $mCheckCode = '';
     for ($i = 0; $i < $mCheckCodeNum; $i++) {
         $mCheckCode .= strtoupper(chr(rand(97, 122)));
     }
     $session = new XF_Session('XF_ImageVerify');
     $session->write(strtolower($mCheckCode));
     for ($i = 0; $i <= 64; $i++) {
         $pointcolor = imagecolorallocate($im, mt_rand(1, 155), mt_rand(0, 200), mt_rand(1, 155));
         imagesetpixel($im, mt_rand(0, $width - 1), mt_rand(0, $height - 1), $pointcolor);
     }
     $snowflake_size = 5;
     for ($i = 0; $i < $mCheckCodeNum; $i++) {
         $font_color = imagecolorallocate($im, mt_rand(1, 155), mt_rand(1, 200), 100);
         $x = floor($width / $mCheckCodeNum) * $i + 3;
         $y = rand(0, $height - 15);
         imagechar($im, $snowflake_size, $x, $y, $mCheckCode[$i], $font_color);
     }
     $bordercolor = imagecolorallocate($im, 188, 188, 188);
     imagerectangle($im, 0, 0, $width - 1, $height - 1, $bordercolor);
     header('Content-type: image/png');
     imagepng($im);
     imagedestroy($im);
 }
Пример #2
0
 public function voteReportAction()
 {
     if ($this->_request->isXmlHttpRequest() && $this->_request->isPost()) {
         $typeId = $this->getParam("typeId");
         $voteType = $this->getParam("voteType");
         $gpjSession = new XF_Session("gpj_vote");
         if (!$gpjSession->isEmpty()) {
             if (in_array($typeId, $gpjSession->read())) {
                 die('{"code": "101"}');
             }
         }
         $cookie = new XF_Cookie("gpj_vote");
         $cookieAry = array();
         if (!$cookie->isEmpty()) {
             $cookieAry = explode(",", $cookie->read());
             if (in_array($typeId, $cookieAry)) {
                 die('{"code": "101"}');
             }
         }
         $vote = new Report_Model_Vote();
         $reportVote = $vote->getVoteByTypeId($typeId);
         if ($reportVote) {
             if ($voteType == "right") {
                 $voteAry["right_vote"] = $reportVote->right_vote + 1;
             } elseif ($voteType == "noright") {
                 $voteAry["noright_vote"] = $reportVote->noright_vote + 1;
             }
             $res = $vote->upVoteById($reportVote->id, $voteAry);
         } else {
             if ($voteType == "right") {
                 $voteAry["right_vote"] = 1;
                 $voteAry["noright_vote"] = 0;
             } elseif ($voteType == "noright") {
                 $voteAry["right_vote"] = 0;
                 $voteAry["noright_vote"] = 1;
             }
             $voteAry["car_id"] = $typeId;
             $res = $vote->addVote($voteAry);
         }
         if ($res) {
             $cookieAry[] = $typeId;
             $cookie->write(implode(",", $cookieAry), 86400);
             if (!$gpjSession->isEmpty()) {
                 $gpjAry = $gpjSession->read();
                 $gpjAry[] = $typeId;
             }
             $gpjSession->write($gpjAry);
             die('{"code":"200"}');
         }
     }
 }
Пример #3
0
 public function selfpersonAction()
 {
     // 获得session,平台id
     $gpj_session = new XF_Session("gpj_session");
     if ($gpj_session->hasContent("modelId")) {
         $sessionAry = $gpj_session->read();
         $sessionAry["dataFrom"] = "selfperson";
         $gpj_session->write($sessionAry);
     } else {
         throw new XF_Exception('选择个人页面:评估页面没有选择车型');
     }
     //        获取车商
     $used = new Used_Model_Used();
     $carDealers = $used->getUsedCarDealers($sessionAry["province"], "c2c", "", "1", "1000");
     $this->_view->selfperson = $carDealers;
     $this->setLayout(new Layout_Default());
     $this->_view->headStylesheet('/css/sell/selfperson.css');
     $this->_view->headStylesheet('/css/common.css');
     $this->_view->headScript('/js/pagejs/selfperson.js');
     $this->_view->detailModel = $sessionAry["detail_model"];
     $this->_view->detailYear = $sessionAry["detail_year"];
     $this->_view->detailMile = $sessionAry["detail_mile"];
     $this->_view->detailPrice = $sessionAry["detail_price"];
     $this->_view->detailBrand = $sessionAry["detail_brand"];
 }