Jump to content


Photo

Continue to page after login help


  • Please log in to reply
4 replies to this topic

#1 brob

brob
  • Members
  • PipPipPip
  • Advanced Member
  • 37 posts

Posted 03 October 2006 - 10:53 AM

Hi I want users to be able to click a link to a page that is restricted and once they login they are still taken to that page without having to navigate to it.

Any ideas?

Thanks

#2 thedarkwinter

thedarkwinter
  • Members
  • PipPipPip
  • Advanced Member
  • 191 posts
  • LocationLondon

Posted 03 October 2006 - 11:02 AM

session variables...

$_SESSION["requested"] = "restricted.php";

once logged in

header ("location: " . $SESSION["requested"]);

cheers,
tdw
Remember - if you don't figure it out yourself, you'll probably forget it tomorrow :)

#3 thedarkwinter

thedarkwinter
  • Members
  • PipPipPip
  • Advanced Member
  • 191 posts
  • LocationLondon

Posted 03 October 2006 - 11:12 AM

Are you using sessions?

I'm assuming if you are logging in users you have some sort of session running?

session_start();
Remember - if you don't figure it out yourself, you'll probably forget it tomorrow :)

#4 JasonLewis

JasonLewis
  • Members
  • PipPipPip
  • Advanced Member
  • 3,351 posts
  • LocationVictoria, Australia

Posted 03 October 2006 - 11:50 AM

You could make a hidden input box that stores the last page.
say this is your login page:
<input type="submit" value="{$_SERVER['HTTP_REFERER']}" name="refer">

then on your check page, after they login re-direct them.
header("Location: ".$_POST['refer']);

but the suggestions above are as good if not better then the above. but its your choice.
Good luck with your coding.
Jason / ProjectFear / Jaysonic

#5 saiko

saiko
  • Members
  • PipPipPip
  • Advanced Member
  • 37 posts

Posted 03 October 2006 - 12:26 PM

well i see wat ur sayin as...

xxx access's restricted.php .. then u have a login form on restricted.php if the session is not set .. but if it is set then it displays the content ?

or

xxx access's restricted.php .. then it redirects to a login page if the session is not set .. but if it is set then it displays the content ?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users