LuxCal Forum

The place for questions, suggestions and news about the LuxCal Event Calendar

User:   Password:   Remember Me?   
LuxCal Forum / LuxCal / Comments and Suggestions / User Integration
Posted:  28 May 2013 03:20
Is there a way to integrate this into an existing user database for other scripts, such as 4images ( )?
Posted:  28 May 2013 09:16
Hi warrior,

If you wait until the end of the week (31 May) and download the latest LuxCal version 3.1.0, then there should be no problem. This new version has no problem sharing its database with other applications.
As long as you know your database credentials ( host, username, password and db name).
Posted:  28 May 2013 20:21
Awesome. Thank you.
Posted:  03 Jun 2013 07:08
Having a problem with the user integration.

The site I have a script on (4images) has this in it's sessions.php file, which is called by all other pages:



and farther down is a line with this:


    } else {
      if (isset($_SESSION)) {
        if (!isset($_SESSION[$this->session_key])) {
          $_SESSION[$this->session_key] = array();

        $this->session_info = &$_SESSION[$this->session_key];

In the instructions for the calendar, you have:


f. Single Sign On (SSO)

When the calendar is embedded in a PHP-based website where users have to log in, users logged in on the parent website can be logged in to the calendar automatically in a secure way, using PHP sessions.

To achieve this the parent website scripts should:

    start PHP sessions, if not done already, by adding the following PHP statement to the parent website PHP script:


PHP sessions must be started before anything is sent out to the browser (like header information), so this statement must be added somewhere at the start of the script.
    save the user name or the user email address in the session variable 'lcUser' by adding the following statement to the parent website PHP script at any point before the iframe statement with the calendar URL:

$_SESSION['lcUser'] = '<user email>';

The part <user email> is a string with the user email address which corresponds to the email address required to log the user in to the calendar (specified by the admin when the calendar user account was created).

Because PHP session data are stored on the server, the user name / email address are not visible to the users.

I cannot figure out where to put that code of yours, and it's confusing because the other script has similar coding to that.
Posted:  03 Jun 2013 12:13   Last Edited By: Roel B.
Hi there,

The code session_start(); must always be at a point before anything else is sent to the browser (PHP requirement). Apparently your site is already using PHP sessions and consequently starts PHP sessions already at the right place.
So the only thing else to do, to get SSO working, is to load the user's email address in the PHP variable $_SESSION['lcUser'] before the calendar is started.
I don't know how you are using the calendar, but if the calendar is embedded in one of your web pages in an iframe, then for instance just before the iframe statement you should put:

$_SESSION['lcUser'] = '';

Posted:  03 Jun 2013 18:35   Last Edited By: Warrior
The site uses templates, which allow the iframe code, but not PHP code within the templates...

I am "calling" that template from the index.php file, so I'll play around with it there.

There were a couple of other adjustments I made too, like the event list. The code you have I had to create a separate page (instead of adding it to the existing page) and then do an iframe for it as well.

I do love this script though! Best one I have seen so far.

EDIT- Got it! Whoo hoo!

This is where I am testing it, btw:

Oh, and one other, off topic curious thing LOL That email address you sampled, you by chance use that User Name over at Online Onslaught?
Posted:  03 Jun 2013 21:07   Last Edited By: Roel B.
Great! I like LuxCal users getting real excited!
However, I think there still a bit of work to do. When I look at your full calendar, I see that I'm logged in as Darrell and I can add events as "Darrell". Guess that's not how it should be :(
For one or another reason you are storing your email address in the PHP variable $_SESSION['lcUser'], while you should ask me to log in and then store my email address in the PHP variable.

O.T.: Yeah, and I lov' "life" examples (Frank Lloyd Wright).
Posted:  03 Jun 2013 21:25
...hmmm is it not my address that should be there, where you have that example? I use the same email address for both my main and the calendar.

What address should be there, if any?
Posted:  03 Jun 2013 22:58   Last Edited By: Roel B.
I tried again and this time I was not automatically logged in as Darrell and all looks okay. So maybe the previous time I just started the calendar at a moment of "transition" and therefore something went wrong.
So I don't have the example anymore (I added an event about horse riding as Darrell, changed the owner to Public User and then my event was deleted shortly after I entered it). If it wasn't you who deleted my event, you can go to the admin's Database page and undelete all events to have a look at the event I entered.

I suggest to carefully test your set up and maybe there is no problem (any more).
Posted:  03 Jun 2013 23:07   Last Edited By: Warrior
No. I took my email address out just after I read your earlier post. So that is still an issue.

Found another issue too- the 4images scripting/database uses a table called settings. Your calendar uses a table named settings.

Your tools script is coded "SHOW TABLES LIKE", which is causing errors when using the tools because it's seeing the 4images settings table.

On my copy I downloaded, that can be fixed by changed ALL instances of 'settings' (meaning all 'settings' that refer to the database, not things like getSettings and so on) in your script to lssettings or calsettings or whatever, so it doesn't conflict.

I plan on bragging about and letting people over at 4images know about your calendar, as many have been seeking a GOOD event calendar to integrate into their websites. But that conflict of 'settings' may be an issue...