3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php ini_set('display_errors', 'On'); error_reporting(E_ALL); $time = microtime(); $time = explode(' ', $time); $time = $time[1] + $time[0]; $start = $time; session_start(); include 'connect.php'; $noBlogPostsFound = FALSE; // Connect to MySQLi $sqli = mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME) or die("Error: ".mysqli_error($sqli)); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } if (!isset($_GET['page']) || !is_numeric($_GET['page']) || ($_GET['page'] < 0)) { $page = 0; } else { $page = (int)$_GET['start']; } $limit = 3; $start = $page * $limit; $query = mysqli_query($sqli, "SELECT * FROM blog ORDER BY timestamp DESC LIMIT $start, $limit") or die("Error: ".mysqli_error($sqli)); $checknumblogs = mysqli_num_rows($query); // Check if any blog posts exists if($checknumblogs == 0) { $noBlogPostsFound = TRUE; } else { $blogposts = array(); while ($row = mysqli_fetch_array($query)) { $userid = $row['userid']; $userquery = mysqli_query($sqli, "SELECT * FROM members WHERE id='$userid'") or die("Error: ".mysqli_error($sqli)); $userexists = mysqli_num_rows($userquery); if ($userexists == 0) { $username = "<deleted user>"; } else { $userrow = mysqli_fetch_assoc($userquery); $username = $userrow['username']; } $blogposts[] = array( "id" => $row['id'], "headline" => $row['headline'], "story" => $row['story'], "timestamp" => $row['timestamp'], "userid" => $row['userid'], "username" => $username ); } } $totalquery = mysqli_query($sqli, "SELECT * FROM blog") or die("Error: ".mysqli_error($sqli)); $totalblogposts = mysqli_num_rows($totalquery); //TOPINFOTEXT $textquery = mysqli_query($sqli, "SELECT * FROM toptext ORDER BY id") or die("Error: ".mysqli_error($sqli)); $textresult = mysqli_fetch_assoc($textquery); ?> <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" /> <title>indiehjaerta.com ♥ Blog</title> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <!-- Font's --> <link href='http://fonts.googleapis.com/css?family=Oswald' rel='stylesheet' type='text/css'> <link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,300,400' rel='stylesheet' type='text/css'> <link href='http://fonts.googleapis.com/css?family=Roboto:300,300italic' rel='stylesheet' type='text/css'> <link href="stylesheet/style.css" rel="stylesheet" type="text/css" /> <link href="stylesheet/blog.css" rel="stylesheet" type="text/css" /> </head> <body> <script type="text/javascript"> $(function() { $('#TopBarLogin').click(function() { $('#LoginPopUp').show(); return false; }); }); </script> <script type="text/javascript"> $(document).mouseup(function (e) { var container = $("#LoginPopUp"); if (!container.is(e.target) && container.has(e.target).length === 0) { container.hide(); } }); </script> <script type="text/javascript"> $(function() { if (navigator.userAgent.toLowerCase().indexOf("chrome") >= 0) { var intervalId = 0; $(window).load(function() { intervalId = setInterval(function () { // << somehow this does the trick! if ($('input:-webkit-autofill').length > 0) { clearInterval(intervalId); $('input:-webkit-autofill').each(function () { var text = $(this).val(); var name = $(this).attr('name'); $(this).after(this.outerHTML).remove(); $('input[name=' + name + ']').val(text); }); } }, 1); }); } }); </script> <div id="TopBarImageContainer"> <div id="TopBarImage"></div> </div> <div id="MainContent"> <!-- NOT LOGGED IN HERE --> <a href="#"> <span class="DivLink"> <div id="TopBarLogin"> <span class="TopBarText">LOGIN <div id="TopBarTriangleDown"></div> </span> </div> </span> </a> <a href="register.php"> <span class="DivLink"> <div id="TopBarCreateAccount"> <span class="TopBarText">CREATE AN ACCOUNT</span> </div> </span> </a> <div id="TopBarUserMenu"> <div id="TopBarUserMenuProfile"> <a href="profile.php"> <span class="TopBarText"> <div id="TopBarUserMenuProfileImage"></div> <span class="DivLink"> PROFILE </span> </span> </a> </div> <div id="TopBarUserMenuMessages"> <a href="messages.php"> <span class="TopBarText"> <div id="TopBarUserMenuMessagesImage"></div> <span class="DivLink"> MESSAGES </span> </span> </a> </div> <div id="TopBarUserMenuSupport"> <a href="support.php"> <span class="TopBarText"> <div id="TopBarUserMenuSupportImage"></div> <span class="DivLink"> SUPPORT </span> </span> </a> </div> </div> <div id="LoginPopUp"> <form method="post" action=""> <input name="username" type="text" id="username" placeholder="Username" style="display: none" /> <input name="password" type="password" id="password" placeholder="Password" style="display: none" /> <input class="LoginInput" name="username" type="text" id="username" placeholder="Username" /><br /> <input class="LoginInput" name="password" type="password" id="password" placeholder="Password" /><br /> <input class="LoginButton" type="submit" name="login" value=""> </form> </div> <div id="LogoMenu"> <div id="SocialTopLinks"> <div id="SocialTopTwitterLink"> <a href="http://www.twitter.com/indiehjaerta"> <span class="DivLink"></span> </a> </div> <div id="SocialTopFacebookLink"> <a href="http://www.facebook.com/indiehjaerta"> <span class="DivLink"></span> </a> </div> <div id="SocialTopInstagramLink"> <a href="http://www.instagram.com/indiehjaerta"> <span class="DivLink"></span> </a> </div> <div id="SocialTopTwitchLink"> <a href="http://www.twitch.tv/indiehjaerta"> <span class="DivLink"></span> </a> </div> </div> <div id="TopLogo"> <a href="#"><span class="DivLink"></span></a> </div> <div id="MenuLinkSeparator"></div> <div id="MenuLinks"> <a href="" class="Menu">HOME</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="news.php" class="Menu">NEWS</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="blog.php" class="Menu">BLOG</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="events.php" class="Menu">EVENTS</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="forums.php" class="Menu">FORUMS</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="" class="Menu">CONTACT</a> </div> </div> <div id="Container"> <div id="InfoHeader"></div> <div id="Content"> <div id="BlogContent"> <?php //WRITE OUT IF NO BLOG POSTS FOUND! $counter = 0; foreach ($blogposts as $post) { $counter++; ?> <span class="BlogPostHeadlineList"><a href="?id=<?php echo $post['id'] ?>"><?php echo strtoupper($post['headline']) ?></a></span><br /> <span class="BlogPostInfoList">posted by <a href="profile.php?id=<?php echo $post['userid'] ?>"><?php echo $post['username'] ?></a> at <?php echo $post['timestamp'] ?></span><br /> <div id="BlogContentText"> <span class="BlogPostTextList"><?php echo $post['story'] ?></span><br /> </div> <div class="BlogButtonContainer"> <a href="<?php echo $_SERVER['PHP_SELF'].'?id='.$post['id'] ?>"><img src="images/buttonreadmore.png" class="ButtonReadMore" /></a> <a href="<?php echo $_SERVER['PHP_SELF'].'?id='.$post['id']. '#comments' ?>"><img src="images/buttoncomments.png" class="ButtonComment" /></a> </div> <?php if ($counter < $limit) { //RENAME BELOW ?> <img src="images/separator-horizontal-long.png" id="BlogSeparatorHorizontal" /><br /> <?php } } ?> </div> <div id="BlogLinks"> <span class="BlogNavigationLink"> <?php if ($page > 0) { $prev = $start - $limit; echo '<a href="'.$_SERVER['PHP_SELF'].'?page='.$prev.'" class="BlogNavigationLink">« Newer posts</a> '; } else { echo '« Newer posts '; } $maxpages = $totalblogposts/$limit; if ($page < $maxpages) { echo '<a href="'.$_SERVER['PHP_SELF'].'?page='.().'" class="BlogNavigationLink">Older Posts »</a>'; } else { echo 'Older Posts »'; } ?> </span> </div> <div id="NewsLetterBanner"> </div> </div> <div id="Bot"> <div id="BotLogo"> <a href="#"><span class="DivLink"></span></a> </div> </div> </div> </body> </html>
Output for 5.3.0 - 5.4.30
Parse error: syntax error, unexpected ')' in /in/EsYr4 on line 326
Process exited with code 255.