28 lines
824 B
PHP
28 lines
824 B
PHP
<?php
|
||
// ============================================================
|
||
// update_pass.php – Set semua password user menjadi "password"
|
||
// Akses: http://localhost/WebGIS/WebGIS_PovertyMap/update_pass.php
|
||
// ============================================================
|
||
|
||
require_once 'config.php';
|
||
|
||
// Nonaktifkan header JSON dari config.php untuk output HTML
|
||
header('Content-Type: text/html; charset=utf-8');
|
||
|
||
$db = getDB();
|
||
$hash = password_hash('password', PASSWORD_DEFAULT);
|
||
|
||
$stmt = $db->prepare('UPDATE users SET password_hash = ?');
|
||
$stmt->bind_param('s', $hash);
|
||
|
||
if ($stmt->execute()) {
|
||
$count = $stmt->affected_rows;
|
||
echo "Berhasil: {$count} akun diupdate. Password semua user = \"password\"\n";
|
||
echo "Hash: {$hash}\n";
|
||
} else {
|
||
echo 'Error: ' . $stmt->error . "\n";
|
||
}
|
||
|
||
$stmt->close();
|
||
$db->close();
|