Location: PHPKode > scripts > wwdbank > wwdbank/accounts/messaging.php
<?php
Include_once('includes/session_config.php');
$user_name=($_POST['user_name']);
$conn = mysql_connect("localhost", "guest", "guest") OR DIE (mysql_error());
mysql_select_db ("wwdbank", $conn) OR DIE (mysql_error());

echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
echo"<tr><td colspan=\"2\" height=\"380\" valign=\"top\">";
echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";

if(isset($_POST['messagesend2']))
{
 $dte = getdate();
 $dt = $dte[year] . "-" . str_pad($dte[mon], 2, "0", STR_PAD_LEFT) . "-" . str_pad($dte[mday], 2, "0", STR_PAD_LEFT);

$title=($_POST['title']);
$body=($_POST['body']);
$from_user=($_POST['from_user']);
$to_user=($_POST['to_user']);
$sql = "INSERT INTO messaging VALUES";

$sql .= " ('','$title','$body','$from_user','$to_user','$dt')";
$result = mysql_query($sql)or die (mysql_error());
$row = mysql_query($result);

if ($result)
	{
	echo "<tr valign=\"top\"><td colspan=\"2\" height=\"25\">Message Sent</td></tr>";
	echo "<tr valign=\"top\"><td colspan=\"2\" height=\"25\">$title</td></tr>";
	echo "<tr valign=\"top\"><td colspan=\"2\" height=\"25\">$body</td></tr>";
	}
	else
	{
	echo mysql_errno().":MySQL error ".mysql_error()."<BR>";
	}
}
else
{
echo"<tr valign=\"top\"><td colspan=\"2\" valign=\"top\">";
	if(isset($_POST['messagesend1']))
	{
	Include_once('messagesend2.php');
	}
	else
	{
		if(isset($_POST['reply']))
		{
		Include_once('messagesend2.php');
		}
		else
		{
			if(isset($_POST['messagesend']))
			{
			Include_once('messagesend1.php');
			}
			else
			{	
				if(isset($_POST['messageread1']))
				{
				Include_once('messageread2.php');
				}
				else
				{
					if(isset($_POST['messagedelete']))
					{
					Include_once('messagedelete.php');
					}
					else
					{
						if(isset($_POST['messaging']))
						{
						Include_once('messageread1.php');
						}
					}
				}
			}
		}
	}
	echo"</td></tr>";
}
echo"</table></td></tr>";
echo"<tr valign=\"bottom\"><td><form action=\"$PHP_SELF?\" method=\"post\">
		<input type= \"hidden\" name= \"messagesend\" value= \"messagesend\" >
		<input type= \"hidden\" name= \"messaging\" value= \"messaging\" >
		<input type= \"hidden\" name= \"admin\" value= \"admin\" >
		<input type= \"hidden\" name= \"user_name\" value= \"{$_SESSION['user_name']}\" >
		<input type=\"hidden\" name=\"pass\" value=\"{$_SESSION['pass']}\">
		<input type= \"hidden\" name= \"submit\" value= \"submit\" >
		
		<INPUT TYPE=\"image\" SRC=\"../images/send.jpg\" width=\"32\" height=\"12\"  alt=\"Send Message\" BORDER=\"0\">
		 </form></td><td>";
		echo"<form action=\"$PHP_SELF?\" method=\"post\">
		<input type= \"hidden\" name= \"messageread\" value= \"messageread\" >
		<input type= \"hidden\" name= \"messaging\" value= \"messaging\" >
		<input type= \"hidden\" name= \"admin\" value= \"admin\" >
		<input type= \"hidden\" name= \"submit\" value= \"submit\" >
		<input type= \"hidden\" name= \"user_name\" value= \"{$_SESSION['user_name']}\" >
		<input type=\"hidden\" name=\"pass\" value=\"{$_SESSION['pass']}\">
		<INPUT TYPE=\"image\" SRC=\"../images/read.jpg\" width=\"30\" height=\"12\"  alt=\"Read Messages\" BORDER=\"0\">
		 </form></td></tr>";
echo"</table>";
?>
Return current item: wwdbank