SamJakob
Active member
I have an external PHP file that is used in conjunction with another application:
I am requiring XenForo's XF.php at the top of the file (and instantiating an App instance - not sure if it's necessary):
I want to authenticate a user with another IP address automatically (the application runs on a server and uses a secure method of communication with the PHP file.)
I've got to the point of looking up the user to retrieve their user ID and username - and then using a finder to create a User object.
Now, I want to switch the session user as you would below;
...but I want this session to be for an IP address other than the one requesting the PHP file (as that's just the application running on the server.)
Is there a way for me to create a session for that other IP address or do I apply the information to this session and somehow change the IP address of this session?
I am requiring XenForo's XF.php at the top of the file (and instantiating an App instance - not sure if it's necessary):
PHP:
require("../../../XF.php"); // Directory is /var/www/xenforo/src/
XF::start("../../../../"); // Directory is /var/www/xenforo/
$app = XF::setupApp('XF\Pub\App');
I want to authenticate a user with another IP address automatically (the application runs on a server and uses a secure method of communication with the PHP file.)
I've got to the point of looking up the user to retrieve their user ID and username - and then using a finder to create a User object.
PHP:
$finder = \XF::finder('XF:User');
$user = $finder->where('username', $username)->fetchOne();
Now, I want to switch the session user as you would below;
PHP:
$app->session->changeUser($user);
\XF::setVisitor($user);
...but I want this session to be for an IP address other than the one requesting the PHP file (as that's just the application running on the server.)
Is there a way for me to create a session for that other IP address or do I apply the information to this session and somehow change the IP address of this session?