Advertisement:

Author Topic: New tools to help integrating SMF with something else  (Read 293804 times)

Offline krator

  • Semi-Newbie
  • *
  • Posts: 12
Re: New tools to help integrating SMF with something else
« Reply #220 on: April 19, 2020, 06:39:36 AM »
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...)?

Offline vbgamer45

  • Customizer
  • SMF Super Hero
  • *
  • Posts: 22,865
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: New tools to help integrating SMF with something else
« Reply #221 on: April 19, 2020, 02:13:47 PM »
Made a change see if it helps for 2.0.17 with the smfapi_login

Removed attachment see below for newest one.
« Last Edit: April 20, 2020, 12:53:12 PM by vbgamer45 »
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

Offline krator

  • Semi-Newbie
  • *
  • Posts: 12
Re: New tools to help integrating SMF with something else
« Reply #222 on: April 20, 2020, 06:32:06 AM »
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):
Code: [Select]
smfapi_login('krator')
I have been "debugging" the function:
Code: [Select]
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!
« Last Edit: April 20, 2020, 06:51:14 AM by krator »

Offline vbgamer45

  • Customizer
  • SMF Super Hero
  • *
  • Posts: 22,865
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: New tools to help integrating SMF with something else
« Reply #223 on: April 20, 2020, 09:31:36 AM »
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

Offline krator

  • Semi-Newbie
  • *
  • Posts: 12
Re: New tools to help integrating SMF with something else
« Reply #224 on: April 23, 2020, 01:00:12 PM »
Ey, thanks.
I have try with the new file, but similar results. Have you made any progress?

Thanks.

Offline vbgamer45

  • Customizer
  • SMF Super Hero
  • *
  • Posts: 22,865
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: New tools to help integrating SMF with something else
« Reply #225 on: April 23, 2020, 04:13:05 PM »
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

Offline phydaux

  • Newbie
  • *
  • Posts: 1
Re: New tools to help integrating SMF with something else
« Reply #226 on: June 12, 2020, 05:56:25 PM »
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.

Offline krator

  • Semi-Newbie
  • *
  • Posts: 12
Re: New tools to help integrating SMF with something else
« Reply #227 on: July 22, 2020, 02:35:06 AM »
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