userdj.php 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <?
  2. include("../config/conn.php");
  3. include("../config/function.php");
  4. sesCheck();
  5. $sj=date("Y-m-d H:i:s");
  6. $sqluser="select * from yjcode_user where uid='".$_SESSION[SHOPUSER]."'";mysql_query("SET NAMES 'GBK'");$resuser=mysql_query($sqluser);
  7. if(!$rowuser=mysql_fetch_array($resuser)){php_toheader("../reg/");}
  8. $userdj=returnuserdj($rowuser[id]);
  9. $nowdj=0;
  10. if(empty($userdj)){Audit_alert("本站未启用会员等级系统,请联系客服!","./");}
  11. if($_GET[control]=="xf"){ //续费
  12. while1("*","yjcode_userdj where name1='".$userdj."'");if($row1=mysql_fetch_array($res1)){
  13. if($rowuser[money1]<$row1[money1]){Audit_alert("余额不足,请先充值!","userdj.php");}
  14. $money1=$row1["money1"]*(-1);
  15. PointUpdateM($rowuser[id],$money1);
  16. PointIntoM($rowuser[id],$row1[name1]."会员等级费用支出(续费)",$money1);
  17. if(empty($rowuser[userdjdq])){$dq=$sj;}else{
  18. $sjv=$rowuser[userdjdq];
  19. if($rowuser[userdjdq]<$sj){$sjv=$sj;}
  20. if(empty($row1[jgdw])){$ds="month";}else{$ds="year";}
  21. $dq=date('Y-m-d H:i:s',strtotime ("+1 ".$ds,strtotime($sjv)));
  22. }
  23. updatetable("yjcode_user","userdjdq='".$dq."' where id=".$rowuser[id]);
  24. }
  25. php_toheader("userdj.php?t=suc");
  26. }elseif($_GET[control]=="ts"){ //提升等级
  27. while2("*","yjcode_userdj where name1='".$userdj."'");$row2=mysql_fetch_array($res2);
  28. while1("*","yjcode_userdj where id=".$_GET[id]);if($row1=mysql_fetch_array($res1)){
  29. /*
  30. if(empty($row2[jgdw])){$nt=$row2[money1]/30;}else{$nt=$row2[money1]/365;}
  31. if(empty($row1[jgdw])){$st=$row1[money1]/30;}else{$st=$row1[money1]/365;}
  32. $sjc=DateDiff($dq,$sj,"d");
  33. $djcj=$st-$nt;
  34. $cj=intval($djcj*$sjc);
  35. */
  36. if(empty($row1[jgdw])){$ts="month";}else{$ts="year";}
  37. if(empty($rowuser[userdjdq]) || $rowuser[userdjdq]<$sj){$ndq=$sj;}else{$ndq=$rowuser[userdjdq];}
  38. $dq=date('Y-m-d H:i:s',strtotime ("+1 ".$ts,strtotime($ndq)));
  39. if($rowuser[money1]<$row1[money1]){Audit_alert("余额不足,请先充值!","userdj.php");}
  40. $money1=$row1[money1]*(-1);
  41. PointUpdateM($rowuser[id],$money1);
  42. PointIntoM($rowuser[id],"会员等级提升",$money1);
  43. updatetable("yjcode_user","userdj='".$row1[name1]."',userdjdq='".$dq."' where id=".$rowuser[id]);
  44. }
  45. php_toheader("userdj.php?t=suc");
  46. }
  47. ?>
  48. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  49. <html xmlns="http://www.w3.org/1999/xhtml">
  50. <head>
  51. <meta http-equiv="x-ua-compatible" content="ie=7" />
  52. <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
  53. <title>用户管理面板 - <?=webname?></title>
  54. <? include("cssjs.html");?>
  55. <link href="css/inf.css" rel="stylesheet" type="text/css" />
  56. <script language="javascript">
  57. function tj(x,y){
  58. if(confirm("确定提交吗?")){}else{return false;}
  59. layer.msg('正在处理数据,请稍候', {icon: 16 ,time: 0,shade :0.25});
  60. location.href="userdj.php?id="+y+"&control="+x;
  61. }
  62. </script>
  63. </head>
  64. <body>
  65. <? include("../tem/top.html");?>
  66. <? include("top.php");?>
  67. <div class="yjcode">
  68. <? include("left.php");?>
  69. <!--RB-->
  70. <div class="userright">
  71. <ul class="wz">
  72. <li class="l1 l2"><a href="userdj.php">会员等级</a></li>
  73. </ul>
  74. <!--白B-->
  75. <div class="rkuang">
  76. <? systs("恭喜您,操作成功!","userdj.php")?>
  77. <ul class="uk">
  78. <li class="l1">您的等级:</li>
  79. <li class="l21"><strong class="green"><?=$userdj?></strong> (到期:<?=returnjgdw($rowuser[userdjdq],"","永久不到期")?>)</li>
  80. <li class="l1">您的余额:</li>
  81. <li class="l21"><?=sprintf("%.2f",$rowuser[money1])?>元 [<a href="pay.php" class="red"><strong>充值</strong></a>]</li>
  82. </ul>
  83. <ul class="djcap">
  84. <li class="l1">会员等级</li>
  85. <li class="l2">尊享服务</li>
  86. <li class="l3">续费费用 </li>
  87. <li class="l4">操作</li>
  88. </ul>
  89. <?
  90. while2("*","yjcode_userdj where name1='".$userdj."'");if($row2=mysql_fetch_array($res2)){$nowdj=$row2[xh];}
  91. if(empty($rowuser[userdjdq]) || $rowuser[userdjdq]<$sj){$dq=date('Y-m-d H:i:s',strtotime ("+1 month",strtotime($sj)));}else{$dq=$rowuser[userdjdq];}
  92. while1("*","yjcode_userdj where zt=0 order by xh asc");while($row1=mysql_fetch_array($res1)){
  93. ?>
  94. <ul class="djlist">
  95. <li class="l1"><?=$row1[name1]?></li>
  96. <li class="l2">购买会员商品享<strong><?=$row1[zhekou]?></strong>折</li>
  97. <li class="l3"><?=$row1[money1]?>元/<? if(empty($row1[jgdw])){echo "月";}else{echo "年";}?> </li>
  98. <li class="l4">
  99. <? if($nowdj<$row1[xh]){?>
  100. <a href="javascript:void(0);" onclick="tj('ts',<?=$row1[id]?>)" class="a0">提升等级</a>
  101. <span class="s1" style="display:none;">
  102. 补差价:<?
  103. if(empty($row2[jgdw])){$nt=$row2[money1]/30;}else{$nt=$row2[money1]/365;}
  104. if(empty($row1[jgdw])){$st=$row1[money1]/30;}else{$st=$row1[money1]/365;}
  105. $sjc=DateDiff($dq,$sj,"d");
  106. $djcj=$st-$nt;
  107. $cj=intval($djcj*$sjc);
  108. echo $cj;
  109. ?>元
  110. </span>
  111. <? }elseif($nowdj==$row1[id]){?>
  112. <a href="javascript:void(0);" onclick="tj('xf',<?=$row1[id]?>)" class="a1">续费</a>
  113. <? }?>
  114. </li>
  115. </ul>
  116. <? }?>
  117. <div class="clear clear10"></div>
  118. </div>
  119. <!--白E-->
  120. </div>
  121. <!--RE-->
  122. </div>
  123. <div class="clear clear15"></div>
  124. <? include("../tem/bottom.html");?>
  125. </body>
  126. </html>