Hey! basically, for some reason my homepage wasn't working anymore, due to server related issues.
And i cannot reset my admin password because i can't seem to get the forum to load...
all i'm able to load is the install/upgrade page and the admin login page, which both don't seem to have a forgot password button.
RESOLVED:
If you're stuck with the same problem just add this to your project(src or wherever) and curl or access the link:
(Make sure to change the
And i cannot reset my admin password because i can't seem to get the forum to load...
all i'm able to load is the install/upgrade page and the admin login page, which both don't seem to have a forgot password button.
RESOLVED:
If you're stuck with the same problem just add this to your project(src or wherever) and curl or access the link:
(Make sure to change the
$newPassword
and $userId
, and ofcourse your DB information)
Code:
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
$host = ‘DB_host’;
$db = ‘Forum_DB’;
$user = ‘Forum_DB_USER’;
$pass = ‘Forum_DB_pass;
try {
$dsn = "mysql:host=$host;dbname=$db;charset=utf8mb4";
$options = [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
PDO::ATTR_EMULATE_PREPARES => false,
];
$pdo = new PDO($dsn, $user, $pass, $options);
echo "Connected successfully to MySQL server version: ";
echo $pdo->getAttribute(PDO::ATTR_SERVER_VERSION) . "\n";
$userId = 1; // The user_id you want to update
$newPassword = ‘PASSWORD’; // New password
// Generate bcrypt hash
$newHash = password_hash($newPassword, PASSWORD_BCRYPT, ['cost' => 10]);
// Prepare the serialized data
$serializedData = serialize(['hash' => $newHash]);
// Convert serialized data to binary
$binaryData = pack('H*', bin2hex($serializedData));
$updateQuery = "
UPDATE xf_user_authenticate
SET data = :data
WHERE user_id = :user_id";
$stmt = $pdo->prepare($updateQuery);
echo "Query prepared successfully.\n";
$result = $stmt->execute([
':data' => $binaryData,
':user_id' => $userId
]);
echo "Query executed. Result: " . ($result ? "true" : "false") . "\n";
if ($stmt->rowCount() > 0) {
echo "User authentication data updated successfully for user ID: $userId\n";
} else {
echo "No rows updated. Check if the user ID exists.\n";
}
} catch (PDOException $e) {
echo "Database error: " . $e->getMessage() . "\n";
echo "Error code: " . $e->getCode() . "\n";
} catch (Exception $e) {
echo "General error: " . $e->getMessage() . "\n";
}
`
Last edited: