I'm trying the set up a user registration system that creates a token that expires after 48 hours (2 days). I attempted to program this but to no avail. When I test the code I get this error
A PHP Error was encountered
Severity: Error
Message: Class 'TimeDate' not found
Filename: models/User_model.php
Line Number: 58
Below is the code
public function isTokenValid($token)
{
$q = $this->db->get_where('tokens', array('token' => $token), 1);
if($this->db->affected_rows() > 0){
$row = $q->row();
$created = $row->created;
$createdTS = strtotime($created);
$expiredate = new TimeDate('Y-m-d');
//$todayTS = strtotime($today);
$expiredate->add(new DateInterval('P2D'));
if($createdTS != $expiredate){
return false;
}
$user_info = $this->getUserInfo($row->user_id);
return $user_info;
}else{
return false;
}
}