Project

General

Profile

1 1773 Luisehahne
<?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$
13
 * @filesource		$HeadURL$
14
 * @lastmodified    $Date$
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
}