misc_emailcheck.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. /**
  3. * [Discuz!] (C)2001-2099 Comsenz Inc.
  4. * This is NOT a freeware, use is subject to license terms
  5. *
  6. * $Id: misc_emailcheck.php 33688 2013-08-02 03:00:15Z nemohou $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. $uid = 0;
  12. $email = '';
  13. $_GET['hash'] = empty($_GET['hash']) ? '' : $_GET['hash'];
  14. if($_GET['hash']) {
  15. list($uid, $email, $time) = explode("\t", authcode($_GET['hash'], 'DECODE', md5(substr(md5($_G['config']['security']['authkey']), 0, 16))));
  16. $uid = intval($uid);
  17. }
  18. if($uid && isemail($email) && $time > TIMESTAMP - 86400) {
  19. $member = getuserbyuid($uid);
  20. $setarr = array('email'=>$email, 'emailstatus'=>'1');
  21. if($_G['member']['freeze'] == 2) {
  22. $setarr['freeze'] = 0;
  23. }
  24. loaducenter();
  25. $ucresult = uc_user_edit(addslashes($member['username']), '', '', $email, 1);
  26. if($ucresult == -8) {
  27. showmessage('email_check_account_invalid', '', array(), array('return' => true));
  28. } elseif($ucresult == -4) {
  29. showmessage('profile_email_illegal', '', array(), array('return' => true));
  30. } elseif($ucresult == -5) {
  31. showmessage('profile_email_domain_illegal', '', array(), array('return' => true));
  32. } elseif($ucresult == -6) {
  33. showmessage('profile_email_duplicate', '', array(), array('return' => true));
  34. }
  35. if($_G['setting']['regverify'] == 1 && $member['groupid'] == 8) {
  36. $membergroup = C::t('common_usergroup')->fetch_by_credits($member['credits']);
  37. $setarr['groupid'] = $membergroup['groupid'];
  38. }
  39. updatecreditbyaction('realemail', $uid);
  40. C::t('common_member')->update($uid, $setarr);
  41. C::t('common_member_validate')->delete($uid);
  42. dsetcookie('newemail', "", -1);
  43. showmessage('email_check_sucess', 'home.php?mod=spacecp&ac=profile&op=password', array('email' => $email));
  44. } else {
  45. showmessage('email_check_error', 'index.php');
  46. }
  47. ?>