views:

38

answers:

2

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?

A: 

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.
Sarfraz
How do I check for the session cookies - I think its a configuration thing as the system works ok on my localhost with no hitches however online it won't login automatically when I login to my system.I'll check the server settings using phpINfo - but what should I be looking for. The database is being written to properly I have noticed however automatically he won't log the user in. I can log into simple machines forum through its own log in screen though online...
Ali
@Ali: Did you find similar thread on the SMF API community or site?
Sarfraz
SMF uses only 1 session, and you can't start a session, I'm about 90% sure you have to use SMF variables for this via `SSI.php`. You should ask over at SMF for this specific question, but i attempted to answer it nonetheless.
SoLoGHoST
I've posted a number of times on the SMF site but didn't get any reply...
Ali
I checked the phpinfo of online host and my localhost - on the online host the session_save _path returns a no value - could that be causing problems here?
Ali
please check my update...
Ali
A: 

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.

SoLoGHoST
For sessions, try setting `$_SESSION[login_url']` and `$_SESSION['logout_url']` as mentioned in my edited answer above.
SoLoGHoST
Thanks but the thing is that I have a login form already on my system. WHat Im trying to do is the other way around. I have set it up so that when someone registers on my own website - a corresponding account is created on smf and associated with that user. The user logs in from my website into his account and automatically Im trying to get him authenticated into the smf forums as well with his associated smf account. However I got that part to work on my localhost but not online...
Ali
From what I understand the SSI file helps in displaying an smf login. I'm using the smf api which is mentioned in teh link posted in the original post. It works on my localhost as I mentioned but its not logging in to my online system :(
Ali
SMF uses the database to store session ids, something along the lines of a session table in the database. Not exactly sure how it all works, but I know that SMF is only capable of knowing whether the password entered is correct or not correct. It's not capable of outputting the passwords in any way, for security reasons. You should be able to use a SESSION variable as I suggested, and you can also use the `global $user_info` variable. For Example: `$user_info['id']` which will return the id of the user, you can also use `$user_info['name']`, if user is a guest, $user_info is empty.
SoLoGHoST