<?php

/* 成员管理后台首页 */
/* 162100源码 - 162100.com - download.162100.com */


@ require ('inc/set/set.php');
/*
if (@ $_SERVER['HTTP_REFERER'] && strpos($_SERVER['HTTP_REFERER'], $web['sitehttp']) !== 0) {
  err('跨域操作越权！');
}
*/
@ require ('inc/set/set_sql.php');
@ require ('inc/function/confirm_power.php');
//身份验证
$POWER = confirm_power();
//深层验证
if ($POWER > 0.5) {
    $GLOBALS['session_key'] = get_session_key();
    if ($session[1].'|'.$session[2] != $GLOBALS['session_key']) {
      $POWER = 0;
      $GLOBALS['session_err'] = ' <span class="redword">身份密钥已更改！请重新在此浏览器<a href="login.php" onclick="if(parent!=self)this.target=\'_blank\';">登陆</a>恢复。</span>';
    }
}
define('POWER', $POWER);
$userface = user_class(POWER, $session[3]);

function get_li_mode($area_index) {
  global $web;
  if (!isset($area_index) || empty($area_index)) {
    return $web['sitemode'];
  } elseif (strstr($area_index, $web['sitemode'])) {
    return $web['sitemode'];
  } else {
    $sitemode = false;
    foreach (@explode('|', $area_index) as $mode) {
      if (file_exists('inc/css/'.$mode.'/index.php') && file_exists('inc/css/'.$mode.'/list.php') && file_exists('inc/css/'.$mode.'/article.php')) {
        $sitemode = $mode == $web['sitemode'] ? $web['sitemode'] : $mode;
        break;
      }
    }
    return $sitemode ? $sitemode : $web['sitemode'];
  }
}

function get_mode($area_index) {
  global $web;
  if (!isset($area_index) || empty($area_index)) {
    return $web['sitemode'];
  } else {
    if (file_exists('inc/css/'.$area_index.'/index.php') && file_exists('inc/css/'.$area_index.'/list.php') && file_exists('inc/css/'.$area_index.'/article.php')) {
      return $area_index;
    } else {
      return $web['sitemode'];
    }
  }
}

@ $GLOBALS['this_mode'] = get_mode($_GET['mode']);


$post = !empty($_POST['post']) ? $_POST['post'] : (!empty($_GET['post']) ? $_GET['post'] : false);
$post = preg_replace('/[\.\/]+/', '', $post);
if (!empty($post)) {
  //一次性输出信息
  function alert($text = '', $href) {
    global $web;
    echo '<!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" />
<title>程序执行</title>
<link href="inc/css/'.$GLOBALS['this_mode'].'/style.css" rel="stylesheet" type="text/css" id="my_style">
<style type="text/css">
<!--
html { height:100%; text-align:center; background:none; border:none;  padding:0; }
body { width:auto; height:100%; margin:0 auto; padding:0; border-top:none; margin-top:0; background:url(inc/images/loading.gif) 50% 50% no-repeat; border:none; }
#transition { text-align:center; margin:auto; }
.wherego { margin:10px auto; background-color:#FFFFFF; }
.wherego td { width:50%; font-size:12px; word-wrap:break-word; word-break:break-all; }
.wherego td.whereyou { text-align:right; }
-->
</style>
<script type="text/javascript" language="javaScript" src="inc/js/main.js"></script>
</head>
<body>
<table id="transition" width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><div class="output"><div><img src="inc/images/ok.gif" /> '.$text.'</div>
        <div>或点击以下链接进入...<a href="'.$href.'">'.$href.'</a></div></div>
    </td>
  </tr>
</table>
<style type="text/css">
<!--
#transition { background:#FFFFFF; }
-->
</style>
<script language="javascript" type="text/javascript">
<!--
setTimeout("location.href=\''.$href.'\';", 5000);
-->
</script>
</body>
</html>';
    die;
  }

  //一次性输出错误
  function err($text = '', $src = 'i') {
    global $web, $js_say;
    echo '<!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" />
<title>程序执行</title>
<link href="inc/css/'.$GLOBALS['this_mode'].'/style.css" rel="stylesheet" type="text/css" id="my_style">
<style type="text/css">
<!--
html { height:100%; text-align:center; background:none; border:none;  padding:0; }
body { width:auto; height:100%; margin:0 auto; padding:0; border-top:none; margin-top:0; background:url(inc/images/loading.gif) 50% 50% no-repeat; border:none; }
#transition { text-align:center; margin:auto; }
.wherego { margin:10px auto; background-color:#FFFFFF; }
.wherego td { width:50%; font-size:12px; word-wrap:break-word; word-break:break-all; }
.wherego td.whereyou { text-align:right; }
-->
</style>
<script type="text/javascript" language="javaScript" src="inc/js/main.js"></script>
</head>
<body>
<table id="transition" width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><div class="'.($js_say?'red_err':'output').'" id="output"><div><img src="inc/images/'.$src.'.gif" /> '.$js_say.$text.'</div>
        <div id="back">点此可<a href="javascript:window.history.back();">返回</a></div></div>
    </td>
  </tr>
</table>
<style type="text/css">
<!--
#transition { background:#FFFFFF; }
-->
</style>
</body>
</html>';
    die;
  }
  if ($_POST['m']==1) {
    $js_say = '
<style type="text/css">
.output { max-width:100%; }
</style>
<script>
function resetParH(){if($("back")!=null){$("back").style.display="none"}var par=parent.$("sendFrame");if(par!=null){par.style.display="block";par.style.height=$("output").offsetHeight+"px";try{setTimeout("parent.$(\'sendFrame\').style.display=\'none\';", 5000);}catch(e){}}}
if (document.all) {
  window.attachEvent("onload", resetParH);//对于IE
} else {
  window.addEventListener("load", resetParH, false);//对于FireFox
}
//try{parent.delSubmitSafe();}catch(e){}
try{setTimeout("parent.delSubmitSafe();", 1000);}catch(e){}

</script>';
  }  

  if ($post != false && file_exists('inc/run/post_member_'.$post.'.php')) {
    @ require ('inc/run/post_member_'.$post.'.php');
  } else {
    err('命令错误或功能尚未开通！');
  }
  die;
}













if (POWER == 0.5) {
  session_start();
}

?><!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" />
<title><?php

$power_url = array(
  'file'        => ' &gt; 完善/修改我的名片',
  'list'        => ' &gt; 我发布的文章',
  'reply'       => ' &gt; 我发布的回复',
  'replyme'     => ' &gt; 我收到的回复',
  'reward'      => ' &gt; 我悬赏的文章',
  'collect'     => ' &gt; 我收藏的记录',
  'reward_cash' => ' &gt; 悬赏兑现',
  'list_edit'   => ' &gt; 修改已发信息',
  'list_edit2'  => ' &gt; 修改已发信息',
  'mess'        => ' &gt; 发送短信',
  'messbox'     => ' &gt; 收信箱',
  'power'       => ' &gt; 了解我的权限',
  'myfunds'     => ' &gt; 管理货币值',
  'mycredit'    => ' &gt; 管理信誉值',
  'ad'          => ' &gt; 投广告位',
  'door'        => '',
);
$_GET['get'] = @ $_GET['get'];
if (!$_GET['get'] || !isset($power_url[$_GET['get']])) {
  $_GET['get'] = 'door';
}

echo $title = '成员控制台'.$power_url[$_GET['get']], $web['code_author'];
if (!isset($sql['db_err'])) {
  db_conn();
}
if ($sql['db_err'] == '') {
  require ('inc/function/add_online.php'); //在线
}

?></title>
<link id="my_style" rel="stylesheet" type="text/css" href="inc/css/<?php echo $GLOBALS['this_mode']; ?>/style.css">
<script language="javascript" type="text/javascript" src="inc/js/main.js"></script>
</head>
<body>
<script> loginReloadYeNo=true; </script>
<div id="session" class="session">
<button type="button" onclick="window.open('write.php?mode=<?php echo $web['sitemode']; ?>','_blank');" title="发布文章"><b><div class="send_write"></div></b></button>
    <?php
echo @ $GLOBALS['session_err'];
@ include ('inc/require/head.txt');

?>
    &nbsp;
</div>
<?php
if ($web['siteclose'] > 1) {
  @include ('inc/require/siteclose_why.txt');
}
?>
<div id="logo"><a href="<?php echo $web['path']; ?>"><img src="<?php echo $web['sitelogo']; ?>" /></a></div>
<div id="banner"> <a href="./">首页</a> <a class="column_is">成员控制台</a> <a href="help.php">帮助</a> <?php @include ('inc/css/'.$web['sitemode'].'/banner.txt'); ?></div>
<div class="column"><h5><a href="./">首页</a> &gt; <a href="member.php">成员控制台</a><?php echo $power_url[$_GET['get']]; ?></h5></div>
<?php
if (POWER >= 1) {
?>
<table width="100%" height="400" border="0" cellspacing="0" cellpadding="0" id="menu">
  <tr>
    <td valign="top" id="leftmenu" class="leftmenu">
      <strong>个人管理</strong>
        <ul>
          <li><a id="bar-door" href="?get=door">我的头像</a></li>
          <li><a id="bar-file" href="?get=file">修改/完善我的名片</a></li>
          <li><a id="bar-power" href="?get=power">了解我的权限</a></li>
        </ul>
      <strong>文章管理</strong>
        <ul>
          <li><a id="bar-list" href="?get=list">我发布的文章</a></li>
          <li><a id="bar-reply" href="?get=reply">我发布的回复</a></li>
          <li><a id="bar-replyme" href="?get=replyme">我收到的回复</a></li>
          <li><a id="bar-reward" href="?get=reward">我悬赏的文章</a></li>
          <li><a id="bar-collect" href="?get=collect">我收藏的记录</a></li>
        </ul>
      <strong>站内信箱</strong>
        <ul>
          <li><a id="bar-messbox" href="?get=messbox">收信箱</a></li>
          <li><a id="bar-mess" href="?get=mess">我要写信</a></li>
        </ul>
      <strong>帐单管理</strong>
        <ul>
          <li><a id="bar-myfunds" href="?get=myfunds">我要增加货币值</a></li>
          <li><a id="bar-mycredit" href="?get=mycredit">我要增加信誉值</a></li>
        </ul>
      <!--strong>增值服务</strong>
        <ul>
          <li><a id="bar-ad" href="?get=ad">投广告位</a></li>
        </ul--></td>
    <td valign="top" class="rightmenu"><?php @include ('inc/require/siteannounce.txt'); ?>
        <?php
  //<!-- require -->

  if (file_exists('inc/run/get_member_'.$_GET['get'].'.php')) {
    require_once ('inc/run/get_member_'.$_GET['get'].'.php');
    @mysql_close();

    echo '<script> try { if ($("bar_id_") != null) { $("bar_id_").id = ""; } $("bar-'.$_GET['get'].'").parentNode.id = "bar_id_"; } catch (err) {} </script>';
  } else {
    echo '<img src="inc/images/i.gif" /> 文件对应命令'.$_GET['get'].'的文件不见了！请<a href="javascript:window.history.back();">返回</a>。';
  }

  //<!-- /require -->

?>
    </td>
  </tr>
</table>
<?php
} else {
  if (POWER == 0.5) {
    @ require ('login_key/'.$session[6].'/info.php');
  } else {
?>
<div class="body">
  <div class="siteannounce">欢迎你：访客 | 您需要<a href="reg.php"><b>创建帐号（非常简单）</b></a>或<a href="login.php"><b>登陆帐号</b></a>，以获得<a href="write.php">发表</a>或管理权限。</div>
</div>
<?php
  }
}
?>
<div id="foot">
  <?php @include ('inc/css/'.$GLOBALS['this_mode'].'/foot.txt'); ?>
</div>
<script language="JavaScript" type="text/javascript">
<!--
window.onload=function(){
  try{$('new_mess').innerHTML='<?php echo !empty($mess) ? $mess : 0; ?>';}catch(err){}
}
-->
</script>
<?php

//检测数据库连接
if (isset($sql['db_err']) && $sql['db_err'] != '') {
  echo '<div id="submit_safe" class="filter"><table width="100%" height="100%"><tr><td><div id="submit_safe_in">'.$sql['db_err'].'</div></td></tr></table></div>';
}
?>

</body>
</html>