#💬 arox_xtʹs Feedback

1 messages · Page 1 of 1 (latest)

whole larkBOT
pure bridge
#

Nerd stuff
I made a database in my webspace that handles a request from the roblox client - it asks if there is a word in the database and if it is expired
if the word is expired it requests a new word and inserts that in the database for all clients to see so everybody has the same at all times

Code for my webspace

<?php

require __DIR__ . "/database.php";

function generateNewWord() {
    global $conn;
    $wordListFile = __DIR__ . "/wordlist.txt";
    $words = file($wordListFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
    $randomWord = $words[array_rand($words)];
    $expirationDate = date('Y-m-d H:i:s', strtotime('+24 hours'));
    $insertSql = "INSERT INTO Roblox_Wordle_Game (Chosen_Word, Expiration_Date) VALUES (?, ?)";
    $stmt = $conn->prepare($insertSql);
    $stmt->bind_param("ss", $randomWord, $expirationDate);
    if($stmt->execute()) {
        return $randomWord;
    } else {
        return false;
    }
}

function getWord() {
    global $conn;
    $sql = "SELECT Chosen_Word, Expiration_Date FROM Roblox_Wordle_Game ORDER BY id DESC LIMIT 1";
    $result = $conn->query($sql);
    if ($result->num_rows > 0) {
        $row = $result->fetch_assoc();
        $expirationDate = strtotime($row["Expiration_Date"]);
        $currentDate = time();
        if ($currentDate > $expirationDate) {
            return generateNewWord();
        } else {
            return $row["Chosen_Word"];
        }
    } else {
        return generateNewWord();
    }
}

if ($_SERVER["REQUEST_METHOD"] === "GET") {
    $word = getWord();
    echo $word;
} else {
    http_response_code(405);
}

?>

then in roblox there is just an http request to my website and thats all

bitter python
#

php

#

that seems like a few more letters than regular wordle

pure bridge
#

there is everything from 2 to 8 letters

#

thought it would be fun to just use more variaty

pulsar flower
#

Damn bro you're good at wordle 3 guesses for a work like payslips

pure bridge
pulsar flower
#

oh