Jump to content

Making a page only visible to pilots


Recommended Posts

Question explains it all - I have a page, NOT in templates or in the skin, but rather in the HOME DIRECTORY (where /core and /lib etc is) and I'm not sure how to make it only visible to pilots, so that if you're not logged in and you visit the page, it'll bring you to the login page. Couldn't find anything obvious on the other pages that also were only visible to pilots.

Thanks for all the help in advance.

Link to comment
Share on other sites

  • Moderators
<?php
require('the directory of your codon.config.php file'); // Call the phpVMS config file
if(Auth::LoggedIn()) {
//the data you want to show if he is logged in
}
else {
//the data you want to show if he is not logged in
?>

Link to comment
Share on other sites

Thanks! It worked. One more question...how do I change the page the pilot is redirected to when they login through the form? I tried changing some stuff in Modules/Login/Login.php but to no avail. Thanks...I didn't want to start a new thread because I was afraid it would look too much like spamming.

Link to comment
Share on other sites

  • Moderators

Open your Login.php file and find this:

$this->post->redir = str_replace('index.php/', '', $this->post->redir);
header('Location: '.url('/'.$this->post->redir));

replace it with this:

$redir = "http://google.gr/";
header("Location: $redir");

you can replace http://google.gr/ with the page url you would like to redirect your pilots to.

Link to comment
Share on other sites

OK, I've made some connections here. When I visit the page through a link (when logged in), the PHP says that I am NOT logged in. I then go back to the homepage either through a link or URL (doesn't matter), and it says I'm still not logged in. However, when I do this, and return to the homepage, and try to sign in, it says I'm already logged in. Which means that I have been logged in the whole time, there's just a glitch with the system that says if I'm logged in or not when I visit this new page (located in the home directory). It doesn't have this problem with other pages. This is really weird...I'm going to restore the Modules>Login>Login.php file and tell you what happens from there.

EDIT: Restored the login.php to original to no avail. This is really weird. What could be causing this to "sign me out" without really signing me out?

Link to comment
Share on other sites

Let me recap my problem.

I have created a new page in the home directory. You must be signed in to see this page.

Then, I linked to that new page from /index.php.

Although I was signed in when clicking on the link, the new page said I was not signed in.

I then put in the URL for /index.php, and I got sent to it. It also said I was not logged in.

However, when I put in the login credentials, it said I was already logged in.

Let me add one more detail: when I go from /index.php to the new page in the home directory through not a link but the direct URL (type it in the web browser), it says I am logged in.

What could be causing all these problems? No other page does this. To put it simply, every problem I list up here is caused by this new page. There has to be some coding flaw in this new page. I've already required the codon.config and local.config. What else do I have to do? Please help, this is kind of urgent. I would appreciate any and all insight. Thanks.

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...