, Guest!
Already a Member? Login or Register.

Menu



Showcase


Due to the volume of spam happening on our forums, posting is now restricted to verified members only.  If you're not verified, drop us a note with your username.

Home > FlexCMS Support Forum > User Help > General Support Requests > Accessing pages without being logged in

FlexCMS Support Forum


Accessing pages without being logged in
Started July 3, 2008 @ 4:49pm by Wolf
Post Message 
Wolf




Posts: 65
 
Accessing pages without being logged inJuly 3, 2008 @ 4:49pm
I have a question about accessing INSTALLED MODULE pages when a user is not actually logged in.

This is what's going on...

I had initially setup a site with two menu structures. One for guests (non logged in user) which had links to Home, Calendar and Contact Us pages. Another for logged in members with all the usual module access links.

I noticed a lot of web crawler activity churning through calendar pages for the guest (non logged in user) pages. So, I decided to remove that link from the guest menu.

A couple days later I still notice crawler activity going through calendar pages as guest.

So, I make sure I'm logged out of the site, then manually typed the URL of different installed modules and I'm granted access to those pages without being logged in!

So I checked the following module pages without being logged in at all and these are my results:

http://www.mysite.com/index.php/calendar.html -
allows access to calendar pages, events display according to access level

http://www.mysite.com/index.php/forum.html -
shows blank forum page

http://www.mysite.com/index.php/links.html -
allows complete access to all links

http://www.mysite.com/index.php/articles.html -
allows complete access to articles

http://www.mysite.com/index.php/photos.html -
shows message "No galleries currently exist, or none that your permissions allow you to access."

http://www.mysite.com/index.php/store.html -
allows access to store pages up through the step 1 of 4 of the checkout pages

http://www.mysite.com/index.php/newsletter/messages/current.html -
shows current newsletter page

http://www.mysite.com/index.php/newsletter/messages.html -
shows archived newsletter message page


I'm using this as a subscription only membership site and want to disallow access to any pages that are above "guest level 0".

Is this possible without adding code to all of the installed module pages?

Thank you.
Wolf

 
DCSun
Administrator



Posts: 625
 
July 3, 2008 @ 7:16pm
Wolf,

Unfortunately you're correct, the notes you've made below are the way the various modules will behave in the current version. We'll definitely work towards making them more compatible with objectives such as yours in the next version.

For right now, you might be able to cheat it a bit and accomplish what you're looking for. Create a new block, set it to guests only, enable PHP, and add this code to it:
Code

if ($Arguments1 == 'calendar' || $Arguments1 == 'forum' || $Arguments1 == 'links' || $Arguments1 == 'articles' || $Arguments1 == 'photos' || $Arguments1 == 'newsletter') {
header('Location: '.$MainURL.'/pages/index.html');
}
. You can modify it to suit, but essentially that will redirect anyone accessing the named areas back to the index page.


David


FlexCMS v3.2 Has Been Released!
 
Wolf




Posts: 65
 
Almost there ... :-)July 3, 2008 @ 8:47pm
Man, I love you guys! Smile That did the trick with one exception and it's curious...

* I created a new menu block
* Added your code (with my mods, shown)
* Set access to GUEST
* Enabled php
* Saved it
* Logged out
* Directly accessed the different module pages

When I logout and try to go to module pages as Guest, I'm gracefully taken back to the home page... with the following exception - I'm still able to access the ARTICLES module pages (however, I do see an error that appears only when accessing ARTICLES as Guest)

This is the code I put into the module (I also added the store, register, and register-submit pages)


Code

if ($Arguments1 == 'articles' || $Arguments1 == 'calendar' || $Arguments1 == 'forum' || $Arguments1 == 'links' || $Arguments1 == 'newsletter' || $Arguments1 == 'photos' || $Arguments1 == 'register' || $Arguments1 == 'register-submit' || $Arguments1 == 'store') {
header('Location: '.$MainURL.'/pages/index.html');
}


When I go to an ARTICLES page, I see an actual article displayed, but I also see the following error message appear in the newly created menu-block:


Code

Warning: Cannot modify header information - headers already sent by (output started at /home/account-name/public_html/inc-na-idx.php:725) in /home/account-name/public_html/index.php(3292) : eval()'d code on line 2


Any suggestions as to how to fix it?

Thanks.
Wolf
 
DCSun
Administrator



Posts: 625
 
July 3, 2008 @ 10:50pm
Wolf,

That was a really weird one! You'll never guess what it was -- I sure wouldn't have!

And the winner is... two blank lines after the closing PHP tag ?> at the very end of the inc-na-idx.php file. Remove everything after the ?> at the bottom and you should be all set.


David


FlexCMS v3.2 Has Been Released!
 
Wolf




Posts: 65
 
Wow!July 3, 2008 @ 11:18pm
David,

I'm so impressed! That did the trick!!! Man-o-man, how in the world did you figure that one out?!

Flex support rocks!

Thanks a bunch,
Wolf
 

Post Message 




Try & Buy FeedForAll - Easy to use RSS Feed Creator - great for iTunes users!

MEMBERS




All Contents, Code, Scripts and Technologies Copyright 2003-2009 FlexCMS.
All Rights Reserved. Software License Agreement

Processing Time: 0.07368 seconds.
 
Management Login

Powered By FlexCMS
Powered By FlexCMS