From 766f034ac4187deedbc978502cd5ec6d60f835f2 Mon Sep 17 00:00:00 2001 From: Olusesan Ameye Date: Sat, 7 May 2022 12:10:54 -0400 Subject: [PATCH] fix --- www/application/controllers/Login.php | 5 ++- www/application/models/Autopref_model.php | 51 +++++++++++++++++++++++ 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 www/application/models/Autopref_model.php diff --git a/www/application/controllers/Login.php b/www/application/controllers/Login.php index a4f035d7..149c1595 100644 --- a/www/application/controllers/Login.php +++ b/www/application/controllers/Login.php @@ -85,7 +85,10 @@ class Login extends WRB_Controller { $this->refreshAccountDetail($_SESSION['member_id']); $this->getSessionArray(); $this->excudedEmails(); - redirect('dash'); + $this->load->model('autopref_model'); + + $prefArray = $this->autopref_model->afterLoginPage(); + redirect($prefArray['returnPage']); } } else { $data["login_message"] = "Invalid username or password"; diff --git a/www/application/models/Autopref_model.php b/www/application/models/Autopref_model.php new file mode 100644 index 00000000..e60c8078 --- /dev/null +++ b/www/application/models/Autopref_model.php @@ -0,0 +1,51 @@ + 0){ + + $accountAgeNumber = $this->accountAge( $_SESSION['member_id'] ); + $retArr['returnPage'] ='dash'; + if ($accountAgeNumber < 60 ){ + $retArr['returnPage'] ='dash/help'; + } + + + + + + + + + } + return $retArr; + } + + private function accountAge($member_id){ + + $accAge = 10000000; + + $ageQ = "SELECT ((DATE_PART('day', now()::timestamp - added::timestamp) * 24 + + DATE_PART('hour', now()::timestamp - added::timestamp)) * 60 + + DATE_PART('minute', now()::timestamp - added::timestamp)) * 60 + + DATE_PART('second', now()::timestamp - added::timestamp) AS accAge FROM members WHERE id =".$member_id; + + $query = $this->db->query($ageQ); + $row = $query->row(); + + if (isset($row)) + { + $accAge = $row->accAge; + } + + return $accAge; + + } + +} \ No newline at end of file