ForcedCommander
Member
Hi guys!
I recently bought XenForo (a friend recommended me this forum software) and I am verry hapy with it! I really like the software
I've only got one question though, I want forum users to be able to login onto my website with their forum credentials aswell (so not on the forum itself). I came up with this because it would be weird if you ask users to make 2 accounts. Since a forum account is required i thought it would be smart to just use that account for other stuff aswell on the same website.
I looked trough some tables and found the user table (xf_user) so I have found the username and the userID. The only thing I am now looking for is the password table (can't find that). I dont want to decrypt the passwords, but what I want to do is encrypt the passwords the same way (so I can match the input of the user with the password in the table) and I think I can find that awnser in the passwords table
I hope you guys can point me towards the right direction
- Commander
Edit found a piece of code wich probably wil help a lot
Anyone know where I can look up the crypt id?
I recently bought XenForo (a friend recommended me this forum software) and I am verry hapy with it! I really like the software
I've only got one question though, I want forum users to be able to login onto my website with their forum credentials aswell (so not on the forum itself). I came up with this because it would be weird if you ask users to make 2 accounts. Since a forum account is required i thought it would be smart to just use that account for other stuff aswell on the same website.
I looked trough some tables and found the user table (xf_user) so I have found the username and the userID. The only thing I am now looking for is the password table (can't find that). I dont want to decrypt the passwords, but what I want to do is encrypt the passwords the same way (so I can match the input of the user with the password in the table) and I think I can find that awnser in the passwords table
I hope you guys can point me towards the right direction
- Commander
Edit found a piece of code wich probably wil help a lot
Anyone know where I can look up the crypt id?
PHP:
$startTime = microtime(true);
//FULL PATH.
require('forum/library/XenForo/Autoloader.php');
XenForo_Autoloader::getInstance()->setupAutoloader('forum/library');
XenForo_Application::initialize('forum/library');
XenForo_Application::set('page_start_time', $startTime);
//Crypt code you set for your login, if you dont have it, then just comment $crypt out, but this is VERY useful agaisnt brute forces.
/*$crypt = $_POST['crypt'];*/
//Checks if username is set, password is set, and if the crypt ID is the same as you set in your server class.
if (isset($_POST['username']) && isset($_POST['password']) && $crypt === 911895326) {
//Username you're posting from server.
$username = $_POST['username'];
//Password you're posting from server.
$password = $_POST['password'];
$db = XenForo_Application::getDb();
$data = $db->fetchOne('
SELECT
auth.data
FROM xf_user_authenticate AS auth
INNER JOIN xf_user AS user ON
(user.user_id = auth.user_id)
WHERE user.username = ?
', $username);
$auth = XenForo_Authentication_Abstract::createDefault();
$auth->setData($data);
//Checks if equal through the hash
$check = $auth->authenticate($username, $password);
//dump for testing (true/false)
Zend_Debug::dump($check);
/* CHECKING METHOD */
//Checks if login details are equal to the ones that are in the database.
if ($check) {
//Prints "Success" string, so you can check in java if the printed string is that, if yes, then create login.
echo 'Success';
} else {
echo 'Failed';
}
}
Last edited: