Advertisement:

Author Topic: API 1.1 not available?  (Read 864 times)

Offline BrianE

  • Newbie
  • *
  • Posts: 1
API 1.1 not available?
« on: February 17, 2019, 09:34:37 AM »
We are running SMF 1.1.21 and I cannot change or upgrade it at present. I have written my own membership program (C++) for the society of which I am MemSec. I would like to interface to SMF to create users instead of having to log in to SMF, go to registration and enter data manually. It seems I need API 1.1 but I cannot find it on this site despite being informed that it is here in 'tools'. So, two questions:
1: If I need API 1.1 where can I get it from?
2: If I don't then how do I create users programatically?

Thanks for reading and hopefully helping.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,858
    • StoryBB/StoryBB on GitHub
Re: API 1.1 not available?
« Reply #1 on: February 17, 2019, 09:46:58 AM »
There isn’t an API for 1.1 though I doubt it would take that much to change.

However I’d be more concerned at doing any substantial development on a platform that is 13 years old, receives no support from its authors for security issues and also forces you onto older, known insecure versions of PHP as a result.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline vbgamer45

  • Customizer
  • SMF Super Hero
  • *
  • Posts: 21,626
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: API 1.1 not available?
« Reply #2 on: February 17, 2019, 10:58:58 AM »
2. I would check out
sources\Subs-Members.php
 function registerMember(&$regOptions)

If you want to do via php.
There is also an smf_api.php    out there for 1.1.x

Or you can also just insert the entry into the smf_members database table
I did something like this a long time ago
Code: [Select]
$salt = substr(md5(rand()), 0, 4);

// Format the username properly.
$username = preg_replace('~[\t\n\r\x0B\0\xA0]+~', ' ', $username);
$ip = isset($_SERVER['REMOTE_ADDR']) ? addslashes(substr(stripslashes($_SERVER['REMOTE_ADDR']), 0, 255)) : '';

$request = mysql_query("
INSERT INTO {$prefix}members
(memberName, realName, passwd, emailAddress, ID_GROUP, posts, dateRegistered, hideEmail, passwordSalt, lngfile, personalText, avatar, memberIP, memberIP2, buddy_list, pm_ignore_list, messageLabels, websiteTitle, websiteUrl, location, ICQ, MSN, signature, usertitle, secretQuestion, additionalGroups)
VALUES (SUBSTRING('$username', 1, 25), SUBSTRING('$username', 1, 25), '" . sha1(strtolower($username) . $password) . "', '$email1', 1, '0', '" . time() . "', '1', '$salt', '', '', '', '$ip', '$ip', '', '', '', '', '', '', '', '', '', '', '', '')");
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro