Advertisement:

Author Topic: A new tool is available for download. (smf_api.php)  (Read 51384 times)

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
A new tool is available for download. (smf_api.php)
« on: September 12, 2004, 07:39:35 PM »
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]
« Last Edit: September 12, 2004, 07:41:23 PM by [Unknown] »

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: A new tool is available for download. (smf_api.php)
« Reply #1 on: September 13, 2004, 01:02:11 AM »
I've just updated it once more with something rather critical: session support ;).

-[Unknown]

Offline Tony Reid

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 4,154
  • Gender: Male
    • @AbsoluteBreeze on Twitter
    • www.fertilityfriends.co.uk
Re: A new tool is available for download. (smf_api.php)
« Reply #2 on: September 13, 2004, 06:38:41 AM »
Hey cant wait to play with this tonight :)

Thanks!!
Tony,
Tony Reid


My Big Board
www.FertilityFriends.co.uk/forum - An SMF powered forum with over 5 million posts

Offline Vinoth

  • Full Member
  • ***
  • Posts: 569
  • Gender: Male
  • Hackers Are Not Crackers
Re: A new tool is available for download. (smf_api.php)
« Reply #3 on: September 13, 2004, 07:55:31 AM »
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.

roboter88

  • Guest
Re: A new tool is available for download. (smf_api.php)
« Reply #4 on: September 13, 2004, 09:39:34 AM »
We can integrating eg. SMF or any other php application :)

http://coppermine.sourceforge.net/board/index.php?topic=9934.0


cheers

Offline Xavier

  • Semi-Newbie
  • *
  • Posts: 36
  • Gender: Male
  • Lost in a world.
    • Gothic-Culture
Re: A new tool is available for download. (smf_api.php)
« Reply #5 on: September 13, 2004, 03:17:33 PM »
Ok...
I have integrate this code at the first part of smf.inc.php of coppermine gallery
Code: [Select]
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
Code: [Select]
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 -_-

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: A new tool is available for download. (smf_api.php)
« Reply #6 on: September 14, 2004, 02:13:17 AM »
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]

Offline Shedman

  • Semi-Newbie
  • *
  • Posts: 20
  • Gender: Male
  • Simple Machines n00b
Re: A new tool is available for download. (smf_api.php)
« Reply #7 on: November 04, 2004, 05:06:36 AM »
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:

Code: [Select]
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?
« Last Edit: November 04, 2004, 05:59:53 AM by Shedman »
If you can't join 'em, beat 'em ...

Offline ms_ukyankee

  • Full Member
  • ***
  • Posts: 531
  • Gender: Female
Re: A new tool is available for download. (smf_api.php)
« Reply #8 on: November 04, 2004, 05:32:10 AM »
I used this to logout.

Code: [Select]
smf_setLoginCookie(-3600, $userid, $userpassword);
SMF since 2004 <3

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: A new tool is available for download. (smf_api.php)
« Reply #9 on: November 04, 2004, 05:48:54 AM »
No, session destroy is not what you want.  What Leah posted should work.

-[Unknown]

Offline Shedman

  • Semi-Newbie
  • *
  • Posts: 20
  • Gender: Male
  • Simple Machines n00b
Re: A new tool is available for download. (smf_api.php)
« Reply #10 on: November 04, 2004, 05:57:29 AM »
That does the trick, thanks guys :-*
If you can't join 'em, beat 'em ...

Offline Shedman

  • Semi-Newbie
  • *
  • Posts: 20
  • Gender: Male
  • Simple Machines n00b
Re: A new tool is available for download. (smf_api.php)
« Reply #11 on: November 04, 2004, 08:54:03 AM »
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.
« Last Edit: November 04, 2004, 10:51:36 AM by Shedman »
If you can't join 'em, beat 'em ...

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: A new tool is available for download. (smf_api.php)
« Reply #12 on: November 04, 2004, 04:01:43 PM »
From smf_api.php:
Code: [Select]
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]

Offline Shedman

  • Semi-Newbie
  • *
  • Posts: 20
  • Gender: Male
  • Simple Machines n00b
Re: A new tool is available for download. (smf_api.php)
« Reply #13 on: November 05, 2004, 03:21:16 AM »
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 ...

Offline Shedman

  • Semi-Newbie
  • *
  • Posts: 20
  • Gender: Male
  • Simple Machines n00b
Re: A new tool is available for download. (smf_api.php)
« Reply #14 on: January 10, 2005, 04:45:59 AM »
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 ...

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: A new tool is available for download. (smf_api.php)
« Reply #15 on: January 10, 2005, 04:54:03 AM »
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]

Offline Shedman

  • Semi-Newbie
  • *
  • Posts: 20
  • Gender: Male
  • Simple Machines n00b
Re: A new tool is available for download. (smf_api.php)
« Reply #16 on: January 10, 2005, 05:01:06 AM »
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?
« Last Edit: January 10, 2005, 08:18:36 AM by Shedman »
If you can't join 'em, beat 'em ...

Offline Shedman

  • Semi-Newbie
  • *
  • Posts: 20
  • Gender: Male
  • Simple Machines n00b
Re: A new tool is available for download. (smf_api.php)
« Reply #17 on: January 11, 2005, 08:14:08 AM »
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 ::)
« Last Edit: January 11, 2005, 08:29:58 AM by Shedman »
If you can't join 'em, beat 'em ...

Offline Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 58,745
  • Gender: Male
    • Kindred-999 on GitHub
Re: A new tool is available for download. (smf_api.php)
« Reply #18 on: January 11, 2005, 09:20:51 AM »
AH!   Yes, this could also be the cause of an issue with the "who's online" module for the Mambo-SMF bridge...

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: A new tool is available for download. (smf_api.php)
« Reply #19 on: January 11, 2005, 07:33:58 PM »
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]