@ 2014-06-18T18:07:38Z <?php
ini_set('display_errors', 'On');
error_reporting(E_ALL);
$time = microtime();
$time = explode(' ', $time);
$time = $time[1] + $time[0];
$start = $time;
session_start();
define("DB_HOST","mysql117.loopia.se");
define("DB_USER","normal@i103189");
define("DB_PASS","KungMicke87");
define("DB_NAME","indiehjaerta_com");
if (isset($_POST['send']))
{
if (isset($_SESSION['username']) && isset($_SESSION['id']))
{
// Connect to MySQLi
$sqli = mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME) or die(mysqli_errno());
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$fromid = $_SESSION['id'];
$subject = mysqli_real_escape_string($sqli, $_POST['subject']);
$text = mysqli_real_escape_string($sqli, $_POST['text']);
$tousername = mysqli_real_escape_string($sqli, $_POST['username']);
$postMessage = TRUE;
$emptySubject = FALSE;
$emptyText = FALSE;
$toid = 0;
$query = mysqli_query($sqli, "SELECT * FROM members WHERE username='".$tousername."'") or die("Error: ".mysqli_error($sqli));
$checkuser = mysqli_num_rows($query);
if (empty($subject))
{
$emptySubject = TRUE;
$postMessage = FALSE;
}
elseif (empty($text))
{
$emptyText = TRUE;
$postMessage = FALSE;
}
elseif ($checkuser == 0)
{
$noValidUsername = TRUE;
$postMessage = FALSE;
}
if ($postMessage == TRUE)
{
$row = mysqli_fetch_array($query);
$toid = $row[id];
$timestamp = date('Y-m-d H:i:s');
$query = mysqli_query($sqli,"INSERT INTO privatemessages (`fromid`, `toid`, `subject`, `text`, `timestamp`) VALUES ('$fromid', '$toid', '$subject', '$text', '$timestamp')") or die("Error: ".mysqli_error($sqli));
header("location:messages.php?action=sent");
}
else
{
$error = "There was an error posting the message.";
}
}
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<title>indiehjaerta.com - Messages</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="messages.php">Messages<a/> -
<a href="logout.php">Logout<a/>
<br />
<hr />
<br />
<?php
if (isset($_SESSION['username']) && isset($_SESSION['id']))
{
if (isset($_GET['action']) && ($_GET['action'] == 'send'))
{
?>
<table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td>
<strong>Message</strong>
</td>
</tr>
<tr>
<form method="post" action="">
<td>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td colspan="3"><strong>Send Message</strong></td>
</tr>
<tr>
<td colspan="3"><?php if(isset($error)) { echo $error; } ?></td>
</tr>
<tr>
<td width="78"><strong>To</strong></td>
<td width="6">:</td>
<td width="294"><input name="username" type="text" id="username"></td>
</tr>
<tr>
<td width="78"><strong>Subject</strong></td>
<td width="6">:</td>
<td width="294"><input name="subject" type="text" id="subject"></td>
</tr>
<tr>
<td>Text</td>
<td>:</td>
<td><textarea name="text" type="text" id="text" rows="3"></textarea></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><input type="submit" name="send" value="Send"></td>
</tr>
</table>
</td>
</form>
</tr>
</table>
<?php
}
if (isset($_GET['action']) && ($_GET['action'] == 'read') && isset($_GET['id']))
{
if ($_SESSION['id'] != $_GET['id']))
{
header("location:messages.php?error=1");
}
}
else
{
if (isset($_GET['action']) && ($_GET['action'] == 'sent'))
{
?>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td colspan="3">Message sent!</td>
</tr>
</table>
<br />
<?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();
}
$id = $_SESSION['id'];
$query = mysqli_query($sqli, "SELECT * FROM privatemessages WHERE toid='$id' ORDER BY timestamp DESC") or die("Error: ".mysqli_error($sqli));
$nummessages = mysqli_num_rows($query);
?>
<table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td>
<strong>Messages</strong>
</td>
</tr>
<tr>
<td>
<?php
if ($nummessages == 0)
{
?>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td colspan="3">Message box empty :(</td>
</tr>
</table>
<?php
}
else
{
if (isset($_GET['error']))
{
$error = "Stop Making Up Your Own Errors :(";
if ($_GET['error'] == '1')
{
$error = "ERROR: You can only view your own messages";
}
?>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td colspan="3"><?php echo $error; ?></td>
</tr>
</table>
<?php
}
?>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<th><strong>Read:</strong></th>
<th><strong>Subject:</strong></th>
<th><strong>From:</strong></th>
<th><strong>Time:</strong></th>
</tr>
<?
while ($row = mysqli_fetch_array($query))
{
?>
<tr>
<td>
<?php
if ($row['read'] == true)
{
echo "Yes";
}
else
{
echo "No";
}
?>
</td>
<td><?php echo $row['subject'] ?></td>
<td>
<?php
$uid = $row['fromid'];
if ($uid == 0)
{
echo "SYSTEM";
}
else
{
$userquery = mysqli_query($sqli, "SELECT * FROM members WHERE id='$uid'") or die("Error: ".mysqli_error($sqli));
$userexists = mysqli_num_rows($query);
if ($userexists == 0)
{
echo "<deleted user>";
}
else
{
$userrow = mysqli_fetch_array($userquery);
echo $userrow['username'];
}
}
?>
</td>
<td><?php echo $row['timestamp'] ?></td>
</tr>
<?php
}
?>
</table>
<?php
}
?>
</td>
</tr>
</table>
<hr />
<a href="?action=send">Send Message</a>
<?php
}
}
else
{
?>
<table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td>
<strong>Messages</strong>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td colspan="3">Can't fetch your messages since you're not logged in!</td>
</tr>
</table>
</td>
</tr>
</table>
<?php
}
?>
<hr />
<?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.060 0.060 18.85 5.4.28 0.047 0.040 18.96 5.4.27 0.043 0.037 19.24 5.4.26 0.047 0.040 18.87 5.4.25 0.050 0.057 18.87 5.4.24 0.050 0.047 18.86 5.4.23 0.040 0.033 18.98 5.4.22 0.043 0.043 18.97 5.4.21 0.040 0.033 19.21 5.4.20 0.040 0.043 18.86 5.4.19 0.033 0.040 18.99 5.4.18 0.050 0.063 19.23 5.4.17 0.040 0.037 19.30 5.4.16 0.047 0.063 19.22 5.4.15 0.040 0.040 18.99 5.4.14 0.043 0.040 16.39 5.4.13 0.073 0.050 16.35 5.4.12 0.077 0.040 16.68 5.4.11 0.053 0.033 16.60 5.4.10 0.050 0.050 16.54 5.4.9 0.040 0.040 16.60 5.4.8 0.043 0.040 16.28 5.4.7 0.053 0.027 16.54 5.4.6 0.063 0.037 16.43 5.4.5 0.057 0.060 16.29 5.4.4 0.043 0.037 16.48 5.4.3 0.037 0.040 16.43 5.4.2 0.040 0.037 16.43 5.4.1 0.060 0.057 16.48 5.4.0 0.040 0.037 15.83 5.3.28 0.037 0.037 14.57 5.3.27 0.037 0.040 14.68 5.3.26 0.043 0.033 14.47 5.3.25 0.047 0.037 14.47 5.3.24 0.080 0.043 14.58 5.3.23 0.047 0.050 14.45 5.3.22 0.050 0.037 14.46 5.3.21 0.053 0.063 14.53 5.3.20 0.050 0.070 14.47 5.3.19 0.040 0.040 14.47 5.3.18 0.043 0.047 14.57 5.3.17 0.047 0.043 14.43 5.3.16 0.060 0.057 14.45 5.3.15 0.050 0.067 14.43 5.3.14 0.050 0.043 14.47 5.3.13 0.043 0.040 14.43 5.3.12 0.053 0.053 14.52 5.3.11 0.043 0.073 14.51 5.3.10 0.047 0.067 14.00 5.3.9 0.050 0.063 14.00 5.3.8 0.050 0.047 13.95 5.3.7 0.043 0.047 13.99 5.3.6 0.053 0.033 13.88 5.3.5 0.047 0.040 13.93 5.3.4 0.047 0.037 13.75 5.3.3 0.033 0.040 13.98 5.3.2 0.043 0.063 13.68 5.3.1 0.047 0.040 13.57 5.3.0 0.047 0.040 13.53
preferences:dark mode live preview
136.44 ms | 1394 KiB | 7 Q