Ejemplo n.º 1
0
 public function update()
 {
     $inTransaction = Database::inTransaction();
     if (!$inTransaction) {
         Database::beginTransaction();
     }
     $statement = Database::prepare("UPDATE user_power SET `uid`=:uid WHERE id=:id");
     $statement->bindValue(':uid', $this->uid, \PDO::PARAM_INT);
     $statement->bindValue(':id', $this->id, \PDO::PARAM_INT);
     $statement->execute();
     $this->uid = Database::lastInsertId();
     $statement->execute();
     if (!$inTransaction) {
         Database::commit();
     }
 }
Ejemplo n.º 2
0
 /**
  * Insert current user into database
  * @return int Auto-generated UserID for this user
  */
 public function insertToDB()
 {
     $inTransaction = Database::inTransaction();
     if (!$inTransaction) {
         Database::beginTransaction();
     }
     $statement = Database::prepare("INSERT INTO member SET email=:email, `password`=:pwd, nickname=:nickname");
     $statement->bindValue(':email', $this->email, \PDO::PARAM_STR);
     $statement->bindValue(':pwd', $this->password, \PDO::PARAM_STR);
     $statement->bindValue(':nickname', $this->nickname, \PDO::PARAM_STR);
     $statement->execute();
     $this->id = Database::lastInsertId();
     if (!$inTransaction) {
         Database::commit();
     }
     return $this->id;
 }
Ejemplo n.º 3
0
 /**
  * Insert current user into database
  * @return int Auto-generated UserID for this user
  */
 public function insertToDB()
 {
     $inTransaction = Database::inTransaction();
     if (!$inTransaction) {
         Database::beginTransaction();
     }
     $statement = Database::prepare("INSERT INTO member SET email=:email, `password`=:pwd, sspwd=:sspwd, `port`=:port, nickname=:nickname,\n            `flow_up`=:flow_up, `flow_down`=:flow_down, transfer=:transfer, plan=:plan, `enable`=:enable, invite=:invite, regDateLine=:regDateLine");
     $statement->bindValue(':email', $this->email, \PDO::PARAM_STR);
     $statement->bindValue(':pwd', $this->password, \PDO::PARAM_STR);
     $statement->bindValue(':sspwd', $this->sspwd, \PDO::PARAM_STR);
     $statement->bindValue(':port', $this->port, \PDO::PARAM_INT);
     $statement->bindValue(':nickname', $this->nickname, \PDO::PARAM_STR);
     $statement->bindValue(':flow_up', $this->flow_up, \PDO::PARAM_INT);
     $statement->bindValue(':flow_down', $this->flow_down, \PDO::PARAM_INT);
     $statement->bindValue(':transfer', $this->transfer, \PDO::PARAM_INT);
     $statement->bindValue(':plan', $this->plan, \PDO::PARAM_STR);
     $statement->bindValue(':enable', $this->enable, \PDO::PARAM_INT);
     $statement->bindValue(':invite', $this->invite, \PDO::PARAM_INT);
     $statement->bindValue(':regDateLine', $this->regDateLine, \PDO::PARAM_INT);
     $statement->execute();
     $this->uid = Database::lastInsertId();
     if (!$inTransaction) {
         Database::commit();
     }
     return $this->uid;
 }
Ejemplo n.º 4
0
 /**
  * 增加 Node
  * @param node Id
  */
 public function insertToDB()
 {
     $statement = null;
     $inTransaction = Database::inTransaction();
     if (!$inTransaction) {
         Database::beginTransaction();
     }
     $statement = Database::prepare("INSERT INTO node SET `name`=:name, `type`=:type,\n\t\t\t`server`=:server, `method`=:method, `info`=:info, `status`:=status, `order`=:order");
     $statement->bindValue(':name', $this->name, \PDO::PARAM_STR);
     $statement->bindValue(':type', $this->type, \PDO::PARAM_INT);
     $statement->bindValue(':server', $this->server, \PDO::PARAM_STR);
     $statement->bindValue(':method', $this->method, \PDO::PARAM_STR);
     $statement->bindValue(':info', $this->info, \PDO::PARAM_STR);
     $statement->bindValue(':status', $this->status, \PDO::PARAM_STR);
     $statement->bindValue(':order', $this->order, \PDO::PARAM_INT);
     $statement->execute();
     $this->id = Database::lastInsertId();
     if (!$inTransaction) {
         Database::commit();
     }
     return $this->id;
 }
Ejemplo n.º 5
0
 /**
  * Add message
  * @return string
  */
 public function insertToDB()
 {
     $statement = null;
     $inTransaction = Database::inTransaction();
     if (!$inTransaction) {
         Database::beginTransaction();
     }
     $statement = Database::prepare("INSERT INTO message SET `content`=:content, `pushTime`=:pushTime,\n\t\t\t`addTime`=:addTime, `pushUsers`=:pushUsers, `type`=:type, `pushEndTime`=:pushEndTime, `order`=:order");
     $statement->bindValue(':content', $this->content, \PDO::PARAM_STR);
     $statement->bindValue(':pushTime', $this->pushTime, \PDO::PARAM_INT);
     $statement->bindValue(':addTime', $this->addTime, \PDO::PARAM_INT);
     $statement->bindValue(':pushUsers', $this->pushUsers, \PDO::PARAM_STR);
     $statement->bindValue(':type', $this->type, \PDO::PARAM_INT);
     $statement->bindValue(':pushEndTime', $this->pushEndTime, \PDO::PARAM_INT);
     $statement->bindValue(':order', $this->order, \PDO::PARAM_INT);
     $statement->execute();
     $this->id = Database::lastInsertId();
     if (!$inTransaction) {
         Database::commit();
     }
     return $this->id;
 }