Urgent: Show content based on what state the user logs in with

4 posts by 2 authors in: Forums > CMS Builder
Last Post: October 15, 2009   (RSS)

Hi guys,

I've painted myself into a bit of a corner and of course have done it on a tight deadline. [:(]

I have created a members table (cms_members) with fields:

username:
password:
email:
state:

And I have create a content table (cms_ipca_content) with fields:

title:
content:
state:

The state fields in both tables are just static lists of the seven states here in Australia.

I have created a login script which works fine to log the user in using the details from cms_members. My question is this.

If the user has a state of "VIC", I want to make it that only content that has a state of "VIC" is presented for the whole session.

I have attached the pages as mentioned - login_success.php is my viewer page for all content and where I presume I need to tell CMS Builder to watch out for the user's state.

If this turns out to be a custom job, that is fine. The matter is a bit urgent.

Re: [benedict] Urgent: Show content based on what state the user logs in with

By Dave - October 14, 2009

Hi benedict,

Can you re-attached the files? I don't think they made it.
Dave Edis - Senior Developer
interactivetools.com

Re: [benedict] Urgent: Show content based on what state the user logs in with

By Dave - October 15, 2009

You need to load the record of the currently logged in user in checklogin.php. Then you can check for fields associated with that user account to determine what to show in login_success.php.

Also, you want to escape any input before you pass it to mysql as currently it's vulnerable to SQL injection.

I've removed your attachment as it had some server details in it.

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