id = $res['id']; $this->username = $res['uname']; $this->email = $res['email']; $this->stoken = $res['stoken']; } } } function getUsername() { return $this->username; } function getEmail() { return $this->email; } function setEmail($ne) { $this->email = $ne; } function getId() { return $this->id; } function setPassword($np) { $this->password = $np; } function getPassword() { return $this->password; } function getToken() { return $this->stoken; } function setToken($nt) { $this->stoken = $nt; } function save() { $q = "update users set email='".$this->getEmail()."' "; $q .= " , stoken='".$this->getToken()."' "; if ( $this->getPassword() ) $q .= " , pwd='".$this->getPassword()."' "; $q .= " where id=".$this->getId(); query($q); // TODO: check stuff here } } if ( isset($_SESSION['userid']) ) $curUser = new User($_SESSION['userid']); ?>