rendered paste body<?php
session_start();
include 'common.php';
if (!isset($_SESSION['loggedIn'])) {
$error = "Not logged in";
include('include/css.inc');
?>
<style type="text/css">
<!--
.style4 {
color: #FFFFFF;
font-size: x-small;
}
-->
</style>
<body marginleft="0" marginright="0" leftmargin="0" rightmargin="0" marginwidth="0">
<tr>
<td><div align="center"><img src="images/header.jpg" width="700" height="200"></div>
<table width="700" height="640" border="3" bordercolor="#878471" align="center" cellpadding="0" cellspacing="0" class="table2">
<tr>
<td bgcolor="#878471" valign="top" width="157" class="nav">
<?php include('include/links.inc'); ?>
<td width="533" valign="top" bgcolor="#000000"><table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td ><table width="100%" border="0">
<tr>
<td><div align="center" class="form">
<div align="center">
<span class="style59"><span class="style66 style85">Battle Of The Sexiest</span><br />
<span class="style86">Private Message </span></span><br />
</div>
</div></td>
</tr>
</table>
</td>
</tr>
</table>
<br />
<table width="100%" border="0">
<tr>
<td><table width="100%" border="1" bordercolor="#878471">
<tr>
<td bgcolor="#878471"><div align="center" class="style87">
<div align="center">PRIVATE MESSAGE </div>
</div></td>
</tr>
</table>
<table width="153" border="0" class="form3">
<tr>
<td><div align="center" class="style88">
<?php echo $error; ?></div></td>
</tr>
</table>
</td>
</tr>
</table>
</tr>
</table>
</td></tr>
</html>
<?php
} else {
if(isset($_POST['messageSent'])) {
if ( (strlen($title) < 1) || (strlen($message) < 1) ) {
$error = 'Both fields are required to send a private message!'; }
else {
$title = $_POST['messageTitle'];
$message = $_POST['formMessage'];
$username = $_POST['username'];
$result2 = mysql_query("SELECT `id` FROM `users` WHERE `username` = '$username' LIMIT 1");
$this6 = mysql_fetch_assoc($result2);
$id = $this6['id'];
$user = curUser();
$result3 = mysql_query("SELECT `id` FROM `users` WHERE `username` = '$user' LIMIT 1");
$this9 = mysql_fetch_assoc($result3);
$my_id = $this9['id'];
$result = mysql_query("INSERT INTO `messages` ( `to`, `from`, `title`, `msg` )".
" VALUES ( '$id', '$my_id', '$title', '$message' )") or die(mysql_error());
$error = 'Message sent!';
}
$username = $_GET['username'];
}
?>
<?php include('include/css.inc'); ?>
<style type="text/css">
<!--
.style4 {
color: #FFFFFF;
font-size: x-small;
}
-->
</style>
<body marginleft="0" marginright="0" leftmargin="0" rightmargin="0" marginwidth="0">
<tr>
<td><div align="center"><img src="images/header.jpg" width="700" height="200"></div>
<table width="700" height="640" border="3" bordercolor="#878471" align="center" cellpadding="0" cellspacing="0" class="table2">
<tr>
<td bgcolor="#878471" valign="top" width="157" class="nav">
<?php include('include/links.inc'); ?>
<td width="533" valign="top" bgcolor="#000000"><table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td ><table width="100%" border="0">
<tr>
<td><div align="center" class="form">
<div align="center">
<span class="style59"><span class="style66 style85">Battle Of The Sexiest</span><br />
<span class="style86">Private Message </span></span><br />
</div>
</div></td>
</tr>
</table>
</td>
</tr>
</table>
<br />
<table width="100%" border="0">
<tr>
<td><table width="100%" border="1" bordercolor="#878471">
<tr>
<td bgcolor="#878471"><div align="center" class="style87">
<div align="center">PRIVATE MESSAGE </div>
</div></td>
</tr>
</table>
<table width="153" border="0" class="form3">
<tr>
<td><div align="center" class="style88">
<form method="post" action="<?php echo $PHP_SELF;?>"/>
<input type="hidden" name="username" value="<?php echo $username; ?>"/>
<input type="hidden" name="messageSent" value="1"/>
<span class="style4">Title</span><br />
<label>
<input name="messageTitle" type="text" size="15">
</label>
<br /><span class="style4">Message</span><br />
<textarea name="formMessage" cols="25" rows="5"> </textarea>
</p>
<label>
<input type="submit" name="Submit" value="Send">
</label>
</form>
<?php echo $error; ?></div></td>
</tr>
</table>
</td>
</tr>
</table>
</tr>
</table>
</td></tr>
</html>
<?php } ?>