<?php include("sql/conn.php"); 
session_start(); 
$iipp = $_SERVER["REMOTE_ADDR"];
$noww = time();
$llym = $_SERVER["HTTP_REFERER"];//记住来路的域名
?>



<?php


if (empty($_SESSION['name'])){
header("Location: index.php");
}



if ($_GET['go']=='go')
{

if($_SESSION['name']=="" or $_POST['to']=="" ){
exit;}

$_POST['to'] = strip_tags ($_POST['to']); 
$_POST['nr'] = strip_tags ($_POST['nr']); 

if($_POST['to']=='管理员')
{$_POST['to']=$_SESSION['adm'];}
mysql_query("INSERT INTO msn1 (nr, go1, gotime, to1, yd)
VALUES ('".$_POST['nr']."', '".$_SESSION['name']."', '".$noww ."', '".$_POST['to']."','0')");

mysql_query("INSERT INTO text (name, time, ip, ing, f, bz) 
VALUES ('".$_SESSION['name']."', '".$noww."', '".$iipp."', '写信', '0', '')");

Header("Location:".$llym);
}

?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>信件收取|<?php include("adm/all/gjz.txt"); ?></title>
<meta name="description" content="信件收取|<?php include("adm/all/description.txt"); ?>" />
<meta name="keywords" content="信件收取|<?php include("adm/all/gjz.txt"); ?>" />
<link  href="css/css<?php include("adm/all/css.txt"); ?>.css" rel="stylesheet" type="text/css">


</head>

<body >


<?php
if($_GET['id']=="")
{
}
else
{
        if($_SESSION['name']==""){
        exit;}
	
    if($_GET['id']=="a")
    {
    include("msn2.php"); 
    }
    else
    {
    include("msn1.php"); 
    }

}
?>




<div id="top">
<?php include("user.php");  ?>
</div>
<?php include("gh.php");  ?>
<div align="center">

<?php include("logo.php");  ?>


<div id="dh" ><?php 
 if(file_exists("dh1.php"))
 {
include("dh1.php"); 
 }
 else
 {
include("action/dh1.php"); 
 }
?></div>



</div>



<div class="clear"></div>


<?php 
 if(file_exists("top.php"))
 {
include("top.php"); 
 }
 else
 {
include("action/top.php"); 
 }
?>


<div class="clear"></div>


<div align="center">
<div id="nr">



<div class="RoundedCorner">
<b class="rtop"><b class="r1"></b><b class="r2"></b><b class="r3"></b><b class="r4"></b></b>


<div id=nr >
<div id="nr21"><h3 align="center">收信</h3><hr><?php
$i = 1;
$result = mysql_query("SELECT * FROM msn1 where to1 = '".$_SESSION['name']."' ORDER BY id DESC LIMIT 0,16 ");
while($row = mysql_fetch_array($result))
  {
  if ($row['yd']!="1"){
  echo "<strong>";}
  echo "　<a href=?id=".$row['id']." >";
  $tim = date("m月d日H:i:s",$row['gotime']);
  echo $i.".";
  $i++;
  if ($row['go1']==$_SESSION['adm']){
  echo "来自<u>管理员</u>　".$tim;
  }else{
  echo "来自<u>".$row['go1']."</u>　".$tim;}
  
  echo "</a>";
  if ($row['yd']!="1"){
  echo "</strong>　未读";}
  echo "<br />";
  }
?></div>

<div id="nr21"><h3 align="center">发信</h3><hr><?php
$result = mysql_query("SELECT * FROM msn1 where go1 = '".$_SESSION['name']."' ORDER BY id DESC LIMIT 0,16 ");
$i = 1;
while($row = mysql_fetch_array($result))
  {
  echo "　<a href=?id=".$row['id']." >";
  $tim = date("m月d日H:i:s",$row['gotime']);
  echo $i.".";
  $i++;
  if ($row['to1']==$_SESSION['adm']){
  echo "写给<u>管理员</u>　".$tim;
  }else{
  echo "写给<u>".$row['to1']."</u>　".$tim;}
  echo "</a>";
  if ($row['yd']=="1"){
  echo "　对方已读";}
  echo "<br />";
  }
?></div>


</div>

<div class="clear"></div>
<hr>

<div id="nr" align="left">
<h4>　　<a href="msn.php?id=a">我要写信</a></h4>
</div>



<b class="rbottom"><b class="r4"></b><b class="r3"></b><b class="r2"></b><b class="r1"></b></b>
</div>

</div></div>

<div class="clear"></div>

<div align="center"><div id="nr">


<div class="RoundedCorner">
<b class="rtop"><b class="r1"></b><b class="r2"></b><b class="r3"></b><b class="r4"></b></b>
<div id="nr2">


<?php 
 if(file_exists("12.php"))
 {
include("12.php"); 
 }
 else
 {
include("action/12.php"); 
 }
?>



</div>
<b class="rbottom"><b class="r4"></b><b class="r3"></b><b class="r2"></b><b class="r1"></b></b>
</div>


</div></div>


<div class="clear"></div>


<?php 
 if(file_exists("foot.php"))
 {
include("foot.php"); 
 }
 else
 {
include("action/foot.php"); 
 }
?>

</body>


<?php include("sql/close.php"); ?>

