PHPIndex

This page lists files in the current directory. You can view content, get download/execute commands for Wget, Curl, or PowerShell, or filter the list using wildcards (e.g., `*.sh`).

admincheck.php
wget 'https://sme10.lists2.roe3.org/admsnippets/includes/admincheck.php'
View Content
<?php
  if (!defined('ADMSNIPPET')) die;
  $admin = false;
  if ($user > -1) {
    $admincheckstmt = mysqli_prepare($db, 'SELECT * FROM users WHERE id = ? AND is_admin = 1');
    if ($admincheckstmt) {
      mysqli_stmt_bind_param($admincheckstmt, 'i', $user);
      mysqli_stmt_execute($admincheckstmt);
      mysqli_stmt_store_result($admincheckstmt);
      if (mysqli_stmt_num_rows($admincheckstmt) > 0) {
        $admin = true;
      }
      mysqli_stmt_close($admincheckstmt);
    }
    unset($admincheckstmt);
  }
  if (!$admin) {
    header('Location: ' . (APP_ROOT));
    http_response_code(302);
    include("includes/finalize.php");
    exit;
  }
?>
finalize.php
wget 'https://sme10.lists2.roe3.org/admsnippets/includes/finalize.php'
View Content
<?php
  if (!defined('ADMSNIPPET')) die;
  mysqli_close($db);
?>
footer.php
wget 'https://sme10.lists2.roe3.org/admsnippets/includes/footer.php'
View Content
<?php if (!defined('ADMSNIPPET')) die; ?>
    <footer>
        <div class="container">
            <p><a href="<?php echo htmlspecialchars(APP_ROOT); ?>explore.php">Explore</a>
<!--
&nbsp;|
               <a href="<?php echo htmlspecialchars(APP_ROOT); ?>tos.php">Terms and Conditions</a>&nbsp;|
               <a href="<?php echo htmlspecialchars(APP_ROOT); ?>privacy.php">Privacy Policy</a>
-->
            </p>
        </div>
    </footer>
    <script src="<?php echo htmlspecialchars(APP_ROOT); ?>js/cookieconsent.min.js"></script>
    <script src="<?php echo htmlspecialchars(APP_ROOT); ?>js/cookieconsentinit.js"></script>
</body>
</html>
header.php
wget 'https://sme10.lists2.roe3.org/admsnippets/includes/header.php'
View Content
<?php if (!defined('ADMSNIPPET')) die; ?>
<!DOCTYPE html>
<html lang="en-US">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="<?php echo htmlspecialchars(APP_ROOT); ?>css/style.css">
    <link rel="stylesheet" href="<?php echo htmlspecialchars(APP_ROOT); ?>css/cookieconsent.min.css">
    <title><?php echo htmlspecialchars((isset($page_title) && $page_title) ? "$page_title - AdmSnippet" : "AdmSnippet") ?></title>
    <meta name="description" content="<?php echo htmlspecialchars((isset($page_description) && $page_description) ? $page_description : "AdmSnippet is a database of user-submitted server administration scripts and configuration files, which allows server administrators to easily find scripts for their server administration needs.") ?>">
    <meta name="og:title" content=" <?php echo htmlspecialchars((isset($page_title) && $page_title) ? "$page_title - AdmSnippet" : "AdmSnippet") ?>">
    <meta name="og:description" content="<?php echo htmlspecialchars((isset($page_description) && $page_description) ? $page_description : "AdmSnippet is a database of user-submitted server administration scripts and configuration files, which allows server administrators to easily find scripts for their server administration needs.") ?>">
    <meta name="og:url" content="<?php echo htmlspecialchars((isset($_SERVER['HTTPS']) ? 'https://' : 'http://') . (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : (isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : 'localhost')) . $_SERVER['REQUEST_URI']); ?>">
    <meta name="og:image" content="<?php echo htmlspecialchars((isset($_SERVER['HTTPS']) ? 'https://' : 'http://') . (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : (isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : 'localhost')) . APP_ROOT . 'img/cover.png'); ?>">
    <meta name="og:image:width" content="1920">
    <meta name="og:image:height" content="1080">
    <meta name="og:image:alt" content="<?php echo htmlspecialchars((isset($page_title) && $page_title) ? "$page_title - AdmSnippet" : "AdmSnippet") ?>">
    <meta name="twitter:card" content="summary_large_image">
    <meta name="twitter:title" content=" <?php echo htmlspecialchars((isset($page_title) && $page_title) ? "$page_title - AdmSnippet" : "AdmSnippet") ?>">
    <meta name="twitter:description" content="<?php echo htmlspecialchars((isset($page_description) && $page_description) ? $page_description : "AdmSnippet is a database of user-submitted server administration scripts and configuration files, which allows server administrators to easily find scripts for their server administration needs.") ?>">
    <meta name="twitter:image" content="<?php echo htmlspecialchars((isset($_SERVER['HTTPS']) ? 'https://' : 'http://') . (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : (isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : 'localhost')) . APP_ROOT . 'img/cover.png'); ?>">
    <script src="<?php echo htmlspecialchars(APP_ROOT . 'js/analytics.js'); ?>"></script>
</head>
<body>
    <header>
        <div class="container">
            <span class="header-sitename"><a href="/admsnippets/">AdmSnippet</a></span>
            <nav>
               <ul>
                    <?php
                      echo '<li><a href="' . htmlspecialchars(APP_ROOT) . 'explore.php">Explore</a></li>';
                      if ($user == -1) {
                        echo '<li><a href="' . htmlspecialchars(APP_ROOT) . 'login.php?redirect=' . htmlspecialchars(urlencode($_SERVER['REQUEST_URI'])) . '">Login</a></li>';
                        echo '<li><a href="' . htmlspecialchars(APP_ROOT) . 'register.php?redirect=' . htmlspecialchars(urlencode($_SERVER['REQUEST_URI'])) . '">Register</a></li>';
                      } else {
                        echo '<li><a href="' . htmlspecialchars(APP_ROOT) . 'submit.php">Submit</a></li>';
                        echo '<li><a href="' . htmlspecialchars(APP_ROOT) . 'user.php?id=' . htmlspecialchars(urlencode($user)) . '">Profile</a></li>';
                        echo '<li><form action="' . htmlspecialchars(APP_ROOT) . 'logout.php?redirect=' . htmlspecialchars(urlencode($_SERVER['REQUEST_URI'])) . '" method="post">
                                <input type="hidden" name="csrf" value="' . htmlspecialchars($csrf_token) . '">
                                <input type="submit" value="Logout">
                              </form></li>
                        ';
                      }
                    ?>
               </ul>
            </nav>
        </div>
    </header>
setup.php
wget 'https://sme10.lists2.roe3.org/admsnippets/includes/setup.php'
View Content
<?php
/*
 Set session options before starting the session
ini_set('session.cookie_httponly', 1);
ini_set('session.cookie_secure', isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ? 1 : 0);

// Start the session
session_start();
*/
  if (!defined('ADMSNIPPET')) die;

  if (!version_compare(phpversion(), '5.5', '>=')) {
    die("PHP version not supported.");
  }
  
  mysqli_report(MYSQLI_REPORT_OFF);
  $db = mysqli_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASS, MYSQL_DB) or die("Cannot connect to the database!");

session_start(['cookie_httponly' => true,'cookie_secure' => isset($_SERVER['HTTPS']),]) or die("Can't start session!");

  $csrf_token = "";
  if (isset($_SESSION['csrf'])) {
    $csrf_token = $_SESSION['csrf'];
  } else {
    if (function_exists('random_bytes')) {
      $csrf_token = bin2hex(random_bytes(32));
    } else {
      $csrf_token = '';
      for ($i = 0; $i < 32; $i++) {
        $csrf_token = $csrf_token . bin2hex(rand(0,255));
      }
    }
    $_SESSION['csrf'] = $csrf_token;
  }

  $user = -1;
  if (isset($_SESSION['user'])) {
    $usercheckstmt = mysqli_prepare($db, 'SELECT * FROM users WHERE id = ?;');
    if ($usercheckstmt) {
      mysqli_stmt_bind_param($usercheckstmt, 'i', $_SESSION['user']);
      mysqli_stmt_execute($usercheckstmt);
      mysqli_stmt_store_result($usercheckstmt);
      if (mysqli_stmt_num_rows($usercheckstmt) > 0) {
        $user = $_SESSION['user'];
      }
      mysqli_stmt_close($usercheckstmt);
    }
    unset($usercheckstmt);
  }
  if ($user == -1) {
    unset($_SESSION['user']);
  }

  $highlight_code = false;
?>