Project

General

Profile

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 1773 2012-09-27 23:42:13Z Luisehahne $
13
 * @filesource		$HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/account/save_confirm.php $
14
 * @lastmodified    $Date: 2012-09-28 01:42:13 +0200 (Fri, 28 Sep 2012) $
15
 *
16
 */
17

    
18
/* -------------------------------------------------------- */
19
// Must include code to stop this file being accessed directly
20
if(defined('WB_PATH') == false)
21
{
22
	die('<h2 style="color:red;margin:3em auto;text-align:center;">Cannot access this file directly</h2>');
23
}
24
/* -------------------------------------------------------- */
25

    
26
require_once(dirname(__FILE__).'/AccountSignup.php');
27
AccountSignup::deleteOutdatedConfirmations();
28
$sPassword = isset($_POST['new_password_1'])     ? mysql_escape_string($_POST['new_password_1']) : '';
29
$sLoginName = isset($_POST['new_loginname'])     ? mysql_escape_string($_POST['new_loginname']) : '';
30
$sConfirmationId = isset($_POST['confirm_code']) ? mysql_escape_string($_POST['confirm_code'])   : '';
31

    
32
$bSendRegistrationMailtoUser = false;
33
$bSendRegistrationMailtoAdmin = false;
34
$aUser = array();
35
if( ($sPassword=='') || ($sLoginName=='') ) {
36
	msgQueue::add( $mLang->MESSAGE_LOGIN_BOTH_BLANK);
37
} else {
38
	if( $iUserId = AccountSignup::checkPassWordConfirmCode( $sPassword, $sConfirmationId )) {
39
		msgQueue::add( $mLang->MESSAGE_ACTIVATED_NEW_USER, true );
40
		AccountSignup::saveNewConfirmation($sConfirmationId);
41
        $email_to = AccountSignup::emailUser($iUserId);
42
        $bSaveRegistration = $iUserId > 0;
43
		$sSubmitAction = 'finished'; // default action
44
		$sql  = 'SELECT * FROM `'.TABLE_PREFIX.'users` ';
45
		$sql .= 'WHERE `user_id` ='.$iUserId.' ';
46
		if($oRes = $database->query($sql)) {
47
            $aUser = $oRes->fetchRow(MYSQL_ASSOC);
48
            $bSaveRegistration = true;
49
            $sDisplayName = $aUser['display_name'];
50
            $email_to = $aUser['email'];
51
            $sLoginIp = $aUser['login_ip'];
52
            $sLoginName = $aUser['username'];
53
		}
54

    
55
	} else {
56
		msgQueue::add( $mLang->MESSAGE_FAILED_NEW_USER );
57
	}
58
}
59

    
(18-18/22)