当前位置: 首页>>代码示例>>PHP>>正文


PHP CMS::getagent方法代码示例

本文整理汇总了PHP中CMS::getagent方法的典型用法代码示例。如果您正苦于以下问题:PHP CMS::getagent方法的具体用法?PHP CMS::getagent怎么用?PHP CMS::getagent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CMS的用法示例。


在下文中一共展示了CMS::getagent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: sendEmail

 public function sendEmail(Ticket $model)
 {
     $config = Yii::app()->settings->get('core');
     $request = Yii::app()->request;
     $user = Yii::app()->user;
     $browser = CMS::detectBrowser(CMS::getagent());
     $platform = CMS::detectPlatform(CMS::getagent());
     $body = "\n            \n\n\n<p>Тема: {$model->name}</p>\n<p>Сообщение: {$model->text}</p>\n\n    <br><br>\n<center><a style=\"font-size:24px;text-decoration:none;color:#fff;padding:10px;border:1px solid #333;background-color:#999;\" href=\"http://builshop.net/admin/support/?view={$model->id}\">Перейки к обращению</a></center>\n<hr />\n<p>Пользователь: {$user->login} #{$user->id}</p>\n<p>Браузер: {$browser}</p>\n<p>ПО: {$platform}</p>\n<p>IP: {$request->userHostAddress}</p>\n\n";
     $mailer = Yii::app()->mail;
     $mailer->From = 'noreply@' . $request->serverName;
     $mailer->FromName = $request->serverName;
     $mailer->Subject = 'Обращение в техподдержку';
     $mailer->Body = $body;
     foreach (Yii::app()->params['support_email'] as $email) {
         $mailer->AddAddress($email);
     }
     $mailer->AddReplyTo($config['admin_email']);
     $mailer->isHtml(true);
     $mailer->Send();
     $mailer->ClearAddresses();
 }
开发者ID:buildshop,项目名称:bs-common,代码行数:21,代码来源:DefaultController.php

示例2: log_in

 /**
  * Авторизация на форуме
  * @param string $login
  * @param string $password
  * @return boolean
  */
 public function log_in($login, $password)
 {
     $password = md5($password);
     $member = $this->FDB->createCommand("SELECT * FROM {$this->tbl_prefix}members WHERE name='" . $login . "'")->queryRow();
     if ($member['members_pass_hash'] != self::generateCompiledPasshash(str_replace("\\\\", '\\', $member['members_pass_salt']), $password)) {
         return false;
     }
     $sid = md5(uniqid(microtime()));
     $expire = time() + intval(84600 * Yii::app()->settings->get('core', 'cookie_time'));
     $pass_hash_set = $member['member_login_key'];
     $this->stronghold_set_cookie($member['member_id'], $member['member_login_key']);
     Yii::app()->request->enableCookieValidation = false;
     Yii::app()->request->cookies['member_id'] = new CHttpCookie('member_id', $member['member_id'], array('expire' => $expire));
     Yii::app()->request->cookies['pass_hash'] = new CHttpCookie('pass_hash', $pass_hash_set, array('expire' => $expire));
     Yii::app()->request->cookies['session_id'] = new CHttpCookie('session_id', $sid, array('expire' => $expire));
     $this->FDB->createCommand("UPDATE {$this->tbl_prefix}members SET ip_address='" . $_SERVER['REMOTE_ADDR'] . "' WHERE member_id='" . $member['member_id'] . "'")->execute();
     $this->FDB->createCommand("DELETE FROM {$this->tbl_prefix}sessions WHERE ip_address='" . $_SERVER['REMOTE_ADDR'] . "'")->execute();
     $userag = CMS::getagent();
     $browser = substr($userag, 0, 64);
     $ip = substr($_SERVER['REMOTE_ADDR'], 0, 16);
     $this->FDB->createCommand("INSERT INTO {$this->tbl_prefix}sessions (id, member_name, seo_name, member_id, running_time, ip_address, browser, login_type, member_group) VALUES ('{$sid}', '" . $member['name'] . "','" . $member['name'] . "', '" . $member['member_id'] . "',  '" . time() . "', '{$ip}', '{$browser}', '0', '" . $member['member_group_id'] . "')")->execute();
     return true;
 }
开发者ID:buildshop,项目名称:bs-common,代码行数:29,代码来源:IPB.php

示例3: log_in

 public function log_in($login, $password)
 {
     $expire = time() + intval(84600 * Yii::app()->settings->get('core', 'cookie_time'));
     $user_name = strtolower(str_replace('|', '&#124;', $login));
     $user_password = md5($password);
     $member = $this->FDB->createCommand("SELECT userid, usergroupid, membergroupids, infractiongroupids, username, password, salt FROM {$this->tbl_prefix}user WHERE LOWER(username) = '" . $user_name . "'")->queryRow();
     if (isset($member)) {
         if ($member['password'] != md5($user_password . $member['salt'])) {
             return false;
         }
         // $ip = substr($_SERVER['REMOTE_ADDR'], 0, 16);
         $ip = implode('.', array_slice(explode('.', $ip), 0, 4 - 1));
         $userag = CMS::getagent();
         $session_idhash = md5($userag . $ip);
         $scriptpath = $_SERVER['REQUEST_URI'] ? $_SERVER['REQUEST_URI'] : $_ENV['REQUEST_URI'];
         $sessionhash = md5(time() . $scriptpath . $session_idhash . $ip . mt_rand(1, 1000000));
         //$GENsessionhash = md5(uniqid(microtime(), true));
         //  die($sessionhash);
         $browser = substr($userag, 0, 64);
         $old_s_id = Html::text($_COOKIE[$this->cookieprefix . "sessionhash"]);
         Yii::app()->request->enableCookieValidation = false;
         if ($old_s_id != "") {
             $this->FDB->createCommand("DELETE FROM {$this->tbl_prefix}session WHERE sessionhash = '" . $old_s_id . "'")->execute();
         }
         $this->FDB->createCommand("INSERT INTO {$this->tbl_prefix}session (sessionhash, userid, host, idhash, lastactivity, location, useragent, loggedin) VALUES ('{$sessionhash}', '" . $member['userid'] . "', '{$ip}', '{$session_idhash}', '" . time() . "', '{$scriptpath}', '{$browser}', '1')")->execute();
         setcookie($this->cookieprefix . "userid", $member['userid'], $expire);
         //setcookie($this->cookieprefix . "password", md5($member['password'] . $this->fcookiesalt), $expire);
         setcookie($this->cookieprefix . "password", md5($user_password . $member['salt']), $expire);
         setcookie($this->cookieprefix . "sessionhash", $sessionhash, $expire);
     } else {
         return false;
     }
 }
开发者ID:buildshop,项目名称:bs-common,代码行数:33,代码来源:VB5.php


注:本文中的CMS::getagent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。