国内流行的内容管理系统(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.

55 lines
1.9KB

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