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

120 lines
5.0KB

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