Пример #1
0
function setParent()
{
    if (isset($_POST["parent"])) {
        if ($_POST["parent"] != TINYIB_NEWTHREAD) {
            if (!threadExistsByID($_POST['parent'])) {
                fancyDie("Invalid parent thread ID supplied, unable to create post.");
            }
            return $_POST["parent"];
        }
    }
    return TINYIB_NEWTHREAD;
}
Пример #2
0
// Check if the request is to make a post
if (isset($_POST["message"]) || isset($_POST["file"])) {
    $ban = banByIP($_SERVER['REMOTE_ADDR']);
    if ($ban) {
        if ($ban['expire'] == 0 || $ban['expire'] > time()) {
            $expire = $ban['expire'] > 0 ? 'Your ban will expire ' . date('y/m/d(D)H:i:s', $ban['expire']) : 'The ban on your IP address is permanent and will not expire.';
            $reason = $ban['reason'] == '' ? '' : '<br>The reason provided was: ' . $ban['reason'];
            fancyDie('Sorry, it appears that you have been banned from posting on this image board.  ' . $expire . $reason);
        } else {
            clearExpiredBans();
        }
    }
    $parent = "0";
    if (isset($_POST["parent"])) {
        if ($_POST["parent"] != "0") {
            if (!threadExistsByID($_POST['parent'])) {
                fancyDie("Invalid parent thread ID supplied, unable to create post.");
            }
            $parent = $_POST["parent"];
        }
    }
    $lastpost = lastPostByIP();
    if ($lastpost) {
        if (time() - $lastpost['timestamp'] < 30) {
            fancyDie("Please wait a moment before posting again.  You will be able to make another post in " . (30 - (time() - $lastpost['timestamp'])) . " seconds.");
        }
    }
    if (strlen($_POST["message"]) > 8000) {
        fancyDie("Please shorten your message, or post it in multiple parts. Your message is " . strlen($_POST["message"]) . " characters long, and the maximum allowed is 8000.");
    }
    $post = newPost();