News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Integrating SMF to my existing PHP site

Started by laural4705, January 09, 2013, 12:11:12 PM

Previous topic - Next topic

laural4705

I originally thought that I was having trouble combining the sessions from my existing site with the SSI.php file.  Now I have discovered, by trying to run the ssi_examples.php file that there is an error within the SSI.php file.  Has anyone else had this error or know what is causing it?

Unknown column 'M' in 'where clause'

Thanks,
Laura

OK, upon further testing, I found that if I commented out this line in the SSI.php file, then my error went away.  I am pretty sure that I don't want to leave this commented out... 

// Load the current user's permissions....
loadPermissions();

Hopefully this will help someone to diagnose the problem.  Thank you again :)

kat

As this is about integrating, as it were, I've taken the liberty of moving this to the... er... "Portals, Bridges, and Integrations" board. ;)

I hope someone can help you out! :)

IchBin™

Post the full error laural. The unknown column error should show a filename and line number. Maybe attach the file that the error is complaining about too.
IchBin™        TinyPortal

laural4705

Yes, that is the strange part, there is no other info to go on, the page source shows this:

<html><head></head><body>Unknown column 'M' in 'where clause'</body></html>

As I continue to try and integrate SMF I have noticed that I can print the sessions and I see the sessions from my own site and the forum site, but if I am in my site I can only see the cookies from my site, and if I navigate to a forum page I can only see the forum cookies.  Don't know if this is related, but I suspect it is...


IchBin™

There should be a full error in your SMF log.
IchBin™        TinyPortal

Kindred

Also, posting the code that you are attempting to use for integration would be useful.

and do note...  cookies are domain specific. You can not (easily) use cross-domain cookies.

You can turn on sub-domain independent cookies in SMF, which means that if you have the forum installed at forum.mysite.com, the cookie will be set for all of "mysite.com" instead of just "forum.mysite.com"
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

laural4705

OK, after working on this *forever* I have figured out this much.  My login page (for my own php website) sets a bunch of sessions.  Once I have gained access to my site, I have the require(SSI.php) file code above my html.  I have also included a session_start line in the SSI file to grab my existing sessions.

Here is the strange part - if I am logged in to the forum with a username and password, then I can access my php website with all of my SSI integrations with no problem.  *BUT* if I am not logged in to the forum, I get an error that says Unknown column 'M' in 'where clause' (which I know has to do when trying to load User Permissions). 

So, I think I am not handling my sessions well.  My php website is in the root of my web folder, then my SMF board is in a forum directory.  When a user logs into my php site via username/pw, there are a large number of sessions set.  How do I integrate the sessions/cookies from my site with the sessions from the SMF site?

Arantor

How about just reusing SMF's own cookies and sessions in the first place? That would be cleaner, faster and consume less bandwidth...
Holder of controversial views, all of which my own.


laural4705

I don't mean to sound dense, but I don't know how/where to reuse SMF sessions/cookies?  I will do some searching to see if I can figure this out, but if you could give me a little more info I would be really grateful!

Arantor

As far as authentication goes, just load SSI.php and check the state of $context['user'] after. That will handle everything regarding sessions, too.

Handling registration is a bit more difficult, not sure how registration currently works but you can entrust all registration to SMF in a couple of ways.
Holder of controversial views, all of which my own.


laural4705

OK, final post on this very confusing matter - it is finally fixed!  I had to add my require statement for my site sessions under the SSI.php require.  Then, I found the source of the strange 'Unknown column 'M' in 'where clause' message.  I was querying an mssql database for a number of terms that I was setting as array of sessions.  For some reason SQL balked at the use of 'mc' as a term.  I changed it to mvc and the problem resolved.  Not sure why, but it is fixed. YEA!

Advertisement: