WiltshireAirlines Posted June 8, 2014 Report Posted June 8, 2014 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. Quote
Moderators servetas Posted June 8, 2014 Moderators Report Posted June 8, 2014 <?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 ?> Quote
WiltshireAirlines Posted June 8, 2014 Author Report Posted June 8, 2014 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. Quote
Moderators servetas Posted June 8, 2014 Moderators Report Posted June 8, 2014 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. Quote
WiltshireAirlines Posted June 8, 2014 Author Report Posted June 8, 2014 Thanks...it half worked. I'm logging in now, it's redirecting me to the page, but on that page it says that I'm not logged in...I know it's the correct information though... Quote
Moderators servetas Posted June 8, 2014 Moderators Report Posted June 8, 2014 I think that introbb is correct. Also, i my website, i have to place index.php on my url in order to be logged in on the website. Quote
WiltshireAirlines Posted June 8, 2014 Author Report Posted June 8, 2014 www. is in the URL. So, does that mean I can't directly go to the page? Quote
WiltshireAirlines Posted June 8, 2014 Author Report Posted June 8, 2014 Just noticed something really weird. When I visit the page through the URL, I stayed signed in...but when I link to the page through the site, it says I'm not signed in, although I actually am. By the way, this page is not in modules - it's a separate page in the home directory. Quote
freshJet Posted June 9, 2014 Report Posted June 9, 2014 I mean like this: $redir = "http://www.mysite.com/"; header("Location:$redir"); Instead of: $redir = "http://mysite.com/"; header("Location:$redir"); Quote
WiltshireAirlines Posted June 9, 2014 Author Report Posted June 9, 2014 I know. I have that. It's weird though. Why would I get signed out when I go through a link but stay signed in when I go through the URL directly? Quote
WiltshireAirlines Posted June 9, 2014 Author Report Posted June 9, 2014 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? Quote
WiltshireAirlines Posted June 9, 2014 Author Report Posted June 9, 2014 I think it's some problem when I visit the new page. It's obviously something to do where it's located. Must I require maybe a reference to another config file of phpvms? Quote
WiltshireAirlines Posted June 10, 2014 Author Report Posted June 10, 2014 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. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.