News:

SMF 2.1.2 has been released! Take it for a spin! Read more.

Main Menu

New tools to help integrating SMF with something else

Started by Andre N, September 19, 2011, 01:35:36 PM

Previous topic - Next topic

krator

Hello.

I'm using the file from first topic in order to connect two differents CMS (Smf 2.0.17 and another soft), but i can't do it.  I'm testing and i think that the problem is in the smfapi_loadUserSettings() function, too (How MrManager said). The problem look that it's because cookie and session global variables is loaded with my another CMS, and not with SMF, so that the information it's not reached.

So, Could anyone use this api to connect to another CMS (login/logout...)?
Webmaster and developer of La Torre de marfil

vbgamer45

#221
Made a change see if it helps for 2.0.17 with the smfapi_login

Removed attachment see below for newest one.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

krator

#222
Great, thanks vbgamer45!

I'm testing again. I'm not sure if I'm doing this process correctly. This is my step-to-step:
1. Login in my external system. If it's success, call to the function (example):
smfapi_login('krator')

I have been "debugging" the function:

function smfapi_login($username='', $cookieLength=525600)
{
...

    smfapi_loadUserSettings();

return true;
}

All look successful, i can see the cookie of SMF in $_COOKIE and $user_info is loaded with my data.

2. Load the page of smf (like: http://localhost:8080/smf2017/index.php [nofollow]).

But, I'm not login in SMF.

Am I skipping a step? (call another function more, or similar)

Edit:
Test 1.
1. Login in my external system in Firefox. (smfapi_login launched)
2. Load SMF index webpage in Chrome. I can see to "krator" how user online
3. Logout in my external system in Firefox. (smfapi_logout launched)
4. Load SMF index webpage in Chrome. I cant see to "krator" how user online

Test 2.
1. Login in my external system in Firefox. (smfapi_login launched)
2. Load SMF index webpage in Chrome. I can see to "krator" how user online
3. Load SMF index webpage in Firefox. I can see to "krator" how user online, BUT, I'm not loggin in SMF!
Webmaster and developer of La Torre de marfil

vbgamer45

I still can't get it to login on my side...
But, I have updated it so it should have the right hash in the cookie now...and made a minor session change...
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

krator

Ey, thanks.
I have try with the new file, but similar results. Have you made any progress?

Thanks.
Webmaster and developer of La Torre de marfil

vbgamer45

No, I haven't sorry I spent a few hours on it. Not sure what else to check for.
I comparing the password set in the cookies in normal SMF and though the API both are the same...
I tried comparing both functions
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

phydaux

Well, I have just tried your updated smf_2_api.php file, and it worked for me!  Thank you very much for that.
My setup is 2.0.14 with the patches to bring it up to 2.0.17.  I have just tried the original api file, and was getting the same results you described.  I could see the cookie being created, but it seemed to be removed as soon as I went to the SMF site.  Switching to your modified api results in a persistent login.

krator

Could you say me how you have setting the cookies?

Im trying in my localhost with:
Enable local storage of cookies = FALSE
Use subdomain independent cookies = TRUE
Use database driven sessions = TRUE
Allow browsers to go back to cached pages = TRUE
Webmaster and developer of La Torre de marfil

Nic_G

I am looking for the latest version of SMF_2_API.php but all links seem to be gone.

Any idea where it is?

Thanks!

Nic.

Kindred

Слова
Украина

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."

Advertisement: