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

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

Previous topic - Next topic

[Unknown]

The purpose of this tool is to facilitate easy integration of SMF into other scripts and software.  Previously, this was done with SSI.php, but that pulls in most of SMF and can become very bloated for general usage inside another large software.  It also meant the possibility of naming conflicts, the two softwares fighting over output buffering, and many other problems.  Even past that, there have been licensing problems.

This tool is not yet complete, but it has been developed to ease all of these problems.  It is a single file, separate from SMF's code.  It may also be available under alternative licenses - please reply here or contact me, Jeff Lewis, or another team member for additional details.

It is available here:

http://www.simplemachines.org/download.php?converters

If you have any concerns or problems with it, or believe anything should be added to it (remembering that it is meant to be lightweight!) please don't hesitate to comment.

Thanks,
-[Unknown]

[Unknown]

I've just updated it once more with something rather critical: session support ;).

-[Unknown]

Tony Reid

Hey cant wait to play with this tonight :)

Thanks!!
Tony,
Tony Reid

Vinoth

well features over the SSI other than u sited,fighting over output buffering
what can we do with this???
Vinoth And Sachin ( SpecHackers Team )
The Best  Way to Help Poor Is not Becoming One Of Them.


Xavier

Ok...
I have integrate this code at the first part of smf.inc.php of coppermine gallery

require_once('../forum/smf_api.php');

smf_authenticateUser();
smf_loadSession();
smf_logOnline('coppermine');

The logout run correctly, but i have some error on the page

Notice: Constant ¨Òë 6 already defined in /home/httpd/vhosts/gothic-culture.net/httpdocs/gallery/bridge/smf.inc.php on line 85

Notice: A session had already been started - ignoring session_start() in /home/httpd/vhosts/gothic-culture.net/httpdocs/gallery/bridge/smf.inc.php on line 154

Fatal error: Call to undefined function: db_affected_rows() in /home/httpd/vhosts/gothic-culture.net/httpdocs/forum/smf_api.php on line 591

Warning: Unknown(): A session is active. You cannot change the session module's ini settings at this time. in Unknown on line 0

and the gallery not run correctly... Only the logout now run -_-

[Unknown]

I replied on the coppermine forum - however, I might note that there was a typo in the download (serves me right for updating it at something like 2 am) and so I updated it once more.

-[Unknown]

Shedman

#7
I've installed SMF just yesterday and am trying to connect to it using smf_api.php. So far so good :)

I've also fixed that I can login, so that works as well.

Now I'm trying to log out of SMF through smf_api.php. Imho this would work by destroying the session using smf_sessionDestroy( string session_id ). So I get the session_id from $smf_user_info and pass it through to the function, but somehow it doesn't seem to work. The error I get is:

Fatal error: Call to undefined function: db_query() in /home/aize/www/syn-3/forum/smf_api.php on line 609

The name of the function sounded familliar to me, because I have a similar function with the same name in my own system. So I've renamed that function.

So I've looked up this function and it seems that the session is deleted from the database here. 'Not to worry', I think and stopped using the DB for my sessions. But that doesn't help either ...

What am I doing wrong?
If you can't join 'em, beat 'em ...

ms_ukyankee

I used this to logout.

smf_setLoginCookie(-3600, $userid, $userpassword);

SMF since 2004 <3

[Unknown]

No, session destroy is not what you want.  What Leah posted should work.

-[Unknown]

Shedman

If you can't join 'em, beat 'em ...

Shedman

#11
Next problem ... can I use smf_query for inserts?
When I try to it returns nothing, but there is no error in the log, although there should be ... returning the mysql_error() lets me know there is a problem freeing the resultset. Wich is the logical thing with an insert, because there is no resultset.

So no error in the log and no new data in the database :(

How do I insert sth into the DB or is inserting prohibited? It doesn't say so in the comments.
If you can't join 'em, beat 'em ...

[Unknown]

From smf_api.php:
smf_query("
INSERT IGNORE INTO $smf_settings[db_prefix]log_online
(session, ID_MEMBER, ip, url)
VALUES ('ip$_SERVER[REMOTE_ADDR]', 0, IFNULL(INET_ATON('$_SERVER[REMOTE_ADDR]'), 0), '$serialized')", __FILE__, __LINE__);


So, yes, you can insert.

If nothing happens, it probably means no connection could be made to the database.  Try outputting the mysql_error() at various stages.

-[Unknown]

Shedman

I've been testing some things and I think the problems was in the fact that I have two DB-connections open and I didn't specify the databasename in the query.
As soon as I did sepcify the db-name, it worked :)
If you can't join 'em, beat 'em ...

Shedman

Is the smf_api compatible with SMF 1.0? I've upgraded and it doesn't seem to work :(
If you can't join 'em, beat 'em ...

[Unknown]

It should be.  Try downloading the latest one from the download page.

We use it for some tools on this site (and they still work.)

-[Unknown]

Shedman

#16
Ah ... somehow registering users does work, butt logging on and off doesn't.
I'll try upgrading first.

[update]
Upgraded, now I don't get any response form AuthenticateUser(). Not true and no false ...

In the session only [login_SMFCookie10] is set, that used to be different, wasn't it?
If you can't join 'em, beat 'em ...

Shedman

#17
Somehow smf_authenticateUser doesn't give feedback anymore. So instead of using it in an if-statement I placed it outside of the  statement. Still not logged on.
Turned off database-driven sessions and that did the trick!

So tried putting smf_authenticateUser back in the if-statement, but that gave me an error again, so I just decided to skip the if-statement.

[update]
After some more testing I found out that the authenticateUser-function still doesn't work :( Going to the forum, you're not logged on. As soon as you refresh the page though ... you are ???

* Shedman is getting a little frustrated ::)
If you can't join 'em, beat 'em ...

Kindred

AH!   Yes, this could also be the cause of an issue with the "who's online" module for the Mambo-SMF bridge...

Слaва
Украинi

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

[Unknown]

Quote from: Shedman on January 11, 2005, 08:14:08 AM
After some more testing I found out that the authenticateUser-function still doesn't work :( Going to the forum, you're not logged on. As soon as you refresh the page though ... you are ???

* Shedman is getting a little frustrated ::)

Make sure:
  - you're using smf_loadSession().
  - you've got "subdomain independent cookies" enabled and "local cookies" disabled.
  - the cookie is being sent properly.

-[Unknown]

Advertisement: