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

116 lines
4.9KB

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