public function view()
 {
     $new = new BaseModelEncrypt();
     $x = $new->rsa_public_encode("-----3-----");
     $y = $new->rsa_private_decode($x);
     //echo "\n[ RSA PUB ENCODE ]:".$x."\n";
     echo "\n[ RSA PRI DECODE ]:" . $y . "\n";
     exit;
     $this->setView('hi', 'hello world!!!');
     $this->display('./hi.html');
 }
Beispiel #2
0
 /**
  * set cookie value
  */
 public function setUserCookie($userInfo = array())
 {
     if (empty($userInfo)) {
         $userInfo = array('uid' => $this->uid, 'email' => $this->email);
     }
     $userInfo['ip'] = $this->ip;
     $userInfo['ua'] = substr($this->ua, 0, 10);
     $userInfo['time'] = time();
     $userInfoStr = serialize($userInfo);
     $encryptModel = new BaseModelEncrypt();
     $x = $encryptModel->rsa_public_encode($userInfoStr);
     //set encrypt cookie to user browser
     $isSuccess = setcookie('nbnlp', $x, strtotime('+10 days'), '/');
     if (!$isSuccess) {
         //TODO::Log set cookie failed
         return false;
     }
     return $isSuccess && !empty($x) ? true : false;
 }