@ 2014-05-31T18:35:59Z <?php
ini_set('display_errors', 'On');
error_reporting(E_ALL);
$time = microtime();
$time = explode(' ', $time);
$time = $time[1] + $time[0];
$start = $time;
define("DB_HOST","mysql117.loopia.se");
define("DB_USER","normal@i103189");
define("DB_PASS","KungMicke87");
define("DB_NAME","indiehjaerta_com");
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<title>indiehjaerta.com - News</title>
<link href="style_test.css" rel="stylesheet" type="text/css" />
</head>
<body>
<a href="login.php">Login<a/> -
<a href="admin.php">Admin<a/> -
<a href="members.php">Members<a/> -
<a href="register.php">Register<a/> -
<a href="blog.php">Blog<a/> -
<a href="news.php">News<a/> -
<a href="event.php">Event<a/> -
<a href="forum.php">Forum<a/> -
<a href="profile.php">Profile<a/> -
<a href="logout.php">Logout<a/>
<br /> <br />
<!-- New Post Start -->
<?php
if (isset($_GET['id']))
{
// 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();
}
$id = $_GET['id'];
$query = mysqli_query($sqli, "SELECT * FROM news WHERE id='$id'") or die("Error: ".mysqli_error($sqli));
$checknumnews = mysqli_num_rows($query);
// Check if news exists
if($checknumnews == 0)
{
// No News
echo '<span class="text">No News found matching ID!</span><br />';
}
else
{
while ($row = mysqli_fetch_array($query))
{
$id = $row['id'];
?>
<table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td>
<strong>News</strong>
</td>
</tr>
<tr>
<td>
<?php
//Number of characters to show
$chars = 25;
while ($row = mysqli_fetch_array($query))
{
$id = $row['id'];
$story = $row['story'];
?>
<table width="100%" border="0" cellpadding="2" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td><strong>Subject:</strong></td>
<td><strong><?php echo $row['headline'] ?></strong></td>
</tr>
<tr>
<td colspan="2"><strong>Story:</strong></td>
</tr>
<tr>
<td colspan="2"><?php echo $story ?></td>
</tr>
<?php
$userid = $row['userid'];
$query2 = mysqli_query($sqli, "SELECT * FROM members WHERE id='$userid'") or die("Error: ".mysqli_error($sqli));
while ($row2 = mysqli_fetch_array($query2))
{
?>
<tr>
<td><strong>Written by:</strong></td>
<td><a href="profile.php?id=<?php echo $userid ?>" style="color: black;"><?php echo $row2['username'] ?></a></td>
</tr>
<?php
}
?>
<tr>
<td><strong>Time:</strong></td>
<td><?php echo $row['timestamp'] ?></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
</td>
</tr>
</table>
<?php
/*
echo '<table border="0">';
echo '<tr>';
echo '<td><span class="text">Subject:</span></td>';
echo '<td><span class="text">' .$row['headline']. '</span></td>';
echo '</tr>';
$story = $row['story'];
echo '<tr>';
echo '<td colspan="2"><span class="text">Story:</span></td>';
echo '</tr>';
echo '<tr>';
echo '<td colspan="2"><span class="text">' .$story. '</span></td>';
echo '</tr>';
$userid = $row['userid'];
$query2 = mysqli_query($sqli, "SELECT * FROM members WHERE id='$userid'") or die("Error: ".mysqli_error($sqli));
while ($row2 = mysqli_fetch_array($query2))
{
echo '<tr>';
echo '<td><span class="text">Written by:</span></td>';
echo '<td><span class="text"><a href="profile.php?id=' .$userid.' ">' .$row2['username']. '</a></span></td>';
echo '</tr>';
}
echo '<tr>';
echo '<td><span class="text">Time:</span></td>';
echo '<td><span class="text">' .$row['timestamp']. '</span></td>';
echo '</tr>';
echo "</table><br />";
*/
}
}
}
else
{
// 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();
}
$query = mysqli_query($sqli, "SELECT * FROM news ORDER BY id") or die("Error: ".mysqli_error($sqli));
$checknumnews = mysqli_num_rows($query);
// Check if user exists
if($checknumnews == 0)
{
// No News
echo '<span class="text">No News found in the database!</span><br />';
}
else
{
?>
<table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td>
<strong>News</strong>
</td>
</tr>
<tr>
<td>
<?php
//Number of characters to show
$chars = 25;
while ($row = mysqli_fetch_array($query))
{
$id = $row['id'];
?>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td colspan="3"><strong><a href="?id=<?php echo $id ?>" style="color: black;"><?php echo $row['headline'] ?></a></strong></td>
</tr>
<tr>
<?php
$story = $row['story'];
if (strlen($story) >= $chars)
{
$story = substr($story,0,$chars);
$story = substr($story,0,strrpos($story,' '));
$story = $story."... <a href='?id=$id' style='color: black;'>(Read more)</a>";
}
?>
<td colspan="3"><?php echo $story ?></td>
</tr>
<?php
$userid = $row['userid'];
$query2 = mysqli_query($sqli, "SELECT * FROM members WHERE id='$userid'") or die("Error: ".mysqli_error($sqli));
while ($row2 = mysqli_fetch_array($query2))
{
echo '<tr>';
echo '<td><strong>Written by:<strong></td>';
echo '<td><a href="profile.php?id=' .$userid.' " style="color: black;">' .$row2['username']. '</a></td>';
echo '</tr>';
}
?>
<tr>
<td><strong>Time:</strong></td>
<td><?php echo $row['timestamp'] ?></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<?php
}
?>
</td>
</tr>
</table>
<?php
}
}
?>
<!-- New Post End -->
<?php
$time = microtime();
$time = explode(' ', $time);
$time = $time[1] + $time[0];
$finish = $time;
$total_time = round(($finish - $start), 4);
echo '<span class="text">Page generated in '.$total_time.' seconds.</span><br />';
?>
</body>
</html>
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).
Version System time (s) User time (s) Memory (MiB) 5.4.29 0.037 0.057 19.32 5.4.28 0.027 0.040 19.08 5.4.27 0.013 0.043 19.18 5.4.26 0.027 0.050 18.86 5.4.25 0.020 0.043 19.15 5.4.24 0.030 0.070 19.21 5.4.23 0.030 0.043 18.97 5.4.22 0.030 0.040 19.05 5.4.21 0.023 0.060 19.21 5.4.20 0.027 0.043 19.12 5.4.19 0.023 0.073 19.20 5.4.18 0.020 0.077 19.14 5.4.17 0.030 0.070 19.14 5.4.16 0.023 0.073 19.13 5.4.15 0.013 0.043 18.95 5.4.14 0.023 0.070 16.51 5.4.13 0.030 0.063 16.50 5.4.12 0.027 0.070 16.46 5.4.11 0.020 0.033 16.35 5.4.10 0.027 0.063 16.34 5.4.9 0.017 0.047 16.45 5.4.8 0.030 0.040 16.53 5.4.7 0.030 0.050 16.35 5.4.6 0.020 0.070 16.34 5.4.5 0.037 0.030 16.26 5.4.4 0.023 0.057 16.56 5.4.3 0.010 0.047 16.25 5.4.2 0.017 0.077 16.22 5.4.1 0.020 0.043 16.55 5.4.0 0.020 0.067 16.02 5.3.28 0.023 0.077 14.45 5.3.27 0.020 0.040 14.71 5.3.26 0.020 0.040 14.53 5.3.25 0.017 0.060 14.65 5.3.24 0.020 0.077 14.71 5.3.23 0.030 0.063 14.46 5.3.22 0.030 0.060 14.52 5.3.21 0.023 0.067 14.54 5.3.20 0.027 0.050 14.56 5.3.19 0.017 0.077 14.54 5.3.18 0.023 0.050 14.53 5.3.17 0.017 0.067 14.45 5.3.16 0.017 0.073 14.45 5.3.15 0.033 0.037 14.46 5.3.14 0.023 0.057 14.45 5.3.13 0.017 0.040 14.61 5.3.12 0.010 0.060 14.45 5.3.11 0.017 0.050 14.55 5.3.10 0.017 0.073 14.45 5.3.9 0.017 0.037 14.45 5.3.8 0.017 0.053 14.45 5.3.7 0.010 0.040 14.45 5.3.6 0.017 0.033 14.45 5.3.5 0.023 0.070 14.45 5.3.4 0.027 0.067 14.45 5.3.3 0.020 0.070 14.45 5.3.2 0.020 0.070 14.45 5.3.1 0.027 0.067 14.45 5.3.0 0.020 0.077 14.45
preferences:dark mode live preview
149.91 ms | 1398 KiB | 7 Q