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`).

change-lang.php
wget 'https://lists2.roe3.org/mdrone/hangman/inc/change-lang.php'
View Content
<?php 

require_once dirname(__DIR__) . '/bootstrap.php';

if (isset($_POST['lang']) && $_POST['lang'] == 'it') {
    $_SESSION['lang'] = 'it';
} else {
    $_SESSION['lang'] = 'en';
}

echo json_encode($_SESSION['lang']);
check-letter.php
wget 'https://lists2.roe3.org/mdrone/hangman/inc/check-letter.php'
View Content
<?php

if (isset($_POST['l'])) {

    $response = [];

    $tries = (int) $_POST['tries'];
    $lines = json_decode($_POST['lines']);
    $word = $_SESSION['word'];

    $letter = mb_strtoupper($_POST['letter']);
    // $letter = $_POST['letter'];

    if (mb_strlen($letter) != 1) {
        echo '<script> alert(LANG["insert one letter"][lang]); </script>';
    }

    $pos = strpos($word, $letter);
    if ($pos !== FALSE) {
        while ($pos !== FALSE) {
            $lines[$pos] = $letter;
            $pos = strpos($word, $letter, $pos + 1);
        }
    } else {
        $tries--;
    }

    $response = 
    [
        'tries' => $tries,
        'lines' => $lines,
        'word' => $word,
    ];

    if ($tries == 0) {
        $tryToGuess_or_hanged_msg = $trans['you were hanged'][$lang];
        $wordToGuess_or_wordWas_msg = $trans['word was'][$lang];
        session_destroy();
        $sentences = [
            'tryToGuess_or_hanged_msg' => $tryToGuess_or_hanged_msg,
            'wordToGuess_or_wordWas_msg' => $wordToGuess_or_wordWas_msg,
            'word' => $word,
        ];
        $response = array_merge($response, $sentences);
    } 

    echo json_encode($response);
}
createarray.php
wget 'https://lists2.roe3.org/mdrone/hangman/inc/createarray.php'
View Content
<?php

require_once dirname(__DIR__) . '/bootstrap.php';

if ($lang == 'it') {
    $fileTxt = '60000_parole_italiane.txt';
} else {
    $fileTxt = '60000_english_words.txt';
}

$words = file($fileTxt, FILE_IGNORE_NEW_LINES);
$i = rand(0, (count($words)) - 1);

$word =  $words[$i];
$word = mb_strtoupper($word);
$letterCount = mb_strlen($word);
$arrayWord = array();


for ($i = 0; $i < $letterCount; $i++) {
  
    $arrayWord[$i] = mb_substr($word, $i);
 
}

$lines = array();
for ($i = 0; $i < $letterCount; $i++) {
  $lines[$i] = "_";
}

$_SESSION["word"] = $word;
$_SESSION["lines"] = $lines;
$_SESSION["arrayWord"] = $arrayWord;
$_SESSION["letterCount"] = $letterCount;
$_SESSION["tries"] = 8;
$_SESSION["player"] = $trans['player one'][$lang];
insert-word.php
wget 'https://lists2.roe3.org/mdrone/hangman/inc/insert-word.php'
View Content
<?php 


if (isset($_POST['ins'])) {

    $word = $_POST['word'] ?? '';

    if (
        strpos($word, ' ') !== false
        || !$word
        || preg_match('/[\'^£$%&*()}§{@#~?><>,|=_+¬-]/', $word)
        || preg_match('~[0-9]+~', $word)
    ) {
        echo json_encode(['status' => 'error', 'message' => $trans['insert a word with letter only'][$lang]]);
    } else {
        $word = mb_strtoupper($word);
        $letterCount = mb_strlen($word);
        $letterCount2 = mb_strlen($word);
        $arrayWord = array();

        for ($i = 0; $i < $letterCount; $i++) {
            $arrayWord[$i] = mb_substr($word, $i);
        }

        $lines = array();
        for ($i = 0; $i < $letterCount; $i++) {
            $lines[$i] = "_";
        }

        $tries = 0;
        $_SESSION["word"] = $word;
        $_SESSION["lines"] = $lines;
        $_SESSION["arrayWord"] = $arrayWord;
        $_SESSION["letterCount"] = $letterCount;
        $_SESSION["tries"] = 8;
        $_SESSION["player"] = $trans['player two'][$lang];

        echo json_encode(['status' => 'success']);
    }
} else {
    http_response_code(404);
    die();
}
translation.php
wget 'https://lists2.roe3.org/mdrone/hangman/inc/translation.php'
View Content
<?php 

// Set array for translation
$trans = array(
    'title' => array(
        'en' => 'Hangman',
        'it' => 'Impiccato'
    ),
    'one player' => array(
        'en' => 'single player',
        'it' => 'un giocatore'
    ),
    'two players' => array(
        'en' => 'two players',
        'it' => 'due giocatori'
    ),
    'play' => array(
        'en' => 'Play',
        'it' => 'Gioca'
    ),
    'player' => array(
        'en' => 'Player',
        'it' => 'Giocatore'
    ),
    'player one' => array(
        'en' => 'Player One',
        'it' => 'Giocatore Uno'
    ),
    'player two' => array(
        'en' => 'Player Two',
        'it' => 'Giocatore Due'
    ),
    'back' => array(
        'en' => 'Back',
        'it' => 'Indietro'
    ),
    'insert' => array(
        'en' => 'Insert',
        'it' => 'Inserisci'
    ),
    'insert_player' => array(
        'en' => 'Insert player',
        'it' => 'Inserisci giocatore'
    ),
    'The Hangman' => array(
        'en' => 'The Hangman',
        'it' => 'L\'Impiccato'
    ),
    'insert one letter' => array(
        'en' => 'Isert just one letter',
        'it' => 'Inserisci una sola lettera'
    ),
    'word to guess' => array(
        'en' => 'The word to guess is:',
        'it' => 'La parola da indovinare è:'
    ),
    'word was' => array(
        'en' => 'The word was:',
        'it' => 'La parola era:'
    ),
    'try to guess' => array(
        'en' => 'Try to guess, letter by letter, the secret word before you get hanged!',
        'it' => 'Prova ad indovinare, lettera dopo lettera, la parola segreta prima di essere impiccato!'
    ),
    'insert and try' => array(
        'en' => 'Insert a letter and try!',
        'it' => 'Scrivi una lettera e prova!'
    ),
    'insert letter only' => array(
        'en' => 'Please insert a letter only, not a number or a special character.',
        'it' => 'Per favore inserisci una lettera, non un numero o un carattere speciale.'
    ),
    'insert a word with letter only' => array(
        'en' => 'Please insert a word without spaces, numbers or a special character.',
        'it' => 'Per favore inserisci una parola senza spazi, numeri o caratteri speciali.'
    ),
    'try' => array(
        'en' => 'TRY',
        'it' => 'PROVA'
    ),
    'tries' => array(
        'en' => 'tries:',
        'it' => 'tries:'
    ),
    'you lose' => array(
        'en' => 'You Lose!',
        'it' => 'Hai Perso!'
    ),
    'you win' => array(
        'en' => 'You Win!',
        'it' => 'Hai Vinto!'
    ),
    'play again' => array(
        'en' => 'PLAY AGAIN',
        'it' => 'GIOCA ANCORA'
    ),
    'insert word to guess' => array(
        'en' => 'Insert the word<br>the opponent will have to guess!<br><small>(4 chars min.)</small>',
        'it' => 'Inserisci la parola<br>che lo sfidante dovrà indovinare!<br><small>(min. 4 lettere)</small>'
    ),
    'write here word' => array(
        'en' => 'Write here your word',
        'it' => 'Scrivi qui la parola'
    ),
    'you were hanged' => array(
        'en' => 'Sorry, you have been hanged!',
        'it' => 'Mi dispiace, sei stato impiccato!'
    ),

);