| 1 | <?php
 | 
  
    | 2 | /**
 | 
  
    | 3 |  *
 | 
  
    | 4 |  * @category        frontend
 | 
  
    | 5 |  * @package         account
 | 
  
    | 6 |  * @author          WebsiteBaker Project
 | 
  
    | 7 |  * @copyright       2009-2012, WebsiteBaker Org. e.V.
 | 
  
    | 8 |  * @link			http://www.websitebaker2.org/
 | 
  
    | 9 |  * @license         http://www.gnu.org/licenses/gpl.html
 | 
  
    | 10 |  * @platform        WebsiteBaker 2.8.x
 | 
  
    | 11 |  * @requirements    PHP 5.2.2 and higher
 | 
  
    | 12 |  * @version         $Id: save_confirm.php 1777 2012-10-01 16:16:26Z Luisehahne $
 | 
  
    | 13 |  * @filesource		$HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/account/save_confirm.php $
 | 
  
    | 14 |  * @lastmodified    $Date: 2012-10-01 18:16:26 +0200 (Mon, 01 Oct 2012) $
 | 
  
    | 15 |  *
 | 
  
    | 16 |  */
 | 
  
    | 17 | 
 | 
  
    | 18 | /* -------------------------------------------------------- */
 | 
  
    | 19 | // Must include code to stop this file being accessed directly
 | 
  
    | 20 | if(!defined('WB_PATH')) {
 | 
  
    | 21 | 	require_once(dirname(dirname(__FILE__)).'/framework/globalExceptionHandler.php');
 | 
  
    | 22 | 	throw new IllegalFileException();
 | 
  
    | 23 | }
 | 
  
    | 24 | /* -------------------------------------------------------- */
 | 
  
    | 25 | 
 | 
  
    | 26 | require_once(dirname(__FILE__).'/AccountSignup.php');
 | 
  
    | 27 | AccountSignup::deleteOutdatedConfirmations();
 | 
  
    | 28 | 
 | 
  
    | 29 | $sPassword = mysql_escape_string($wb->StripCodeFromText($wb->get_post('new_password_1')));
 | 
  
    | 30 | $sLoginName = mysql_escape_string($wb->StripCodeFromText($wb->get_post('new_loginname')));
 | 
  
    | 31 | $sConfirmationId = mysql_escape_string($wb->StripCodeFromText($wb->get_post('confirm_code')));
 | 
  
    | 32 | 
 | 
  
    | 33 | $bSendRegistrationMailtoUser = false;
 | 
  
    | 34 | $bSendRegistrationMailtoAdmin = false;
 | 
  
    | 35 | $aUser = array();
 | 
  
    | 36 | if( ($sPassword=='') || ($sLoginName=='') ) {
 | 
  
    | 37 | 	msgQueue::add( $mLang->MESSAGE_LOGIN_BOTH_BLANK);
 | 
  
    | 38 | } else {
 | 
  
    | 39 | 	if( $iUserId = AccountSignup::checkPassWordConfirmCode( $sPassword, $sConfirmationId )) {
 | 
  
    | 40 | 		msgQueue::add( $mLang->MESSAGE_ACTIVATED_NEW_USER, true );
 | 
  
    | 41 | 		AccountSignup::saveNewConfirmation($sConfirmationId);
 | 
  
    | 42 |         $email_to = AccountSignup::emailUser($iUserId);
 | 
  
    | 43 |         $bSaveRegistration = $iUserId > 0;
 | 
  
    | 44 | 		$sSubmitAction = 'finished'; // default action
 | 
  
    | 45 | 		$sql  = 'SELECT * FROM `'.TABLE_PREFIX.'users` ';
 | 
  
    | 46 | 		$sql .= 'WHERE `user_id` ='.$iUserId.' ';
 | 
  
    | 47 | 		if($oRes = $database->query($sql)) {
 | 
  
    | 48 |             $aUser = $oRes->fetchRow(MYSQL_ASSOC);
 | 
  
    | 49 |             $bSaveRegistration = true;
 | 
  
    | 50 |             $sDisplayName = $aUser['display_name'];
 | 
  
    | 51 |             $email_to = $aUser['email'];
 | 
  
    | 52 |             $sLoginIp = $aUser['login_ip'];
 | 
  
    | 53 |             $sLoginName = $aUser['username'];
 | 
  
    | 54 | 		}
 | 
  
    | 55 | 
 | 
  
    | 56 | 	} else {
 | 
  
    | 57 | 		msgQueue::add( $mLang->MESSAGE_FAILED_NEW_USER );
 | 
  
    | 58 | 	}
 | 
  
    | 59 | }
 | 
  
    | 60 | 
 |