<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Expires" content="0">
<title>载入预览</title>
</head>
<body>
<script language="javascript" type="text/javascript">
<!--
var pM=parent.document.getElementById('show<?php echo $_GET['id']; ?>');
if(pM!=null){
  try{
    pM.innerHTML='<div id="zhaiyao">\
<?php
$text = '';
$GLOBALS['WEATHER_DATA'] = '../../';
@ require ('../set/set.php');
@ require ('../set/set_sql.php');
@ require ('../function/confirm_power.php');
define('POWER', confirm_power());
if (POWER >= 1) {
  if (!isset($sql['db_err'])) {
    db_conn();
  }
  if ($sql['db_err'] == '') {

    $result = @mysql_query('SELECT mess,mess_num FROM `'.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'` WHERE username="'.$session[0].'" LIMIT 1', $db);
    $row = @mysql_fetch_assoc($result);
    @mysql_free_result($result);
    if (is_array($row) && count($row) > 0) {
	  //echo $row['mess'];die;
      $messlist = array_filter(explode("\n", trim($row['mess'])));
      unset($row);
	  $n = count($messlist); //总记录数
      if ($n > 0) {
        foreach ($messlist as $key => $line) { //时间|来信人|主题|内容|||已读状态
		  if (substr((string)$line, 0, 14) == (string)$_GET['id']) {
		    $row = @explode('|', trim($line));
            $text = $row[3];
            if ($row[6] != 'o') {
              $row[6] = $update_mark = 'o';
              $messlist[$key] = @implode('|', $row);
            }
		    break;
          }
		}
	  }
      $text = $text ? $text : '未取到数据';
      if ($update_mark == 'o') {
        $newline = addslashes(@implode("\n", $messlist)."\n");
		$newnum = abs($row["mess_num"]) - 1 > 0 ? abs($row["mess_num"]) - 1 : 0;
        $newnum = $newnum.'/'.$n;
        //mysql_query("ALTER TABLE yzsoumember CHANGE `mess` `mess` TEXT");
	  	//@mysql_query('ALTER TABLE `'.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'` MODIFY COLUMN `mess` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL');
        @mysql_query('UPDATE '.$sql['pref'].''.$sql['data']['承载成员档案的表名'].' SET `mess`="'.$newline.'",`mess_num`="'.$newnum.'" WHERE username="'.$session[0].'"');
      }
	} else {
      $text .= '数据库查无数据！';
	}
  } else {
    $text .= $sql['db_err'];
  }
  @mysql_close();

} else {
  $text = '请登陆！';
}
echo $text;

?></div>';


    parent.document.getElementById('read<?php echo $_GET['id']; ?>').innerHTML='已读';
  }catch(err){
    pM.innerHTML='<div id="zhaiyao">预览载入失败！</div>';
  }
  setTimeout("pM.className='zairu';", 500);
}else{
  alert('预览载入失败！');
}

parent.window.scrollTo(0,<?php echo $_GET['t']; ?>);

-->
</script>

    

</body>
</html>
