Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy. This forum is not for asking programming related questions.
to all my webpages to redirect all users to the login page.
But then I realised I could not navigate the pages because each time I opened a page I was redirected to the login page without checking if I am logged in or not, and when I logged in, it took me to the very first page and not the one I requested.
I will highly appreciate any help on how handle this. I am dummy and finding really had to figure this out.
Thanks papa for that fast reply. You answer post answer exactly my problem. Its just what I want, but i can't get it right.
here is my login script, and I don't find anywhere the session variables are defined. I am trying to customize the app. and I can't really figure things out given my limitted php knowledge.
---
function run()
{
$credentials = array();
// Get the user supplied credentials
$credentials[LOGIN_ID_FIELD] = getUserField('loginid');
$credentials['password'] = getUserField('password');
$referer = getUserField('referer');
if($referer == 'home_client_login' ||
$referer == 'home_client_post_jobs' ||
$referer == 'home_client_search_resume')
{
// Create a new Client object with the credentials
$thisUser = new Client($credentials);
}
else if($referer == 'home_candidate_login')
{
$thisUser = new Candidate($credentials);
}
else
{
// Create a new user object with the credentials
$thisUser = new User($credentials);
}
// Authenticate the user
$ok = $thisUser->authenticate();
// If successful (i.e. user supplied valid credentials)
// show user home
if ($ok)
{
$thisUser->goHome();
}
// User supplied invalid credentials so show login form
// again
else
{
If I understand, the script you have written should replace my previous redirect script on my webpages, but how and where should I define the $_SESSION['user_name']?