News:

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

Main Menu

A new tool is available for download. (smf_api.php)

Started by [Unknown], September 12, 2004, 07:39:35 PM

Previous topic - Next topic

BURN3R

Sorry for digging up an old topic but is this tool still updated / supported?
I'm having trouble using it with my 1.1.5 SMF install, Ive searched a lot and found a couple of versions of this file around and not sure which one I should be using, if any.

rewen

I am also wonder what I should be using. I have SMF 1.1.7 and need to be able to log users in and out from my own custom site.

I just switched from IPB to SMF.. IPB had an amazing API (though it was 3rd party). My site needs to be able to tell if a user is logged in, what user group they are in, how many private messages they have, how many members and guests are online, the member count, post count, newest member, current bdays, etc.

Any suggestions?

The problem with this API is that after I set the cookie it logs me out of the forum. So I log out back into the forum but then it logs me out of the custom site. The cookies must be different and won't authenticate. I am not under a subdomain or anything.

Here is my test script (the *entire* thing):

<?

require_once("/var/www/vhosts/my-site.com/httpdocs/smf/smf_api.php");

if (smf_authenticateUser() === false) {
echo "<p>Not logged in. Setting login cookie. Reload page to authenticate cookie and login.</p>\n";

if (smf_setLoginCookie(3600, "rewen", "06646c1e194ac42a0b30c94f2b648a9a2967c9f9", true) === false) {
echo "<p>Setting of cookie failed</p>\n";
}
} else {
smf_loadSession();
smf_logOnline("Logged in from test script");

echo "<p>Cookie found and authenticated. Logged in</p>\n";

print_r ($smf_user_info);
}
?>

青山 素子

Although the API is still valid for 1.1, I suggest you look into using the integration hooks (check the bridges board) and SSI.php. You can get all the user info by including SSI.php.
Motoko-chan
Director, Simple Machines

Note: Unless otherwise stated, my posts are not representative of any official position or opinion of Simple Machines.


Advertisement: