国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
2.1KB

  1. <?php
  2. /**
  3. * 生成点卡
  4. *
  5. * @version $Id: cards_make.php 1 14:31 2010年7月12日Z tianya $
  6. * @package DedeCMS.Administrator
  7. * @copyright Copyright (c) 2007 - 2018, DesDev, Inc.
  8. * @copyright Copyright (c) 2020, DedeBIZ.COM
  9. * @license https://www.dedebiz.com/license/v6
  10. * @link https://www.dedebiz.com
  11. */
  12. require_once(dirname(__FILE__)."/config.php");
  13. CheckPurview('member_Card');
  14. if(empty($dopost)) $dopost = '';
  15. if($dopost == '') include(DEDEADMIN."/templets/cards_make.htm");
  16. //生成点卡
  17. elseif($dopost == 'make')
  18. {
  19. $row = $dsql->GetOne("SELECT * FROM #@__moneycard_record ORDER BY aid DESC");
  20. !is_array($row) ? $startid=100000 : $startid=$row['aid']+100000;
  21. $row = $dsql->GetOne("SELECT * FROM #@__moneycard_type WHERE tid='$cardtype'");
  22. $money = $row['money'];
  23. $num = $row['num'];
  24. $mtime = time();
  25. $utime = 0;
  26. $ctid = $cardtype;
  27. $startid++;
  28. $endid = $startid + $mnum;
  29. header("Content-Type: text/html; charset={$cfg_soft_lang}");
  30. for(;$startid<$endid;$startid++)
  31. {
  32. $cardid = $snprefix.$startid.'-';
  33. for($p=0;$p<$pwdgr;$p++)
  34. {
  35. for($i=0; $i < $pwdlen; $i++)
  36. {
  37. if($ctype==1)
  38. {
  39. $c = mt_rand(49,57); $c = chr($c);
  40. }
  41. else
  42. {
  43. $c = mt_rand(65,90);
  44. if($c==79)
  45. {
  46. $c = 'M';
  47. }
  48. else
  49. {
  50. $c = chr($c);
  51. }
  52. }
  53. $cardid .= $c;
  54. }
  55. if($p<$pwdgr-1)
  56. {
  57. $cardid .= '-';
  58. }
  59. }
  60. $inquery = "INSERT INTO #@__moneycard_record(ctid,cardid,uid,isexp,mtime,utime,money,num)
  61. VALUES('$ctid','$cardid','0','0','$mtime','$utime','$money','$num'); ";
  62. $dsql->ExecuteNoneQuery($inquery);
  63. echo "成功生成点卡:{$cardid}<br/>";
  64. }
  65. echo "成功生成 {$mnum} 个点卡!";
  66. }