<?php
require ('authentication_member.php');
?>
<?php

/* 取：我的信誉值 */
/* 162100源码 - 162100.com */
$_GET['act'] =@$_GET['act'];
if ($_GET['act'] == 'add') {
  $where_eval = ' AND money>0';
  $list_title = '"<a href=\"?get=mycredit\">全部记录</a><a class=\"list_title_in\">增值记录<span>（".$n."）</span></a><a href=\"?get=mycredit&act=del\">减值记录</a>"';
} elseif ($_GET['act'] == 'del') {
  $where_eval = ' AND money<0';
  $list_title = '"<a href=\"?get=mycredit\">全部记录</a><a href=\"?get=mycredit&act=add\">增值记录</a><a class=\"list_title_in\">减值记录<span>（".$n."）</span></a>"';
} else {
  $where_eval = '';
  $list_title = '"<a class=\"list_title_in\">全部记录<span>（".$n."）</span></a><a href=\"?get=mycredit&act=add\">增值记录</a><a href=\"?get=mycredit&act=del\">减值记录</a>"';
}


$mess = 0;
$text = $err = '';
if (!isset($sql['db_err'])) {
  db_conn();
}

if ($sql['db_err'] == '') {

  $result = @mysql_query('SELECT mess_num,check_reg FROM '.$sql['pref'].''.$sql['data']['承载成员档案的表名'].' WHERE username="'.$session[0].'"', $db);
	if ($row = @mysql_fetch_assoc($result)) {
    if ($row['check_reg'] == '1') {
      $err = '帐号注册审核中！';
    } elseif ($row['check_reg'] == '2') {
      $err = '帐号已被移除至<a href="list_member.php?act=punished" target="_blank">黑名单</a>！';
    } else {
      $mess = '<span class="grayword">'.preg_replace('/^\d+/', '<span>$0</span>', $row['mess_num']).'</span>';
    }
    unset($row);
  } else {
    $err = '帐号不存在！';
  }
  @mysql_free_result($result);

  if (empty($err)) {
    //求和信誉值
    $total = 0;
    $result = @mysql_query('SELECT SUM(money) AS total FROM '.$sql['pref'].''.$sql['data']['承载财务数据的表名'].' WHERE (username="'.$session[0].'" AND type="1")', $db);
    if ($row = @mysql_fetch_assoc($result)) {
      $total = (float)$row['total'];
      unset($row);
    }
    @mysql_free_result($result);


    $result = @mysql_query('SELECT description FROM '.$sql['pref'].''.$sql['data']['承载财务数据的表名'].' WHERE (username="'.$session[0].'" AND type="1") AND (description="营业执照" OR description="身份证")', $db);
    while ($row = @mysql_fetch_assoc($result)) {
      if ($row['description'] == '营业执照') {
        $yyzz = 'o';
      }
      if ($row['description'] == '身份证') {
        $sfz = 'o';
      }
      unset($row);
    }
    @mysql_free_result($result);

    //求总数
    $result = @mysql_query('SELECT COUNT(id) AS total FROM '.$sql['pref'].''.$sql['data']['承载财务数据的表名'].' WHERE (username="'.$session[0].'" AND type="1")'.$where_eval.'', $db);
    $row = @mysql_fetch_assoc($result);
    $n = abs($row['total']);
    @mysql_free_result($result);
    unset($row);

    require ('inc/function/get_page.php');
    if ($n > 0) {
    
      $p = get_page($n); //页数
      $seek = $web['pagesize'] * ($p-1);
      $result = @mysql_query('SELECT * FROM '.$sql['pref'].''.$sql['data']['承载财务数据的表名'].' WHERE (username="'.$session[0].'" AND type="1")'.$where_eval.' ORDER BY id DESC LIMIT '.$seek.','.$web['pagesize'].'', $db); // ORDER BY date
      $step = 0;
      $text .= '
<div class="list_title_">
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <th>信誉值明细</th>
      <th width="100">信誉值变化</th>
      <th width="200">日期</th>
      <th width="200">备注</th>
    </tr>
  </table>
</div>
';
      while ($row = @mysql_fetch_assoc($result)) {
        if ($row['check_credit'] == '1') {
          $money = '<span class="redword">审核中</span>';
        } elseif ($row['check_credit'] == '2') {
          $money = '<span class="redword">审核未通过</span>';
        } else {
          $money = $row['money'] > 0 ? '+'.$row['money'] : $row['money'];
        }
        $open = substr($row['other'], 0, 1);
        $step++;
        $text .= '
<div class="li">
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td>'.$row['description'].'</td>
      <td width="100" align="center">'.$money.'</td>
      <td width="200" align="center">'.$row['date'].'</td>
      <td width="200" align="center">'.(substr($row['other'], 1, 7) == 'credit-' ? '<a href="obj.php?title='.substr($row['other'], 1).'" target="_blank">浏览</a> '.($row['check_credit'] != '' ? '<form action="?post=mycredit" enctype="multipart/form-data" method="post" style="display:inline"><input name="act" type="hidden" value="'.$row['description'].'" />
<span onmouseover="this.innerHTML=\'<div class=file_r><button class=file_b type=button><b>上传</b></button><input name=uploadfile type=file class=file_o onchange=chkUpPic(this.form)></div> <input type=checkbox class=checkbox name=open value=1'.((string)$open == '1' ? ' checked=checked' : '').' />公开\';this.onmouseover=function(){return false;}"><a href="javascript:void(0)" onclick="return false;">更改</a></span></form>' : '').'' : $row['other']).'</td>
    </tr>
  </table>
</div>
';
        unset($row);

      }
      @mysql_free_result($result);

      $text .= get_page_foot($n, $web['pagesize'], $p, '?get=mycredit&act='.$_GET['act'].'&p=');
    } else {
      $text = '暂无相应记录';
    }

  }


} else {
  $err .= $sql['db_err'];
}

@ require ('inc/function/add_online.php'); //在线
@mysql_close();


if (empty($err)) {
?>
<style type="text/css">
.file_r { width:60px; height:24px; display:inline-block !important; display:inline; zoom:1; vertical-align:middle; position:relative; overflow:hidden; }
.file_o { width:60px; position:absolute; top:0; left:0; z-index:4; overflow:hidden; background-color:#FFFFFF; filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0); -moz-opacity:0; -khtml-opacity:0; opacity:0; }
.file_b { position:absolute; top:0; left:0; z-index:3; }
.file_o1 {width:60px; position:absolute; top:0; left:0; z-index:4; overflow:hidden; background-color:#FFFFFF; filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0); -moz-opacity:0; -khtml-opacity:0; opacity:0; }
.file_r1 {width:60px; height:24px; display:inline-block !important; display:inline; zoom:1; vertical-align:middle; position:relative; overflow:hidden; }
</style>
<div class="column aline">
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td width="250" align="center"><?php
echo '您当前的信誉值为：<span'.($total == 0 ? '' : ' class="redword"').' style="font-size:24px;">'.$total.'</span>';
?></td>
      <td style="border-left:1px #DDDDDD dotted;padding-left:30px;text-align:left; font-family:宋体;"> 营业执照：<?php echo $yyzz == 'o' ? '已上传' : '<form action="?post=mycredit" enctype="multipart/form-data" method="post" style="display:inline"><input name="act" type="hidden" value="营业执照" /><span class="file_r"><button class="file_b" type="button"><b>上传</b></button><input name="uploadfile" type="file" class="file_o" onchange="chkUpPic(this.form);"></span> <input type="checkbox" class="checkbox" name="open" value="1" checked />公开</form>'; ?><br />
        身 份 证：<?php echo @$sfz == 'o' ? '已上传' : '<form action="?post=mycredit" enctype="multipart/form-data" method="post" style="display:inline"><input name="act" type="hidden" value="身份证" /><span class="file_r"><button class="file_b" type="button"><b>上传</b></button><input name="uploadfile" type="file" class="file_o" onchange="chkUpPic(this.form);"></span> <input type="checkbox" class="checkbox" name="open" value="1" checked />公开</form>'; ?><br />
        其它证件：<form action="?post=mycredit" enctype="multipart/form-data" method="post" style="display:inline"><input name="act" id="othercredittitle" type="text" size="20" />
          <span class="file_r1">
            <button class="file_b" type="button"><b>上传</b></button>
            <input name="uploadfile" type="file" class="file_o1" onclick="filteV('othercredittitle');if($('othercredittitle').value==''){alert('请先填写证件名！');$('othercredittitle').focus();return false;}" onchange="chkUpPic(this.form);" />
          </span>
          <input type="checkbox" class="checkbox" name="open" value="1" checked="checked" />
          公开
        </form>
        <br />
        <ul class="grayword">
          <li>上传验证相关资质，可提高信誉值及获赠货币积分等。</li>
          <li>上传图片格式限jpg、gif、png，大小限1M内。</li>
          <li>其它证件包括：税务登记证、组织代码证、开户许可证、各种质量体系认证、资质、荣誉证书等。 </li>
        </ul></td>
    </tr>
  </table>
</div>
<script type="text/javascript">
<!--
function filteV(id){
  $(id).value=$(id).value.replace(/[^\u4E00-\u9FA5\w]/g, '').substr(0, 45);
}


function chkUpPic(theForm){
  var filestr=theForm.uploadfile.value;
  var ext=filestr.substring(filestr.lastIndexOf(".")+1,filestr.length);
  ext=ext.toLowerCase();
  if(ext!='jpg' && ext!='jpeg' && ext!=='gif' && ext!='png'){ // && ext!='bmp'
    alert('图片格式不对！只能为（jpg|jpeg|gif|png）');
    return false;
  }
  addSubmitSafe();
  theForm.submit();
}
-->
</script>
<div class="list_title"><?php echo eval('return '.$list_title.';'); ?></div>
<?php
echo $text;

} else {
  echo $err;
}
?>
