Beispiel #1
0
 /**
  * Logs the user out and unsets cookie and database auth_token
  *
  * @since 1.0.0
  * @return bool True if called
  * 
  */
 public function logout()
 {
     $uname = $this->_auth->getUserField('login');
     $update = array("auth_token" => 'NULL');
     $bind = array(":login" => $uname);
     DB::inst()->update("user", $update, "login = :login", $bind);
     $this->_auth->_setcookie("TP_COOKNAME", '', time() - COOKIE_EXPIRE);
     $this->_auth->_setcookie("TP_COOKID", '', time() - COOKIE_EXPIRE);
     $this->_auth->_setcookie("TP_REMEMBER", '', time() - COOKIE_EXPIRE);
     redirect(BASE_URL);
 }
Beispiel #2
0
 public function __destruct()
 {
     DB::inst()->close();
 }
function tp_set_password($password, $user_id)
{
    $update = ["password" => tp_hash_password($password)];
    $bind = [":id" => $user_id];
    $q = DB::inst()->update('user', $update, 'userID=:id', $bind);
}
Beispiel #4
0
 public static function delete_option($name)
 {
     $results = DB::inst()->query("SELECT option_id FROM `option` WHERE `option_name` = '{$name}'");
     if (is_null($results) || !$results->fetch(\PDO::FETCH_BOTH)) {
         return false;
     }
     self::do_action('delete_option', $option_name);
     DB::inst()->query("DELETE FROM `option` WHERE `option_name` = '{$name}'");
     return true;
 }
Beispiel #5
0
 public function getUsername($id)
 {
     $strSQL = DB::inst()->select('user', 'userID = "' . floatval($id) . '"', null, 'login LIMIT 1');
     $row = $strSQL->fetch();
     return $row[0];
 }
Beispiel #6
0
 /**
  * Retrieve requested field from user table 
  * based on user's id.
  *
  * @since 3.0.2
  * @return mixed
  * 
  */
 public function getUserValue($id, $field)
 {
     $bind = [":id" => $id];
     $q = DB::inst()->select("user", "userID = :id", "", $field, $bind);
     foreach ($q as $r) {
         return $r[$field];
     }
 }