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

114 lines
4.9KB

  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. $pwd = password_hash($userpwd, PASSWORD_BCRYPT);
  71. $mtype = '个人';
  72. $spaceSta = ($cfg_mb_spacesta < 0 ? $cfg_mb_spacesta : 0);
  73. $inQuery = "INSERT INTO `#@__member` (`mtype` ,`userid` ,`pwd`, `pwd_new` ,`uname` ,`sex` ,`rank` ,`money` ,`email` ,`scores` ,`matt`, `spacesta` ,`face`,`safequestion`,`safeanswer` ,`jointime` ,`joinip` ,`logintime` ,`loginip` )
  74. VALUES ('$mtype','$userid','','$pwd','$uname','','10','$dfmoney','','$dfscores','0','$spaceSta','','','','$jointime','$joinip','$logintime','$loginip'); ";
  75. if ($dsql->ExecuteNoneQuery($inQuery)) {
  76. $mid = $dsql->GetLastID();
  77. //写入默认会员详细资料
  78. if ($mtype == '个人') {
  79. $space = 'person';
  80. } else if ($mtype == '企业') {
  81. $space = 'company';
  82. } else {
  83. $space = 'person';
  84. }
  85. //写入默认统计数据
  86. $membertjquery = "INSERT INTO `#@__member_tj` (`mid`,`article`,`album`,`archives`,`homecount`,`pagecount`,`feedback`,`friend`,`stow`)
  87. VALUES ('$mid','0','0','0','0','0','0','0','0'); ";
  88. $dsql->ExecuteNoneQuery($membertjquery);
  89. //写入默认空间配置数据
  90. $spacequery = "INSERT INTO `#@__member_space`(`mid` ,`pagesize` ,`matt` ,`spacename` ,`spacelogo` ,`spacestyle`, `sign` ,`spacenews`)
  91. VALUES('{$mid}','10','0','{$uname}的空间','','$space','',''); ";
  92. $dsql->ExecuteNoneQuery($spacequery);
  93. //写入其它默认数据
  94. $dsql->ExecuteNoneQuery("INSERT INTO `#@__member_flink`(mid,title,url) VALUES('$mid','DedeBIZ','https://www.dedebiz.com'); ");
  95. //模拟登录
  96. $cfg_ml = new MemberLogin(7 * 3600);
  97. $rs = $cfg_ml->CheckUser($userid, $userpwd);
  98. ShowMsg('您已经登录系统,无需重新注册', 'index.php');
  99. exit;
  100. } else {
  101. ShowMsg("注册失败,请检查资料是否有误或与管理员联系", "-1");
  102. exit();
  103. }
  104. }
  105. require_once(DEDEMEMBER."/templets/reg-new.htm");
  106. } else {
  107. if (!$cfg_ml->IsLogin()) {
  108. ShowMsg("尚未完成基本信息的注册,请返回重新填写", "index_do.php?fmdo=user&dopost=regnew");
  109. exit;
  110. } else {
  111. ShowMsg('您已经登录系统,无需重新注册', 'index.php');
  112. exit;
  113. }
  114. }