QUICK NEWS

{NEW} - More to come for this tab...

{OLD} - A new css video is up.


Video of the moment:


Internal Links

SMF Sites

Quick Info

Using SMF 2.1's Subs.php functions in a standalone script

Started by aiiwa233, Feb 03, 2026, 08:00 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

aiiwa233

I'm writing a standalone PHP script (outside the forum root) that needs to validate a user's password. I want to use SMF's $smcFunc['scrypt'] or the validateLoginPassword function from Subs.php.


I've included SSI.php and can access $smcFunc. However, when I try to call validateLoginPassword, I get a "call to undefined function" error.

Code snippet:
php<br>require_once('/path/to/forum/SSI.php');<br>// Can query user data with $smcFunc, but...<br>$valid = validateLoginPassword($password, $hash, $username); // Fails<br>
Do I need to manually include Subs-Auth.php or is there a better method to tap into SMF's authentication system externally without triggering full forum bootstrap?

shawnb61

If you're going to call a function in a file, like Subs-Auth.php, you need to include it first, typically with a require_once().