I need help making this expiry system work.
public function isMember(){
$this->member = $this->pdo->prepare('SELECT expire FROM users WHERE username=:username');
$this->member->bindParam(':username', $_SESSION['username']);
if(strtotime(date()) < strtotime($this->member->fetch(PDO::FETCH_ASSOC))){
return true;
} else {
return false;
}
}
And then in the main dashboard it's running the following:
if($user->isMember() == false){
header("Location: purchase.php");
}
You prepared a statement, but you did not execute it.
The ->fetch()
would also have returned an array, so would not have worked in that position.
public function isMember(){
$this->member = $this->pdo->prepare('SELECT expire FROM users WHERE username=:username');
$this->member->bindParam(':username', $_SESSION['username']);
$this->member->execute();
$expire = $this->member->fetchColumn();
$this->member->closeCursor();
if(strtotime(date() < strtotime($expire)) {
return true;
} else {
return false;
}
}