Mengubah password semua actor
This commit is contained in:
@@ -94,39 +94,29 @@ CREATE TABLE IF NOT EXISTS users (
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
-- ── Akun Demo ─────────────────────────────────────────────
|
||||
-- Password di-hash menggunakan bcrypt (PHP password_hash)
|
||||
-- admin → admin123
|
||||
-- petugas → petugas123
|
||||
-- pengurus → pengurus123
|
||||
--
|
||||
-- Hash ini sudah valid, digenerate dengan PASSWORD_DEFAULT PHP 8
|
||||
-- Password semua akun: "password" (bcrypt via PHP PASSWORD_DEFAULT)
|
||||
INSERT INTO users (username, nama_lengkap, role, password_hash) VALUES
|
||||
(
|
||||
'admin',
|
||||
'Administrator Sistem',
|
||||
'admin',
|
||||
'$2y$12$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi'
|
||||
'$2y$10$mhMxyKlOSSTQxfmWXEncfe1AF56CJ8fb.v0h0CYZ.ELQQd8iP5LrG'
|
||||
),
|
||||
(
|
||||
'petugas',
|
||||
'Petugas Lapangan',
|
||||
'petugas',
|
||||
'$2y$12$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi'
|
||||
'$2y$10$mhMxyKlOSSTQxfmWXEncfe1AF56CJ8fb.v0h0CYZ.ELQQd8iP5LrG'
|
||||
),
|
||||
(
|
||||
'pengurus',
|
||||
'Pengurus Rumah Ibadah',
|
||||
'pengurus',
|
||||
'$2y$12$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi'
|
||||
'$2y$10$mhMxyKlOSSTQxfmWXEncfe1AF56CJ8fb.v0h0CYZ.ELQQd8iP5LrG'
|
||||
),
|
||||
(
|
||||
'walikota',
|
||||
'Walikota Pontianak',
|
||||
'walikota',
|
||||
'$2y$10$s0387VqXY8wBXYkVytEKxumpF0DmlBlE1z3usinr0nr1RYN/4BZw.'
|
||||
'$2y$10$mhMxyKlOSSTQxfmWXEncfe1AF56CJ8fb.v0h0CYZ.ELQQd8iP5LrG'
|
||||
);
|
||||
|
||||
-- !! CATATAN: Hash di atas adalah placeholder "password".
|
||||
-- Setelah import, jalankan generate_hash.php untuk meng-update
|
||||
-- hash dengan password yang benar (admin123, petugas123, pengurus123).
|
||||
-- URL: http://localhost/WebGIS/pertemuan fix/generate_hash.php
|
||||
|
||||
@@ -7,11 +7,12 @@
|
||||
|
||||
require_once 'config.php';
|
||||
|
||||
// Daftar akun demo yang akan di-insert / update
|
||||
// Daftar akun demo yang akan di-insert / update (password seragam: "password")
|
||||
$demoUsers = [
|
||||
['username' => 'admin', 'nama' => 'Administrator Sistem', 'role' => 'admin', 'password' => 'admin123'],
|
||||
['username' => 'pengurus', 'nama' => 'Pengurus Rumah Ibadah', 'role' => 'pengurus', 'password' => 'pengurus123'],
|
||||
['username' => 'walikota', 'nama' => 'Walikota Pontianak', 'role' => 'walikota', 'password' => 'walikota123'],
|
||||
['username' => 'admin', 'nama' => 'Administrator Sistem', 'role' => 'admin', 'password' => 'password'],
|
||||
['username' => 'petugas', 'nama' => 'Petugas Lapangan', 'role' => 'petugas', 'password' => 'password'],
|
||||
['username' => 'pengurus', 'nama' => 'Pengurus Rumah Ibadah', 'role' => 'pengurus', 'password' => 'password'],
|
||||
['username' => 'walikota', 'nama' => 'Walikota Pontianak', 'role' => 'walikota', 'password' => 'password'],
|
||||
];
|
||||
|
||||
$db = getDB();
|
||||
@@ -79,7 +80,7 @@ header('Content-Type: text/html; charset=utf-8');
|
||||
<td class="<?= str_starts_with($r['status'],'✅') ? 'ok':'err' ?>"><?= $r['status'] ?></td>
|
||||
<td><?= htmlspecialchars($r['username']) ?></td>
|
||||
<td><?= htmlspecialchars($r['role']) ?></td>
|
||||
<td><?= ($r['username'].'123') ?></td>
|
||||
<td>password</td>
|
||||
<td style="font-size:11px;word-break:break-all"><?= htmlspecialchars($r['hash']) ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
|
||||
@@ -739,9 +739,9 @@
|
||||
<!-- Quick Fill -->
|
||||
<div class="quick-fill-label">Akun Demo — Klik untuk Isi Otomatis</div>
|
||||
<div class="quick-row">
|
||||
<button class="quick-btn" onclick="isiDemo('admin','admin123','admin')">🛡️ Admin</button>
|
||||
<button class="quick-btn" onclick="isiDemo('pengurus','pengurus123','pengurus')">🕌 Pengurus</button>
|
||||
<button class="quick-btn" onclick="isiDemo('walikota','walikota123','walikota')">👑 Walikota</button>
|
||||
<button class="quick-btn" onclick="isiDemo('admin','password','admin')">🛡️ Admin</button>
|
||||
<button class="quick-btn" onclick="isiDemo('pengurus','password','pengurus')">🕌 Pengurus</button>
|
||||
<button class="quick-btn" onclick="isiDemo('walikota','password','walikota')">👑 Walikota</button>
|
||||
</div>
|
||||
|
||||
<div class="footer-note">WebGIS Poverty Mapping · 2026</div>
|
||||
|
||||
@@ -91,11 +91,5 @@ PREPARE stmt FROM @sql;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
|
||||
-- ── 6. Update password walikota (gunakan generate_hash.php untuk update bcrypt) ──
|
||||
-- Password walikota: walikota123
|
||||
-- Jalankan generate_hash.php setelah migrasi ini untuk update hash
|
||||
|
||||
-- ============================================================
|
||||
-- SELESAI. Jalankan generate_hash.php untuk update password hash.
|
||||
-- URL: http://localhost/WebGIS/pertemuan fix/generate_hash.php
|
||||
-- ============================================================
|
||||
-- ── 6. Password semua akun: "password" ──
|
||||
-- Jalankan update_pass.php atau generate_hash.php jika database sudah ada.
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
<?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();
|
||||
@@ -20,48 +20,41 @@ CREATE TABLE IF NOT EXISTS users (
|
||||
INDEX idx_aktif (aktif)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
-- ── Akun demo (password di-hash dengan bcrypt PHP PASSWORD_DEFAULT) ──
|
||||
-- Gunakan script generate_hash.php untuk membuat hash baru jika perlu.
|
||||
-- ── Akun demo (password semua akun: "password") ──
|
||||
-- Hash bcrypt digenerate dengan PHP password_hash('password', PASSWORD_DEFAULT)
|
||||
--
|
||||
-- admin → admin123
|
||||
-- petugas → petugas123
|
||||
-- pengurus → pengurus123
|
||||
--
|
||||
-- Hash di bawah digenerate dengan PHP:
|
||||
-- password_hash('admin123', PASSWORD_DEFAULT) → $2y$12$...
|
||||
-- password_hash('petugas123', PASSWORD_DEFAULT) → $2y$12$...
|
||||
-- password_hash('pengurus123', PASSWORD_DEFAULT) → $2y$12$...
|
||||
--
|
||||
-- !! Jangan gunakan plain text password di produksi !!
|
||||
-- admin → password
|
||||
-- petugas → password
|
||||
-- pengurus → password
|
||||
-- walikota → password
|
||||
|
||||
INSERT INTO users (username, nama_lengkap, role, password_hash) VALUES
|
||||
(
|
||||
'admin',
|
||||
'Administrator Sistem',
|
||||
'admin',
|
||||
'$2y$12$YourHashHereReplaceMe.admin123HashGeneratedByPHP'
|
||||
'$2y$10$mhMxyKlOSSTQxfmWXEncfe1AF56CJ8fb.v0h0CYZ.ELQQd8iP5LrG'
|
||||
),
|
||||
(
|
||||
'petugas',
|
||||
'Petugas Lapangan',
|
||||
'petugas',
|
||||
'$2y$12$YourHashHereReplaceMe.petugas123HashGeneratedByPHP'
|
||||
'$2y$10$mhMxyKlOSSTQxfmWXEncfe1AF56CJ8fb.v0h0CYZ.ELQQd8iP5LrG'
|
||||
),
|
||||
(
|
||||
'pengurus',
|
||||
'Pengurus Rumah Ibadah',
|
||||
'pengurus',
|
||||
'$2y$12$YourHashHereReplaceMe.pengurus123HashGeneratedByPHP'
|
||||
'$2y$10$mhMxyKlOSSTQxfmWXEncfe1AF56CJ8fb.v0h0CYZ.ELQQd8iP5LrG'
|
||||
),
|
||||
(
|
||||
'walikota',
|
||||
'Walikota Pontianak',
|
||||
'walikota',
|
||||
'$2y$10$s0387VqXY8wBXYkVytEKxumpF0DmlBlE1z3usinr0nr1RYN/4BZw.'
|
||||
'$2y$10$mhMxyKlOSSTQxfmWXEncfe1AF56CJ8fb.v0h0CYZ.ELQQd8iP5LrG'
|
||||
);
|
||||
|
||||
-- !! PENTING: Setelah import tabel di atas, jalankan generate_hash.php
|
||||
-- untuk mengisi password_hash yang benar secara otomatis. !!
|
||||
-- !! Untuk database yang sudah ada, jalankan update_pass.php atau generate_hash.php !!
|
||||
|
||||
-- ── Catatan hak akses per role ──────────────────────────────
|
||||
/*
|
||||
|
||||
+5
-5
@@ -54,7 +54,7 @@
|
||||
</ul>
|
||||
<div class="card-footer">
|
||||
<span class="tech-stack">Leaflet · PHP · MySQL</span>
|
||||
<a href="WebGIS_SPBU/index.html" class="btn-primary">
|
||||
<a href="./WebGIS_SPBU/index.html" class="btn-primary">
|
||||
Buka Aplikasi
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
||||
stroke-width="2.5">
|
||||
@@ -80,7 +80,7 @@
|
||||
</ul>
|
||||
<div class="card-footer">
|
||||
<span class="tech-stack">Leaflet · PHP · MySQL</span>
|
||||
<a href="Manajemen_Jalan_dan_Parsil/index.html" class="btn-primary">
|
||||
<a href="./Manajemen_Jalan_dan_Parsil/index.html" class="btn-primary">
|
||||
Buka Aplikasi
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
||||
stroke-width="2.5">
|
||||
@@ -107,15 +107,15 @@
|
||||
<div class="card-footer card-footer-multi">
|
||||
<span class="tech-stack">Leaflet · PHP · MySQL · RBAC</span>
|
||||
<div class="btn-group">
|
||||
<a href="WebGIS_PovertyMap/login.html" class="btn-primary">
|
||||
<a href="./WebGIS_PovertyMap/login.html" class="btn-primary">
|
||||
Login
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
||||
stroke-width="2.5">
|
||||
<path d="M5 12h14M12 5l7 7-7 7" />
|
||||
</svg>
|
||||
</a>
|
||||
<a href="WebGIS_PovertyMap/index.html" class="btn-secondary">Peta Utama</a>
|
||||
<a href="WebGIS_PovertyMap/dashboard_walikota.html" class="btn-secondary">Dashboard</a>
|
||||
<a href="./WebGIS_PovertyMap/index.html" class="btn-secondary">Peta Utama</a>
|
||||
<a href="./WebGIS_PovertyMap/dashboard_walikota.html" class="btn-secondary">Dashboard</a>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
|
||||
Reference in New Issue
Block a user