Error Info: Connection refused
$this->executeCommand('AUTH', [$this->password]); } if ($this->database !== null) { $this->executeCommand('SELECT', [$this->database]); } $this->initConnection(); } else { \Yii::error("Failed to open redis DB connection ($connection): $errorNumber - $errorDescription", __CLASS__); $message = YII_DEBUG ? "Failed to open redis DB connection ($connection): $errorNumber - $errorDescription" : 'Failed to open DB connection.'; throw new Exception($message, $errorDescription, $errorNumber); } } /** * Closes the currently active DB connection. * It does nothing if the connection is already closed. */ public function close() {
* See [redis protocol description](http://redis.io/topics/protocol) * for details on the mentioned reply types. * @throws Exception for commands that return [error reply](http://redis.io/topics/protocol#error-reply). */ public function executeCommand($name, $params = []) { $this->open(); $params = array_merge(explode(' ', $name), $params); $command = '*' . count($params) . "\r\n"; foreach ($params as $arg) { $command .= '$' . mb_strlen($arg, '8bit') . "\r\n" . $arg . "\r\n"; }
* @return mixed */ public function __call($name, $params) { $redisCommand = strtoupper(Inflector::camel2words($name, false)); if (in_array($redisCommand, $this->redisCommands)) { return $this->executeCommand($redisCommand, $params); } else { return parent::__call($name, $params); } } /**
public function checkEnv($mobile, $ajax = true){ $redis = Yii::$app->redis; $ip = Yii::$app->request->getUserIP(); $ipTryTimes = $redis->get($ip."_faillogintimes");//单一ip尝试登录次数 if($ipTryTimes && $ipTryTimes>=3 && !$ajax){ return false; }
/** * 初始化验证码 */ public function initYZM(){ $showYZM = 'N'; if($this->checkEnv('', false) === false) {//显示极限验证码 $showYZM = 'Y'; Yii::$app->session['needyzm'] = '1'; } else { Yii::$app->session['needyzm'] = '0'; }
self::visitLog(\Yii::$app->controller->action, 'visit'); self::checkInitLogin(); return $this->render('login', [ 'lasturl' => Yii::$app->session['lasturl'], 'showYZM' => $this->initYZM() ]); } /** * 登录提交 */
$args = $this->controller->bindActionParams($this, $params); Yii::trace('Running action: ' . get_class($this->controller) . '::' . $this->actionMethod . '()', __METHOD__); if (Yii::$app->requestedParams === null) { Yii::$app->requestedParams = $args; } return call_user_func_array([$this->controller, $this->actionMethod], $args); } }
} $result = null; if ($runAction && $this->beforeAction($action)) { // run the action $result = $action->runWithParams($params); $result = $this->afterAction($action, $result); // call afterAction on modules foreach ($modules as $module) { /* @var $module Module */
$parts = $this->createController($route); if (is_array($parts)) { /* @var $controller Controller */ list($controller, $actionID) = $parts; $oldController = Yii::$app->controller; Yii::$app->controller = $controller; $result = $controller->runAction($actionID, $params); if ($oldController !== null) { Yii::$app->controller = $oldController; } return $result; }
$params = $this->catchAll; unset($params[0]); } try { Yii::trace("Route requested: '$route'", __METHOD__); $this->requestedRoute = $route; $result = $this->runAction($route, $params); if ($result instanceof Response) { return $result; } else { $response = $this->getResponse(); if ($result !== null) { $response->data = $result;
try { $this->state = self::STATE_BEFORE_REQUEST; $this->trigger(self::EVENT_BEFORE_REQUEST); $this->state = self::STATE_HANDLING_REQUEST; $response = $this->handleRequest($this->getRequest()); $this->state = self::STATE_AFTER_REQUEST; $this->trigger(self::EVENT_AFTER_REQUEST); $this->state = self::STATE_SENDING_RESPONSE; $response->send();
require(__DIR__ . '/../config/main.php'), require(__DIR__ . '/../config/main-local.php') ); $application = new yii\web\Application($config); $application->run();
$_GET = [ 's' => 'user/fastlogin', 'lasturl' => 'http://kx.ircrush.top/Apps/myepson/index.aspx', ]; $_SESSION = [ '__flash' => [], 'lasturl' => 'http://kx.ircrush.top/Apps/myepson/index.aspx', ];