Zubrag.com
May 22, 2012, 07:51:16 am *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Redirect code works 1st time then not subsequent times???  (Read 1284 times)
bl0nd1e
Newbie
*
Posts: 4


« on: April 15, 2010, 06:27:17 pm »

Hi,
(Dreamweaver CS4, Firefox on PC)
website is www.crookseys.co.uk
I set up website with homepage of index.html.
Visitors click 'enter site' & go to home.php
I've added password_protect.php to home.php & modified to redirect visitors depending on username:
i.e.
Code:
$LOGIN_INFORMATION = array(
  'lunch' => 'monkey',
  'bbq' => 'chimp'
);

// attempt to redirect user logins
$REDIRECTS = array (
'lunch' => 'monkey.php',
'bbq' => 'chimp.php'
);

Then just before ?> I've added :
Code:
header('Location: '.$REDIRECTS[$login]);
PROBLEM IS:
Code works well first time& redirects correctly. But, if I retype web address in address bar to get back to index.html, then click 'enter site' again, the index.html just reloads instead of going to home.php
N.B. didn't have this problem before modifying the code to redirect.
Would love help a.s.a.p
Thanks for this code so far - love it Smiley

Logged
zubrag
Administrator
Hero Member
*****
Posts: 753


WWW
« Reply #1 on: April 16, 2010, 03:19:44 am »

After
$found = true;

add this
$login = $key;
Logged
bl0nd1e
Newbie
*
Posts: 4


« Reply #2 on: April 16, 2010, 03:37:48 am »

Legend!
Works like a dream  Grin

Thank you - saved me a massive headache!
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC