I am adding more things to my user login script. After the user logins in successfully, instead of going to their my account page by default , I want to check if they are required to perform some action.
Lets say they are required to change their password.
Ex. When they login , its going to go to a function that checks required actions. It will then check if a password change is required and then redirect them to the mandatory password change page.
I have been experimenting with some code, but having some troubles.
Here is the code I wrote:
Process.php
... ... ... ...
if ($returnval) {
[COLOR="#008000"]// LOGIN SUCCESS[/COLOR]
if ($functions->checkRequiredAction()) {
[COLOR="#008000"]// action is required before anything else happens,[/COLOR]
}
else {
[COLOR="#008000"]// User is not required to do anything, go to the default account page[/COLOR]
header("Location: " . $session->referrer);
}
}
$functions = functions.php
Functions.php
function checkRequiredAction() {
[COLOR="#008000"]// Check If A User Password Change Is Required[/COLOR]
if ($this->checkPwChangeReq($_SESSION['username'])) {
header("Location: " . $configs->getConfig('WEB_ROOT') . "pwchange.php");
}
}
I am not sure of how to code it correctly.