Integrating Simple Machines Forum in my custom membership site - login not working?

4k Views Asked by At

Hi guys I'm trying to integrate simple machines forum into my custom made membership website.

I'm using the SMF API which is available here at http://download.simplemachines.org/?tools.

The thing is that its working on my localhost testing server - however on my online server where the system is hosted - its not working.

I have set it up so that when the user log into my own custom CMS membership site, he/she is logged in automatically to his/her corresponding account on the forum. However it works on my localhost but online its not working at all.. I log into my site and then browse to the forum to find out I havent been logged in there :( - I think its not creating the cookies or registering the session.. where should I look here. Please do help.

EDIT ================

I think I've traced the problem - for some reason the forum is maintaining a different session than the session started on my website. This is strange as the forum is only in a subfolder on the same site. WHat should I check for here?

2

There are 2 best solutions below

4
On

The site is working locally but not online means most likely that there is some settings difference between the two, certain things might be disabled on the server:

  • Are you using short tags? Are they also enabled on the online server?
  • Are session cookies getting written successfully?
  • Have you put up session_start() on top of your script?
  • Try using session_save_path which gets/sets the current session save path
  • What are the server requirements of SMF API?
  • Compare the settings of local and online server through phpinfo()
  • You might want to ask the server-support team if none of the above solved your problem.
4
On

If you are using SMF and want to create a login to SMF, but outside of the SMF forum (which is how I understand it), than you'll want to use the SSI.php file that is bundled with SMF. You should do a require or require_once on it, very first thing at the very top of the page.

Also, open up SSI.php and I believe there is a ssi_login() and ssi_logout() function, use these functions to show a Login area for people. This should include the entire textboxes and display for it also.

Alternatively, you can ask for support over at SMF Community Support and/or review these SSI Examples/Tutorials

Furthermore, if it's a SESSION Issue, try this...

<?php
require_once('/home/filepath/public_html/forum_directory/SSI.php');
$_SESSION['login_url'] = 'http://www.domain.com' . $_SERVER['PHP_SELF'];
$_SESSION['logout_url'] = 'http://www.domain.com' . $_SERVER['PHP_SELF'];
?>

Change www.domain.com to the path of your site and the path to your SSI.php.