Jump to content

php redirection


mark1million

Recommended Posts

  • Moderators

HI is there a way to redirect to the requested page if members are not logged in?

For example, someone tries to reach a page that requires them to be logged in so they are firstly directed to the login page then after successfully logging in they are taken to their initial requested page.

Link to comment
Share on other sites

I Don't know if it would work but maybe an if statement:



<?php 
 /* 
 Quick example of how to see if they're logged in or not
 Only show this login form if they're logged in */
 if(Auth::LoggedIn() == false)
 { ?>

<a href="http://www.domain.com/index.php/login">
Please Login To View This Page!

<?php
{$this->show('login_form.tpl'); }
?>

</a>


Was just a thought but probably won't work lol

Link to comment
Share on other sites

  • Administrators

To redirect back to the index page you can use;

header('Location: '.url('/'));

You can redirect to a certain page by adding the module in the url command. For example if you want to redirect to the pilots list;

header('Location: '.url('/pilots'));

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...