Using CMSBuilding Login

25 posts by 9 authors in: Forums > CMS Builder
Last Post: October 8, 2009   (RSS)

By andycal - August 20, 2009

Anyone know what session variables should I be checking for if I want to protect other pages of my site? Or maybe I should be including a file and using a function?

Any help appreciated!

Re: [andycal] Using CMSBuilding Login

By gkornbluth - August 20, 2009 - edited: August 20, 2009

If you mean allowing certain CMSB users to edit only certain pages and not others, you can restrict access down to the author of a page in specific sections when you set up their user account.

In the section access pulldown menu you can specify specific sections and restrict access that way.

If that's not what you're asking, let us know,

Best,

Jerry Kornbluth
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [gkornbluth] Using CMSBuilding Login

By andycal - August 20, 2009

Not quite.

What I'm after is a way of knowing who my CMSB users are on none CMSB pages. For example, I have some pages on my site that are visible to all, but I want my CSMB admins to be able to view certain sections that are hidden from the general public.

Re: [andycal] Using CMSBuilding Login

There are 2 approaches that come to mind.

1) Don't provide any public links to the versions of those pages with the private data.

2) Password protect the folder with those pages if you need the added security.

You can use a free password management program like Account Manager Lite by Site Interactive or just use .htaccess files.

Does that help at all?

Best,

Jerry Kornbluth
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [gkornbluth] Using CMSBuilding Login

By InHouse - August 20, 2009

In the past I've set session vars once a registered user has logged into a site. Then on each page I sniff for those vars and if that user has values in their account info (CMSB Table) that matches the permitted users for that page, then they can go on and read the page. Otherwise, they are bounced, or some content is displayed conditionally.

Basically this is the same method that Dreamweaver users by default in these cases.
J.

Re: [InHouse] Using CMSBuilding Login

sounds like an interesting approach, could you expand a bit on the process and code?

Jerry Kornbluth
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [InHouse] Using CMSBuilding Login

By andycal - August 20, 2009

Hang on guys, before we get carried away, I'm sure there's an easier way. When I log in to the CMS admin, a session variable is surely set. If I know what this is, I can protect other pages. Or does it use some other method to know who's logged in?

Re: [andycal] Using CMSBuilding Login

By InHouse - August 20, 2009

No idea andycal, but that's a great question.

Back when I did this, and perhaps even now, I wasn't able to add extra fields to the user table on CMSB. Neccessity begat invention.

J.

Re: [andycal] Using CMSBuilding Login

By Dave - August 20, 2009

Hi andycal,

This isn't something that's supported by the software, but I'll try and point you in the right direction. We switched from cookies to sessions in a recent version, so upgrade if you haven't already.

Next, add this line in red before you load the viewer functions:

if (!defined('START_SESSION')) { define('START_SESSION', true); }
require_once "../lib/viewer_functions.php";


That tells it to start a session. Next, you can display an error message for users who are not logged in like this:

<?php if (!@$_SESSION['username']) { die("You must login first!"); } ?>

And you can see all the session variables available like this:

<xmp><?php print_r( $_SESSION ) ?></xmp>

Note that the program internals might change over time. Probably not for a long while, but be sure to test your custom code after future upgrades.

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com