Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Aiheen aloitti: Mstcool - tammikuu 20, 2014, 06:28:07 IP

Otsikko: Integrating Login into Homepage?
Kirjoitti: Mstcool - tammikuu 20, 2014, 06:28:07 IP
Hey guys,
Is there a way in which I can integrate the SMF login into a homepage (not a portal, just a html coded homepage)? I am new to coding so I have no idea on what to do. I just want to make it so people can login via the homepage and when they access the forum, they would already be logged in.


Thanks,
-Mstcool. :)
Otsikko: Re: Integrating Login into Homepage?
Kirjoitti: Arantor - tammikuu 20, 2014, 06:28:45 IP
How to use the SMF user system outside of SMF (http://wiki.simplemachines.org/smf/How_to_use_the_SMF_user_system_outside_of_SMF)
SSI Readme (http://wiki.simplemachines.org/smf/Category:SSI)
Otsikko: Re: Integrating Login into Homepage?
Kirjoitti: Mstcool - tammikuu 20, 2014, 06:38:36 IP
Oh, right. I read about that yesterday, I completely forgot about it. But what does it mean by "calling the Ssi.php file"? And am I supposed to add the Ssi.php file to the homepage, right? Not to the SMF forum?
Otsikko: Re: Integrating Login into Homepage?
Kirjoitti: Arantor - tammikuu 20, 2014, 06:39:59 IP
Yup, you have the homepage load SSI.php which can check if the user is logged in or not.
Otsikko: Re: Integrating Login into Homepage?
Kirjoitti: margarett - tammikuu 20, 2014, 06:40:48 IP
Look at the file "ssi_examples.php" in your forum root for a more detailed insight.
And yes, you add SSI.php to your homepage by adding:

// Include the SSI file.
require(dirname(__FILE__) . '/SSI.php');

(have a look at that file ;) )

edit: ninja'd!
Otsikko: Re: Integrating Login into Homepage?
Kirjoitti: Mstcool - tammikuu 20, 2014, 06:43:45 IP
Wait, so for the code you wrote....am I supposed to change the "dirname(___FILE__)" thing to any? And this goes on my index file for my homepage, right? Sorry for asking lame questions, just confused. :p
Otsikko: Re: Integrating Login into Homepage?
Kirjoitti: margarett - tammikuu 20, 2014, 06:49:35 IP
dirname(__FILE__) is a way to automatically get the folder where the script being called is. If you don't want to use it like that (if your homepage is not in SMF folder, as it is likely), you can always give the full path:


// Include the SSI file.
require('/srv/home/users/user1234/forum/SSI.php');

Works the same way
Otsikko: Re: Integrating Login into Homepage?
Kirjoitti: Mstcool - tammikuu 20, 2014, 07:01:24 IP
Thank You!!

I have integrated the login with the homepage and it works perfectly.

Thanks once again,
-Mstcool. :)