Files
UAS_WEBGIS_MuhammadFarras_D…/WebGIS_PovertyMap/update_pass.php
T
2026-06-09 20:22:09 +07:00

28 lines
824 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?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();