3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php if (isset($_POST['add'])) { if (isset($_GET['news']) && $_GET['news'] == 'add') { $savePost = TRUE; $emptyStory = FALSE; $emptyHeadLine = FALSE; $cutoffheadlineNotNumeric = FALSE; $cutoffNotNumeric = FALSE; $story = mysqli_real_escape_string($sqli, $_POST['story']); $headline = mysqli_real_escape_string($sqli, $_POST['headline']); $thumbnail = mysqli_real_escape_string($sqli, $_POST['thumbnail']); $cutoffheadline = mysqli_real_escape_string($sqli, $_POST['cutoffheadline']); $cutoff = mysqli_real_escape_string($sqli, $_POST['cutoff']); $timestamp = date('Y-m-d H:i:s'); $userid = $_SESSION['id']; if (empty($story)) { $emptyStory = TRUE; $savePost = FALSE; } elseif (empty($headline)) { $emptyHeadLine = TRUE; $savePost = FALSE; } elseif (!is_numeric($cutoffheadline)) { $cutoffheadlineNotNumeric = TRUE; $savePost = FALSE; } elseif (!is_numeric($cutoff)) { $cutoffNotNumeric = TRUE; $savePost = FALSE; } if ($savePost == TRUE) { $query = mysqli_query($sqli,"INSERT INTO news (`headline`, `story`, `thumbnail`, `userid`, `timestamp`, `cutoffpointheadline`, `cutoffpoint`) VALUES ('$headline', '$story', '$thumbnail', '$userid', '$timestamp', '$cutoffheadline', '$cutoff')"); header("location:admin.php?news=added"); } } elseif (isset($_GET['blog']) && $_GET['blog'] == 'add') { $savePost = TRUE; $emptyStory = FALSE; $emptyHeadLine = FALSE; $cutoffheadlineNotNumeric = FALSE; $cutoffNotNumeric = FALSE; $story = mysqli_real_escape_string($sqli, $_POST['story']); $headline = mysqli_real_escape_string($sqli, $_POST['headline']); $cutoffheadline = mysqli_real_escape_string($sqli, $_POST['cutoffheadline']); $cutoff = mysqli_real_escape_string($sqli, $_POST['cutoff']); $timestamp = date('Y-m-d H:i:s'); $userid = $_SESSION['id']; if (empty($story)) { $emptyStory = TRUE; $savePost = FALSE; } elseif (empty($headline)) { $emptyHeadLine = TRUE; $savePost = FALSE; } elseif (!is_numeric($cutoffheadline)) { $cutoffheadlineNotNumeric = TRUE; $savePost = FALSE; } elseif (!is_numeric($cutoff)) { $cutoffNotNumeric = TRUE; $savePost = FALSE; } if ($savePost == TRUE) { $query = mysqli_query($sqli,"INSERT INTO blog (`headline`, `story`, `thumbnail`, `userid`, `timestamp`, `cutoffpointheadline`, `cutoffpoint`) VALUES ('$headline', '$story', '$userid', '$timestamp', '$cutoffheadline', '$cutoff')"); header("location:admin.php?blog=added"); } } elseif (isset($_GET['events']) && $_GET['events'] == 'add') { $savePost = TRUE; $emptyFullName = FALSE; $emptyShortName = FALSE; $emptyDescription = FALSE; $emptyPicture = FALSE; $fullname = mysqli_real_escape_string($sqli, $_POST['fullname']); $shortname = mysqli_real_escape_string($sqli, $_POST['shortname']); $description = mysqli_real_escape_string($sqli, $_POST['description']); $game = mysqli_real_escape_string($sqli, $_POST['game']); $picture = mysqli_real_escape_string($sqli, $_POST['picture']); $giveaway = mysqli_real_escape_string($sqli, $_POST['giveaway']); $giveawaytype = mysqli_real_escape_string($sqli, $_POST['giveawaytype']); //Can be empty? $facebooklink = ''; $timestamp = '0000-00-00 00:00:00'; $userid = $_SESSION['id']; if (empty($fullname)) { $emptyFullName = TRUE; $savePost = FALSE; } elseif (empty($shortname)) { $emptyShortName = TRUE; $savePost = FALSE; } elseif (empty($description)) { $emptyDescription = TRUE; $savePost = FALSE; } elseif (empty($game)) { $game = 'Not set'; } elseif (empty($picture)) { $picture = ''; //Standard picture } if ($savePost == TRUE) { $query = mysqli_query($sqli,"INSERT INTO blog (`userid`, `name`, `calendarname`, `text`, `game`, `giveaway`, `giveawaytype`, `timestamp`, `picturethumbnail`, `picturecalendar`, `facebooklink`) VALUES ('$userid', '$fullname', '$shortname', '$text', '$game', '$giveaway', '$giveawaytype', '$timestamp', '$picture', '$picture', '$facebooklink')"); header("location:admin.php?events=added"); } } } if (isset($_POST['update']) { if (isset($_GET['news']) && $_GET['news'] == 'edit' && isset($_GET['id']) && is_numeric($_GET['id'])) { $id = mysqli_real_escape_string($sqli, $_POST['id']); } else if (isset($_GET['blog']) && $_GET['blog'] == 'edit' && isset($_GET['id']) && is_numeric($_GET['id'])) { $id = mysqli_real_escape_string($sqli, $_POST['id']); } else if (isset($_GET['events']) && $_GET['events'] == 'edit' && isset($_GET['id']) && is_numeric($_GET['id'])) { $id = mysqli_real_escape_string($sqli, $_POST['id']); } else if (isset($_GET['members']) && $_GET['members'] == 'edit' && isset($_GET['id']) && is_numeric($_GET['id'])) { $id = mysqli_real_escape_string($sqli, $_POST['id']); } } ?>
based on gVY5u
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.4.31
Parse error: syntax error, unexpected '{' in /in/vtLM8 on line 148
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected '{' in /in/vtLM8 on line 148
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/vtLM8 on line 148
Process exited with code 255.