All pastes #708324 Raw Edit

Unnamed

public text v1 · immutable
#708324 ·published 2007-09-23 19:29 UTC
rendered paste body
<?php 
session_start(); 
error_reporting(E_ALL);
?>
<link href="../mycss/in.css" rel="stylesheet" type="text/css">
<?php 
$id = $_GET['id'];
if(empty($id)){
?>
	<table width="100%" cellpadding="0" cellspacing="0">
	<tr>
	<td background="../mycss/log.jpg" align="center">Inbox</td></tr></table>
	<table width="100%" cellpadding="0" cellspacing="0">
	<tr>
	<td width="25%">From:</td><td width="25%">Date:</td>
	<td width="25%">Subject:</td><td width="25%">Read:</td></tr>
	<?php
	include "includes/connect.php";

	$username = $_SESSION['username'];
	$sql = "SELECT * FROM inbox WHERE `to`='$username'";
	$query = mysql_query($sql);
	while($row = mysql_fetch_assoc($query)){
		echo "<tr>
		<td width='25%'>{$row['from']}</td><td width='25%'>{$row['date']}</td>	
		<td width='25%'><a href=?read={$row['id']}>{$row['subject']}</a></td><td width='25%'>{$row['read']}</td></tr>";
	}
}
else{
 
	$sql2 = "SELECT * FROM inbox WHERE id='$id'";
	$query2 = mysql_query($sql2);
	$fetch = mysql_fetch_object($query2);
	mysql_query("UPDATE inbox SET read='yes' WHERE id='$id'");
	?>
	<table width="100%" cellpadding="0" cellspacing="0">
	<tr>
	<td width="50%">TO:</td><td width="50%"><?php echo $fetch->to; ?></td>
	<td width="50%">From:</td><td width="50%"><?php echo $fetch->from; ?></td>
	<td width="50%">Subject:</td><td width="50%"><?php echo $fetch->subject; ?></td>
	<td width="50%">Body:</td><td width="50%"><?php echo $fetch->body; ?></td>
<?php 
}
?>