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(); require 'connect.php'; require 'functions.php'; // 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(); } //FORUMS $limit = 5; $forumquery = mysqli_query($sqli, "SELECT * FROM forumtopics ORDER BY lastpost DESC LIMIT 0, $limit") or die("Error: ".mysqli_error($sqli)); $forumposts = array(); while ($row = mysqli_fetch_array($forumquery)) { $uid = $row['lastpostuserid']; $userquery = mysqli_query($sqli, "SELECT * FROM members WHERE id='$uid'") 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']; } $forumposts[] = array( "id" => $row['id'], "threadname" => $row['threadname'], "text" => $row['text'], "lastpost" => $row['lastpost'], "userid" => $row['userid'], "username" => $username, "categoryid" => $row['categoryid'] ); } //EVENT $limit = 1; $eventquery = mysqli_query($sqli, "SELECT * FROM events ORDER BY id DESC LIMIT 0, $limit") or die("Error: ".mysqli_error($sqli)); $events = array(); $counter = 0; while ($row = mysqli_fetch_array($eventquery)) { $events[] = array( "id" => $row['id'], "name" => $row['name'], "timestamp" => $row['timestamp'], "picturethumbnail" => $row['picturethumbnail'] ); } //TOPINFOTEXT $textquery = mysqli_query($sqli, "SELECT * FROM toptext ORDER BY id") or die("Error: ".mysqli_error($sqli)); $textresult = mysqli_fetch_assoc($textquery); if (isset($_GET['m']) && is_numeric($_GET['m'])) { if (($_GET['m'] >= 1) && ($_GET['m'] <= 12)) { $month = $_GET['m']; } else { $month = date('n'); } } else { $month = date('n'); } if (isset($_GET['y']) && is_numeric($_GET['y'])) { if (($_GET['y'] > 2010) && ($_GET['y'] < 2020)) { $year = $_GET['y']; } else { $year = date('Y'); } } else { $year = date('Y'); } $startdate = strtotime('01-' .str_pad($month, 2, '0', STR_PAD_LEFT). '-' .$year); $enddate = strtotime(date('t',mktime(0,0,0,$month,1,$year)).'-' .str_pad($month, 2, '0', STR_PAD_LEFT). '-' .$year ; $eventsquery = mysqli_query($sqli, SELECT * "FROM events WHERE timestamp >= '$startdate' AND timestamp <= '$enddate'") or die("Error: ".mysqli_error($sqli)); $numEvents = mysqli_num_rows($eventsquery); ?> <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" /> <title>indiehjaerta.com ♥</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:400,300' 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/events.css" rel="stylesheet" type="text/css" /> <link href="stylesheet/calendar.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"> <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="TopLoginInput" name="username" type="text" id="username" placeholder="Username" /><br /> <input class="TopLoginInput" name="password" type="password" id="password" placeholder="Password" /><br /> <input class="TopLoginButton" 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="SocialTopYouTubeLink"> <a href="https://www.youtube.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="default.php"><span class="DivLink"></span></a> </div> <div id="MenuLinkSeparator"></div> <div id="MenuLinks"> <a href="default.php" class="Menu">HOME</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="about.php" class="Menu">ABOUT</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="blog.php" class="Menu">BLOG</a> &nbsp;&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; <a href="contact.php" class="Menu">CONTACT</a> </div> </div> <div id="Container"> <div id="InfoHeader"> <span class="TopInfoText"><?php echo $textresult['text']?></span> </div> <div id="Content"> <div id="EventsContent"> <span class="EventsHeadline">EVENTS</span> <br/> <?php $calendar = '<div id="CalendarHeadline">'; $prevmonth = ($month == 1?12:$month-1); $tempyear = ($month == 1?$year-1:$year); $calendar.= '<div id="CalendarLinkPrev"><a href="?m=' .$prevmonth. '&y=' .$tempyear. '" class="CalendarMonthLink">« ' .date('F', mktime(0, 0, 0, $prevmonth, 10)). '</a></div>'; $calendar.= '<div id="CalendarMonth"><span class="CalendarMonthName">' .date('F', mktime(0, 0, 0, $month, 10)). '<br />' .$year. '</span></div>'; $nextmonth = ($month == 12?1:$month+1); $tempyear = ($month == 12?$year+1:$year); $calendar.= '<div id="CalendarLinkNext"><a href="?m=' .$nextmonth. '&y=' .$tempyear. '" class="CalendarMonthLink">' .date('F', mktime(0, 0, 0, $nextmonth, 10)). ' »</a></div>'; $calendar.= '</div>'; $calendar.= '<div class="CalendarFloatClear"></div>' ."\n"; /* table headings */ $headings = array('Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'); $calendar.= '<div class="CalendarColumn"><span class="CalendarDayName">'.implode('</span></div>' ."\n" . '<div class="CalendarColumn"><span class="CalendarDayName">',$headings).'</span></div>' ."\n". '<div class="CalendarFloatClear"></div>' ."\n\n"; /* days and weeks vars now ... */ $running_day = date('w',mktime(0,0,0,$month,1,$year)); $running_day = ($running_day == 0?6:$running_day-1); $days_in_month = date('t',mktime(0,0,0,$month,1,$year)); $days_in_this_week = 1; $day_counter = 0; $dates_array = array(); /* print "blank" days until the first of the current week */ for($x = 0; $x < $running_day; $x++): $calendar.= '<div class="CalendarColumnEmpty"> </div>' ."\n"; $days_in_this_week++; endfor; /* keep going with days.... */ for($list_day = 1; $list_day <= $days_in_month; $list_day++): //if($list_day == $today && $month == $nowmonth && $year == $nowyear) $calendar.= '<div class="CalendarColumn">'; /* add in the day number */ $calendar.= '<div class="CalendarDayNumber">' .$list_day. '</div>'; /** QUERY THE DATABASE FOR AN ENTRY FOR THIS DAY !! IF MATCHES FOUND, PRINT THEM !! **/ $calendar.= str_repeat('<p> </p>',2); $calendar.= '</div>' ."\n"; if($running_day == 6): $calendar.= '<div class="CalendarFloatClear"></div>' ."\n"; if(($day_counter+1) != $days_in_month): $calendar.= ''; endif; $running_day = -1; $days_in_this_week = 0; endif; $days_in_this_week++; $running_day++; $day_counter++; endfor; /* finish the rest of the days in the week */ if($days_in_this_week < 8 && $days_in_this_week > 1): for($x = 1; $x <= (8 - $days_in_this_week); $x++): $calendar.= '<div class="CalendarColumnEmpty"> </div>' ."\n"; endfor; endif; echo $calendar; echo $numEvents. ' in current month'; ?> </div> </div> <div id="NewsLetterBanner"> </div> <div id="SiteInfoContainer"> <div id="ForumPostsContainer"> <img src="images/icon-forum-large.png" class="ForumPostsIcon" /> <span class="ForumPostsText">FORUM POSTS</span><br /> <?php $counter = 0; foreach ($forumposts as $posts) { $counter++; $dateandtime = getdate(strtotime($posts['lastpost'])); $min = $dateandtime['minutes']; $hr = $dateandtime['hours']; $d = $dateandtime['mday']; $m = $dateandtime['mon']; $y = $dateandtime['year']; $hr = str_pad($hr, 2, '0', STR_PAD_LEFT); $min = str_pad($min, 2, '0', STR_PAD_LEFT); $monthName = date("F", mktime(0, 0, 0, $m, 10)); $ordinaldate = ordinal($d); ?> <div class="ForumPostContainer"> <a href="forums.php?fid=<?php echo $posts['categoryid'] ?>&tid=<?php echo $posts['id'] ?>" class="FrontpageForumLink"><?php echo $posts['threadname'] ?></a> <span class="ForumPostInfo"> <?php echo 'posted by <a href="profile.php?id=' .$posts['userid']. '">' .$posts['username']. '</a> at ' .$hr. ':' .$min. ' on ' .$monthName. ' ' .$ordinaldate. ', ' .$y; ?> </span> </div> <?php if ($counter != 5) { ?> <img src="images/forumpostsseparator.png" class="ForumPostsSeparator" /> <?php } } ?> </div> <img src="images/shortseparator2.png" class="ShortSeparator" /> <div id="EventContainer"> <img src="images/icon-calendar-large.png" class="EventsIcon" /> <span class="ForumPostsText">UPCOMING EVENT</span><br /> <?php foreach ($events as $event) { $dateandtime = getdate(strtotime($event['timestamp'])); $d = $dateandtime['mday']; $m = $dateandtime['mon']; $y = $dateandtime['year']; $d = str_pad($d, 2, '0', STR_PAD_LEFT); $m = str_pad($m, 2, '0', STR_PAD_LEFT); echo '<span class="EventDate">'.$y.'.'.$m.'.'.$d.'</span>'; echo '<span class="EventTitle">' .strtoupper($event['name']). '</span>'; if (strlen($event['picturethumbnail']) > 4) { echo '<img src="images/' .$event['picturethumbnail']. '" class="EventThumbnail" />'; } echo '<img src="images/buttonreadmoreevent.png" class="ButtonReadMoreEvent" />'; } ?> </div> </div> </div> <div id="Bot"> <div class="BotLinkDiv"> <span class="BotLinkHeadline">LINK-TEXTS</span><br /> <a href="" class="BotLinkText">LINK1</a><br /> <a href="" class="BotLinkText">LINK2</a><br /> <a href="" class="BotLinkText">LINK3</a><br /> <a href="" class="BotLinkText">LINK4</a><br /> <a href="" class="BotLinkText">LINK5</a><br /> <a href="" class="BotLinkText">LINK6</a><br /> </div> <div class="BotLinkDiv"> <span class="BotLinkHeadline">LINK-TEXTS</span><br /> <a href="" class="BotLinkText">LINK1</a><br /> <a href="" class="BotLinkText">LINK2</a><br /> <a href="" class="BotLinkText">LINK3</a><br /> <a href="" class="BotLinkText">LINK4</a><br /> <a href="" class="BotLinkText">LINK5</a><br /> <a href="" class="BotLinkText">LINK6</a><br /> </div> <div class="BotLinkDiv"> <span class="BotLinkHeadline">ACCOUNT</span><br /> <a href="" class="BotLinkText">LOGIN</a><br /> <a href="" class="BotLinkText">CREATE ACCOUNT</a><br /> <a href="" class="BotLinkText">FORGOT PASSWORD</a><br /> <a href="" class="BotLinkText">PROFILE</a><br /> </div> <div class="BotLinkDiv"> <span class="BotLinkTextJoin">NOT A MEMBER?</span> <a href="register.php"><img src="images/buttonjoinnow.png" clas="BotButtonJoinNow" /></a> </div> <div class="BotLinkDiv"> <span class="BotLinkHeadline">SOCIAL</span><br /> <a href="http://www.twitch.tv/indiehjaerta" class="BotLinkText">TWITCH</a><br /> <a href="http://www.facebook.com/indiehjaerta" class="BotLinkText">FACEBOOK</a><br /> <a href="http://www.twitter.com/indiehjaerta" class="BotLinkText">TWITTER</a><br /> <a href="http://www.youtube.com/indiehjaerta" class="BotLinkText">YOUTUBE</a><br /> <a href="http://www.instagram.com/indiehjaerta" class="BotLinkText">INSTAGRAM</a><br /> </div> <div class="BotLinkDiv"> <span class="BotLinkHeadline">SUPPORT</span><br /> <a href="" class="BotLinkText">LINK1</a><br /><!-- CONTACT FORM --> <a href="" class="BotLinkText">LINK2</a><br /><!-- TWITCH MESSAGE --> <a href="" class="BotLinkText">LINK3</a><br /><!-- F.A.Q. --> <a href="" class="BotLinkText">LINK4</a><br /><!-- SUPPORT FORUMS --> <a href="" class="BotLinkText">LINK5</a><br /> <a href="" class="BotLinkText">LINK6</a><br /> </div> <div id="BotLogo"> <a href="#"><span class="DivLink"></span></a> </div> <?php $time = microtime(); $time = explode(' ', $time); $time = $time[1] + $time[0]; $finish = $time; $total_time = round(($finish - $start), 4); ?> <span class="BotLogoText">Page generated in <?php echo $total_time ?> seconds.</span> </div> </div> </body> </html>
Output for 5.3.0 - 5.4.30
Parse error: syntax error, unexpected ';' in /in/pQ10f on line 113
Process exited with code 255.