Jump to content


Photo

Redirection after login


  • Please log in to reply
5 replies to this topic

#1 mcmuney

mcmuney
  • Members
  • PipPipPip
  • Advanced Member
  • 358 posts

Posted 05 September 2006 - 04:42 AM

I have my pages setup so that when session="" it takes the visitor to a login page. After login, it takes the user to their account page. The problem is that when users attempt to see a certain page and they are not signed on, it will let them login, but then it takes them to their account page, rather then to the page they were trying to view. Is there an easy way to achieve this where if they login directly, it goes to their account page, but if they are directed to the login page because signon is required for that page they were trying to view, it takes them to that page after login??? THanks

#2 mitzleah

mitzleah
  • Members
  • PipPipPip
  • Advanced Member
  • 31 posts
  • LocationManila, Philippines

Posted 05 September 2006 - 05:14 AM

Hey,

Use

Location($_SERVER['HTTP_REFERER']);

Also use condition when it will be directed to account page. Hope this one will help! :)

#3 HuggieBear

HuggieBear
  • Members
  • PipPipPip
  • Advanced Member
  • 1,899 posts
  • LocationEngland, UK

Posted 05 September 2006 - 12:45 PM

mcmuney,

Did this help you at all?

Regards
Rich
Advice to MySQL users: Get phpMyAdmin and test your queries work there first, take half the hassle out of diagnosis, also check the reserved words list.

Links: PHP Docs :: RegEx's :: MySQL :: DevGuru :: w3schools

#4 mcmuney

mcmuney
  • Members
  • PipPipPip
  • Advanced Member
  • 358 posts

Posted 05 September 2006 - 09:59 PM

Not really, I think I need more clarification.

#5 drkstr

drkstr
  • Members
  • PipPipPip
  • Advanced Member
  • 66 posts
  • LocationSeattle, WA - USA

Posted 06 September 2006 - 01:29 AM

Not really, I think I need more clarification.

$_SERVER['HTTP_REFERER'] contains the page (string) the person was directed from. You should check that this page is part of your site and direct to it, otherwise, direct to the default page.

...drkstr

#6 Moon-Man.net

Moon-Man.net
  • Members
  • PipPipPip
  • Advanced Member
  • 84 posts

Posted 06 September 2006 - 03:26 AM

I have created a login system that uses 3 files.
Login.html : The form with login details
validate.php : The file that sets the session to logged or not logged
secure.php : the file that denys or allows users access, if its denied, then include(login.html) then exit. Then the if they do login, just refresh the page

If you read the files, you will have a better idea!
Hope that helps!
Cheers

[attachment deleted by admin]




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users