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

122 lines
5.2KB

  1. <?php
  2. /**
  3. * 会员注册
  4. *
  5. * @version $id:reg_new.php 8:38 2010年7月9日 tianya $
  6. * @package DedeBIZ.User
  7. * @copyright Copyright (c) 2022 DedeBIZ.COM
  8. * @license GNU GPL v2 (https://www.dedebiz.com/license)
  9. * @link https://www.dedebiz.com
  10. */
  11. require_once(dirname(__FILE__)."/config.php");
  12. if ($cfg_mb_allowreg == 'N') {
  13. ShowMsg('系统关闭了新会员注册', 'index.php');
  14. exit();
  15. }
  16. if (!isset($dopost)) $dopost = '';
  17. $step = empty($step) ? 1 : intval($step);
  18. if ($step == 1) {
  19. if ($cfg_ml->IsLogin()) {
  20. ShowMsg('正在登录会员中心,请稍等', 'index.php');
  21. exit();
  22. }
  23. if ($dopost == 'regbase') {
  24. $svali = GetCkVdValue();
  25. if (strtolower($vdcode) != $svali || $svali == '') {
  26. ResetVdValue();
  27. ShowMsg('验证码不正确', '-1');
  28. exit();
  29. }
  30. $userid = $uname = trim($userid);
  31. $pid = HtmlReplace($pid, 1);
  32. //推广pid
  33. $pRow = $dsql->GetOne("SELECT mid FROM `#@__member` WHERE userid LIKE '$pid'");
  34. $pMid = isset($pRow['mid'])? intval($pRow['mid']) : 0;
  35. $pwd = trim($userpwd);
  36. $pwdc = trim($userpwdok);
  37. $rs = CheckUserID($userid, '账号');
  38. if ($rs != 'ok') {
  39. ShowMsg($rs, '-1');
  40. exit();
  41. }
  42. if (strlen($userid) > 20 || strlen($uname) > 36) {
  43. ShowMsg('您的账号或账号过长,不允许注册', '-1');
  44. exit();
  45. }
  46. if (strlen($userid) < $cfg_mb_idmin || strlen($pwd) < $cfg_mb_pwdmin) {
  47. ShowMsg("您的账号或密码过短,不允许注册", "-1");
  48. exit();
  49. }
  50. if ($pwdc != $pwd) {
  51. ShowMsg('您两次输入的密码不一致', '-1');
  52. exit();
  53. }
  54. $uname = HtmlReplace($uname, 1);
  55. $userid = HtmlReplace($userid, 1);
  56. //检测账号是否存在
  57. $row = $dsql->GetOne("SELECT mid FROM `#@__member` WHERE userid LIKE '$userid' ");
  58. if (is_array($row)) {
  59. ShowMsg("您指定的账号<span class='text-primary'>{$userid}</span>已存在,请使用别的账号", "-1");
  60. exit();
  61. }
  62. //会员的默认金币
  63. $dfscores = 0;
  64. $dfmoney = 0;
  65. $dfrank = $dsql->GetOne("SELECT `money`,scores FROM `#@__arcrank` WHERE `rank`='10' ");
  66. if (is_array($dfrank)) {
  67. $dfmoney = $dfrank['money'];
  68. $dfscores = $dfrank['scores'];
  69. }
  70. if ($pMid > 0) {
  71. $dfscores = $dfscores + $cfg_userad_adds;
  72. }
  73. $jointime = time();
  74. $logintime = time();
  75. $joinip = GetIP();
  76. $loginip = GetIP();
  77. $pp = "pwd";
  78. if (function_exists('password_hash')) {
  79. $pp = "pwd_new";
  80. $pwd = password_hash($userpwd, PASSWORD_BCRYPT);
  81. } else {
  82. $pwd = md5($userpwd);
  83. }
  84. $mtype = '个人';
  85. $space = 'person';
  86. $spaceSta = ($cfg_mb_spacesta < 0 ? $cfg_mb_spacesta : 0);
  87. $inQuery = "INSERT INTO `#@__member` (`mtype` ,`userid` ,`$pp`,`uname` ,`sex` ,`rank` ,`money` ,`email` ,`scores` ,`matt`, `spacesta` ,`face`,`safequestion`,`safeanswer` ,`jointime` ,`joinip` ,`logintime` ,`loginip`, `pmid`) VALUES ('$mtype','$userid','$pwd','$uname','','10','$dfmoney','','$dfscores','0','$spaceSta','','','','$jointime','$joinip','$logintime','$loginip', '$pMid'); ";
  88. if ($dsql->ExecuteNoneQuery($inQuery)) {
  89. $mid = $dsql->GetLastID();
  90. //写入默认统计数据
  91. $membertjquery = "INSERT INTO `#@__member_tj` (`mid`,`article`,`album`,`archives`,`homecount`,`pagecount`,`feedback`,`friend`,`stow`) VALUES ('$mid','0','0','0','0','0','0','0','0'); ";
  92. $dsql->ExecuteNoneQuery($membertjquery);
  93. //写入默认空间配置数据
  94. $spacequery = "INSERT INTO `#@__member_space` (`mid`,`pagesize`,`matt`,`spacename`,`spacelogo`,`spacestyle`,`sign`,`spacenews`) VALUES ('{$mid}','10','0','{$uname}的个人主页','','$space','',''); ";
  95. $dsql->ExecuteNoneQuery($spacequery);
  96. //写入其它默认数据
  97. $dsql->ExecuteNoneQuery("INSERT INTO `#@__member_flink`(mid,title,url) VALUES ('$mid','DedeBIZ','https://www.dedebiz.com');");
  98. //模拟登录
  99. $cfg_ml = new MemberLogin(7 * 3600);
  100. $rs = $cfg_ml->CheckUser($userid, $userpwd);
  101. if ($pMid > 0) {
  102. $dsql->ExecuteNoneQuery("UPDATE `#@__member` SET scores=scores+{$cfg_userad_adds} WHERE mid='$pMid'");
  103. }
  104. ShowMsg('正在登录会员中心,请稍等', 'index.php');
  105. exit;
  106. } else {
  107. ShowMsg("注册失败,请检查资料是否有误或与管理员联系", "-1");
  108. exit();
  109. }
  110. }
  111. $pid = HtmlReplace($pid, 1);
  112. require_once(DEDEMEMBER."/templets/reg-new.htm");
  113. } else {
  114. if (!$cfg_ml->IsLogin()) {
  115. ShowMsg("您未填写基本信息,请填写基本信息", "index_do.php?fmdo=user&dopost=regnew");
  116. exit;
  117. } else {
  118. ShowMsg('正在登录会员中心,请稍等', 'index.php');
  119. exit;
  120. }
  121. }
  122. ?>