News:

Wondering if this will always be free?  See why free is better.

Main Menu

Integrating a PHP game with SMF 1.x

Started by Sunchaser, February 08, 2011, 02:41:37 PM

Previous topic - Next topic

Sunchaser

Hi, i need to integrate a game written in PHP with Smf. I looked into SSI.php but it seems there are functions to show statistics or read-only information.

I need to:

- Register automatically a user (already registered to the game) (now i do it by updating directly SMF tables)
- Assign/deassign automatically a (existing) profile to a user
- Deleting a smf user

Is there another set of API around beside SSI.php?

Thanks

NanoSector

Not really -- but some files DO have the ability to do what you said.

Take a look at the Function Database at Development.
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Sunchaser

I've looked at those function but they seem not integration APIs,

I have read some more posts and seems i maybe have to use integration hooks? Is there around some examples on
how i can use them from a simple php file?

Thanks





NanoSector

Quote from: Sunchaser on February 08, 2011, 02:55:47 PM
I've looked at those function but they seem not integration APIs,

I have read some more posts and seems i maybe have to use integration hooks? Is there around some examples on
how i can use them from a simple php file?

Thanks
Those are indeed integration APIs. -- in fact, they are way more powerful.

Just require the file in your game, and use the desired function.
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Sunchaser

I tried the following

<?php
define 
("SMF");
require 
"./Subs-Members.php";
deleteMembers'test_creaschema' );
?>



Gives an error like:

PHP Fatal error:  Call to undefined function isAllowedTo() in <cut>httpdocs/Sources/Subs-Members.php on line 138

(function isAllowed is in the security.php file.

I have some questions:

1) What's the difference between Subs-* files and other files, and which ones should i include?
2) Which one i should include to avoid missing functions errors?
3) security checks the script for authentication, how i am supposed to authenticate the script

Sorry for all these questions, if there is a link you can point me to i can try to address the problem myself

Thanks

NanoSector

The function db has links to descriptions.

You need to require security.php too then before including the other file.
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Arantor

Just include SSI.php before including the other file which loads all the important parts of SMF like the query functions, the allowedTo stuff and so on.
Holder of controversial views, all of which my own.


Kindred

Also, consider using the integration_hook functions rather than native smf functions...
Сл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."

Advertisement: