Vilken uppdatering ska jag använda?

Detta är ett arkiv för phpBB2 Support, Diskussion, MODar, Stilar och översättningar. Den tillhandahålls endast för referensändamål.

Moderatorer: Supportgrupp, Moderatorgrupp

Användarvisningsbild
WickeD
Extra aktiv medlem
Extra aktiv medlem
Inlägg: 979
Blev medlem: 2004-11-08 12:17
Ort: Sverige / Umeå
Kontakt:

Vilken uppdatering ska jag använda?

Inlägg av WickeD » 2006-04-12 09:38

Hej!

Jag har ju phpBB2 Plus 1.52 2.0.19

Min fundering är vilken uppdatering jag ska använda för att uppdatera min 1.52 2.0.19 till 1.52 2.0.20?

Någon som vet?

//Lill-Micke
Bästa hälsningar - Mikael Andersson

Välkommen till: http://www.bikersite.se - Träffpunkten för svenska bikers!

Användarvisningsbild
Holger
Support - Ledare
Support - Ledare
Inlägg: 6515
Blev medlem: 2004-06-09 08:32
Ort: Hannover/Tyskland
Kontakt:

Inlägg av Holger » 2006-04-12 10:51

Holger Gremminger
Ingen support via PM!

Användarvisningsbild
WickeD
Extra aktiv medlem
Extra aktiv medlem
Inlägg: 979
Blev medlem: 2004-11-08 12:17
Ort: Sverige / Umeå
Kontakt:

Inlägg av WickeD » 2006-04-12 11:03

Okej!

Men jag vill inte lägga in hela 1.53.

Jag vill bara uppdatera mina filer så att jag får bort de säkerhetshål som är fixade i denna uppdatering.

Ska jag använda denna uppdatering då?: phpBB2 Plus 1.53 Beta9 Code Changes from 2.0.19 to 2.0.20

Det ser ut att vara en ganska stor uppdatering till databasen också.

Vad tror du Holger? kan denna uppdatering förstöra allt jag har ändrat på min sida eller är detta bara en uppdatering som fixar säkerhelshål?

Och vad tror du händer med phpCA efter uppdateringen?
Bästa hälsningar - Mikael Andersson

Välkommen till: http://www.bikersite.se - Träffpunkten för svenska bikers!

Användarvisningsbild
Holger
Support - Ledare
Support - Ledare
Inlägg: 6515
Blev medlem: 2004-06-09 08:32
Ort: Hannover/Tyskland
Kontakt:

Inlägg av Holger » 2006-04-12 11:14

Du får läsa i tråden. Det skrivs mycket på engelska.
Holger Gremminger
Ingen support via PM!

Användarvisningsbild
WickeD
Extra aktiv medlem
Extra aktiv medlem
Inlägg: 979
Blev medlem: 2004-11-08 12:17
Ort: Sverige / Umeå
Kontakt:

Inlägg av WickeD » 2006-04-12 11:26

Okej!

Jag får nog vänta å se om det kommer ut någon uppdatering som innehåller bara säkerhets fix som gör att jag kan fortsätta använda 1.52.

Tack för länken Holger!
Bästa hälsningar - Mikael Andersson

Välkommen till: http://www.bikersite.se - Träffpunkten för svenska bikers!

Användarvisningsbild
Holger
Support - Ledare
Support - Ledare
Inlägg: 6515
Blev medlem: 2004-06-09 08:32
Ort: Hannover/Tyskland
Kontakt:

Inlägg av Holger » 2006-04-13 13:27

Micke,

du bör nog uppdatera till 1.53 nu.
Här:
http://www.phpbb2.de/ftopic37634.html
släpps ju 1.53 FINAL.

Här:
http://www.phpbb2.de/fpost193822.html#193822
finns uppdateringsinformation för Plus 1.52 2.0.19 till 2.0.20
Holger Gremminger
Ingen support via PM!

Användarvisningsbild
WickeD
Extra aktiv medlem
Extra aktiv medlem
Inlägg: 979
Blev medlem: 2004-11-08 12:17
Ort: Sverige / Umeå
Kontakt:

Inlägg av WickeD » 2006-04-13 15:44

Okej!

Men det verkar vara några som har problem med deras tema och mod´s efter dom har uppdaterat till 1.53, eller är det bara om man uppdatera helt till 1.53?

Men det borde väl vara riskfritt att använda: phpbb-2[1].0.19_to_2.0.20 som du hänvisade till i den nedre länken, eller vad tror du Holger?

Om jag tar säkerhets kopia av hela sidan och på hela databasen så borde det väl gå att återställa allt om det går dåligt att uppdatera?
Bästa hälsningar - Mikael Andersson

Välkommen till: http://www.bikersite.se - Träffpunkten för svenska bikers!

Användarvisningsbild
WickeD
Extra aktiv medlem
Extra aktiv medlem
Inlägg: 979
Blev medlem: 2004-11-08 12:17
Ort: Sverige / Umeå
Kontakt:

Inlägg av WickeD » 2006-04-13 16:54

Jag håller på med uppdateringen nu, men jag har kört fast här:

Det står i install texten:

Kod: Markera allt

#-----[ OPEN ]--------------------------------------------- 
# 
includes/usercp_confirm.php
Problemet är att jag har ingen includes/usercp_confirm.php

Vad gör jag då?
Bästa hälsningar - Mikael Andersson

Välkommen till: http://www.bikersite.se - Träffpunkten för svenska bikers!

Användarvisningsbild
WickeD
Extra aktiv medlem
Extra aktiv medlem
Inlägg: 979
Blev medlem: 2004-11-08 12:17
Ort: Sverige / Umeå
Kontakt:

Inlägg av WickeD » 2006-04-13 17:12

Detta kör jag fast på också:

Install säger:

Kod: Markera allt

#-----[ OPEN ]---------------------------------------------
# 
includes/usercp_register.php
Jag hittar ej detta i den filen:

Kod: Markera allt

#-----[ FIND ]--------------------------------
# 
				message_die(GENERAL_ERROR, 'Could not obtain confirmation code', __LINE__, __FILE__, $sql);
			}

			if ($row = $db->sql_fetchrow($result))
			{

#
#-----[ FIND ]-----------------------------------------------
# Line 300
				// Only compare one char if the zlib-extension is not loaded
				if (!@extension_loaded('zlib'))
				{
					$row['code'] = substr($row['code'], -1);
				}
Och inte detta heller:

Kod: Markera allt

#-----[ FIND ]-------------------------------
# 
		$confirm_chars = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',  'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',  'U', 'V', 'W', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9');

		list($usec, $sec) = explode(' ', microtime()); 
		mt_srand($sec * $usec); 

		$max_chars = count($confirm_chars) - 1;
		$code = '';
		for ($i = 0; $i < 6; $i++)
		{
			$code .= $confirm_chars[mt_rand(0, $max_chars)];
		}

#
#-----[ REPLACE WITH ]-----------------------------------
#
		// Generate the required confirmation code
		// NB 0 (zero) could get confused with O (the letter) so we make change it
		$code = dss_rand();
		$code = strtoupper(str_replace('0', 'o', substr($code, 6)));
Detta är min usercp_register.php

Kod: Markera allt

<?php
/***************************************************************************
 *                            usercp_register.php
 *                            -------------------
 *   begin                : Saturday, Feb 13, 2001
 *   copyright            : (C) 2001 The phpBB Group
 *   email                : support@phpbb.com
 *
 *   $Id: usercp_register.php,v 1.20.2.57 2004/03/25 15:57:20 acydburn Exp $
 *
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 *
 ***************************************************************************/

if ( !defined('IN_PHPBB') )
{
	die("Hacking attempt");
	exit;
}
function gen_reg_key()
{
	$key = "";
	$max_length_reg_key = 5;
	$chars = array(
		"a","b","c","d","e","f","g","h","i","j","k","l","m",
		"n","o","p","q","r","s","t","u","v","w","x","y","z");

	$count = count($chars) - 1;

	srand((double)microtime()*1000000);

	for($i = 0; $i < $max_length_reg_key; $i++)
	{
		$key .= $chars[rand(0, $count)];
	}

	return($key);
}
$unhtml_specialchars_match = array('#>#', '#<#', '#"#', '#&#');
$unhtml_specialchars_replace = array('>', '<', '"', '&');

// ---------------------------------------
// Load agreement template since user has not yet
// agreed to registration conditions/coppa
//
//
// CBACK CrackerTracker Register Flood Protection
//
  if($ctracker_config['regblock'] == 1 && $HTTP_GET_VARS['mode'] == 'register')
  {
    if($ctracker_config['lastreg'] >= time())
    {
      $lregtimestamp = $ctracker_config['lastreg'];
      $waittime = 0;
      $waittime = $lregtimestamp - time();
      $waitmsg  = '';
      $waitmsg  = sprintf($lang['ct_forum_rfl'], $waittime);
      message_die(GENERAL_MESSAGE, $waitmsg);
    }

    if(!empty($HTTP_SERVER_VARS['REMOTE_ADDR']) && $ctracker_config['lastreg_ip'] == $HTTP_SERVER_VARS['REMOTE_ADDR'])
    {
      // If the same IP wants to register we block this for 400 Seconds
      if($ctracker_config['lastreg'] + 400 >= time())
      {
        message_die(GENERAL_MESSAGE, $lang['ct_forum_ifl']);
      }
    }
  }
function show_coppa()
{
	global $userdata, $template, $lang, $phpbb_root_path, $phpEx;

	$template->set_filenames(array(
		'body' => 'agreement.tpl')
	);

	$template->assign_vars(array(
		'REGISTRATION' => $lang['Registration'],
		'AGREEMENT' => $lang['Reg_agreement'],
		"AGREE_OVER_13" => $lang['Agree_over_13'],
		"AGREE_UNDER_13" => $lang['Agree_under_13'],
		'DO_NOT_AGREE' => $lang['Agree_not'],

		"U_AGREE_OVER13" => append_sid("profile.$phpEx?mode=register&agreed=true"),
		"U_AGREE_UNDER13" => append_sid("profile.$phpEx?mode=register&agreed=true&coppa=true"))
	);

	$template->pparse('body');

}
//
// ---------------------------------------

$error = FALSE;
$error_msg = '';
$page_title = ( $mode == 'editprofile' ) ? $lang['Edit_profile'] : $lang['Register'];

if ( $mode == 'register' && !isset($HTTP_POST_VARS['agreed']) && !isset($HTTP_GET_VARS['agreed']) )
{
	include($phpbb_root_path . 'includes/page_header.'.$phpEx);

	show_coppa();

	include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
}

$coppa = ( empty($HTTP_POST_VARS['coppa']) && empty($HTTP_GET_VARS['coppa']) ) ? 0 : TRUE;

//
// Check and initialize some variables if needed
//

if (
	isset($HTTP_POST_VARS['submit']) ||
	isset($HTTP_POST_VARS['avatargallery']) ||
	isset($HTTP_POST_VARS['submitavatar']) ||
	isset($HTTP_POST_VARS['cancelavatar']) ||
	$mode == 'register' )
{
	include($phpbb_root_path . 'includes/functions_validate.'.$phpEx);
	include($phpbb_root_path . 'includes/bbcode.'.$phpEx);
	include($phpbb_root_path . 'includes/functions_post.'.$phpEx);

	if ( $mode == 'editprofile' )
	{
		$user_id = intval($HTTP_POST_VARS['user_id']);
		$current_email = trim(htmlspecialchars($HTTP_POST_VARS['current_email']));
	}

	$strip_var_list = array('email' => 'email', 'icq' => 'icq', 'aim' => 'aim', 'msn' => 'msn', 'yim' => 'yim', 'website' => 'website', 'location' => 'location', 'occupation' => 'occupation', 'interests' => 'interests', 'car_mark' => 'car_mark', 'car_mark_choice' => 'car_mark_choice', 'car_model' => 'car_model', 'car_model_choice' => 'car_model_choice', 'car_year' => 'car_year', 'car_year_choice' => 'car_year_choice', 'car_engine' => 'car_engine', 'car_engine_choice' => 'car_engine_choice', 'car_wheel' => 'car_wheel', 'car_trans' => 'car_trans', 'car_color' => 'car_color', 'car_rt' => 'car_rt', 'car_sixty' => 'car_sixty', 'car_three' => 'car_three', 'car_eigth' => 'car_eigth', 'car_eigthm' => 'car_eigthm', 'car_thou' => 'car_thou', 'car_quart' => 'car_quart', 'car_quartm' => 'car_quartm', 'mod_engine' => 'mod_engine', 'mod_exterior' => 'mod_exterior', 'mod_interior' => 'mod_interior', 'mod_rims' => 'mod_rims', 'mod_audio' => 'mod_audio', 'mod_future' => 'mod_future', 'confirm_code' => 'confirm_code', 'name_first' => 'name_first', 'name_last' => 'name_last', 'info' => 'info');
// Begin Map Mod 
$strip_vars_mapmod = array('longitude' => 'longitude', 'latitude' => 'latitude'); 
$strip_var_list = array_merge ($strip_var_list, $strip_vars_mapmod); 
// End Map Mod

	// Strip all tags from data ... may p**s some people off, bah, strip_tags is
	// doing the job but can still break HTML output ... have no choice, have
	// to use htmlspecialchars ... be prepared to be moaned at.
	while( list($var, $param) = @each($strip_var_list) )
	{
		if ( !empty($HTTP_POST_VARS[$param]) )
		{
			$$var = trim(htmlspecialchars($HTTP_POST_VARS[$param]));
		}
	}

$username = ( !empty($HTTP_POST_VARS['username']) ) ? phpbb_clean_username($HTTP_POST_VARS['username']) : '';
	$trim_var_list = array('cur_password' => 'cur_password', 'new_password' => 'new_password', 'password_confirm' => 'password_confirm', 'signature' => 'signature');

	while( list($var, $param) = @each($trim_var_list) )
	{
		if ( !empty($HTTP_POST_VARS[$param]) )
		{
			$$var = trim($HTTP_POST_VARS[$param]);
		}
	}

	$signature = (isset($signature)) ? str_replace('<br />', "\n", $signature) : '';
	$signature_bbcode_uid = '';
	// Start add - Gender MOD
	$gender = ( isset($HTTP_POST_VARS['gender']) ) ? intval ($HTTP_POST_VARS['gender']) : 0;
	// End add - Gender MOD
	// Start add - Birthday MOD
	if (isset($HTTP_POST_VARS['birthday']) )
	{
		$birthday = intval ($HTTP_POST_VARS['birthday']);
		if ($birthday!=999999)
		{
			$b_day = realdate('j',$birthday); 
			$b_md = realdate('n',$birthday); 
			$b_year = realdate('Y',$birthday);
		}
	} else
	{
		$b_day = ( isset($HTTP_POST_VARS['b_day']) ) ? intval ($HTTP_POST_VARS['b_day']) : 0;
		$b_md = ( isset($HTTP_POST_VARS['b_md']) ) ? intval ($HTTP_POST_VARS['b_md']) : 0;
		$b_year = ( isset($HTTP_POST_VARS['b_year']) ) ? intval ($HTTP_POST_VARS['b_year']) : 0;
		if ($b_day && $b_md && $b_year)
		{
			$birthday = mkrealdate($b_day,$b_md,$b_year);
		} else
		{
			$birthday = 999999;
		}
	}
// End add - Birthday MOD
	// Run some validation on the optional fields. These are pass-by-ref, so they'll be changed to
	// empty strings if they fail.
	validate_optional_fields($icq, $aim, $msn, $yim, $website, $location, $occupation, $interests, $signature, $user_absence_text);

	$viewemail = ( isset($HTTP_POST_VARS['viewemail']) ) ? ( ($HTTP_POST_VARS['viewemail']) ? TRUE : 0 ) : 0;
	$user_allow_new_img_popup = ( isset($HTTP_POST_VARS['user_allow_new_img_popup']) ) ? ( ($HTTP_POST_VARS['user_allow_new_img_popup']) ? TRUE : 0 ) : 0;
	$user_absence_mode = abs( intval($HTTP_POST_VARS['user_absence_mode']) );
	$user_absence = ( isset($HTTP_POST_VARS['user_absence']) ) ? ( ($HTTP_POST_VARS['user_absence']) ? TRUE : 0 ) : 0;
	$user_absence_text = htmlspecialchars($HTTP_POST_VARS['user_absence_text']);
	$allowviewonline = ( isset($HTTP_POST_VARS['hideonline']) ) ? ( ($HTTP_POST_VARS['hideonline']) ? 0 : TRUE ) : TRUE;
	$notifyreply = ( isset($HTTP_POST_VARS['notifyreply']) ) ? ( ($HTTP_POST_VARS['notifyreply']) ? TRUE : 0 ) : 0;
	$notifypm = ( isset($HTTP_POST_VARS['notifypm']) ) ? ( ($HTTP_POST_VARS['notifypm']) ? TRUE : 0 ) : TRUE;
	$popup_pm = ( isset($HTTP_POST_VARS['popup_pm']) ) ? ( ($HTTP_POST_VARS['popup_pm']) ? TRUE : 0 ) : TRUE;
	$setbm = ( isset($HTTP_POST_VARS['setbm']) ) ? ( ($HTTP_POST_VARS['setbm']) ? TRUE : 0 ) : 0;
	
	if ( $mode == 'register' )
	{
		$attachsig = ( isset($HTTP_POST_VARS['attachsig']) ) ? ( ($HTTP_POST_VARS['attachsig']) ? TRUE : 0 ) : $board_config['allow_sig'];

		$allowhtml = ( isset($HTTP_POST_VARS['allowhtml']) ) ? ( ($HTTP_POST_VARS['allowhtml']) ? TRUE : 0 ) : $board_config['allow_html'];
		$allowbbcode = ( isset($HTTP_POST_VARS['allowbbcode']) ) ? ( ($HTTP_POST_VARS['allowbbcode']) ? TRUE : 0 ) : $board_config['allow_bbcode'];
		$allowsmilies = ( isset($HTTP_POST_VARS['allowsmilies']) ) ? ( ($HTTP_POST_VARS['allowsmilies']) ? TRUE : 0 ) : $board_config['allow_smilies'];
	}
	else
	{
		$attachsig = ( isset($HTTP_POST_VARS['attachsig']) ) ? ( ($HTTP_POST_VARS['attachsig']) ? TRUE : 0 ) : $userdata['user_attachsig'];

		$allowhtml = ( isset($HTTP_POST_VARS['allowhtml']) ) ? ( ($HTTP_POST_VARS['allowhtml']) ? TRUE : 0 ) : $userdata['user_allowhtml'];
		$allowbbcode = ( isset($HTTP_POST_VARS['allowbbcode']) ) ? ( ($HTTP_POST_VARS['allowbbcode']) ? TRUE : 0 ) : $userdata['user_allowbbcode'];
		$allowsmilies = ( isset($HTTP_POST_VARS['allowsmilies']) ) ? ( ($HTTP_POST_VARS['allowsmilies']) ? TRUE : 0 ) : $userdata['user_allowsmile'];
	}

	$user_style = ( isset($HTTP_POST_VARS['style']) ) ? intval($HTTP_POST_VARS['style']) : $board_config['default_style'];

	if ( !empty($HTTP_POST_VARS['language']) )
	{
		if ( preg_match('/^[a-z_]+$/i', $HTTP_POST_VARS['language']) )
		{
			$user_lang = htmlspecialchars($HTTP_POST_VARS['language']);
		}
		else
		{
			$error = true;
			$error_msg = $lang['Fields_empty'];
		}
	}
	else
	{
		$user_lang = $board_config['default_lang'];
	}

	$user_timezone = ( isset($HTTP_POST_VARS['timezone']) ) ? doubleval($HTTP_POST_VARS['timezone']) : $board_config['board_timezone'];
	// FLAGHACK-start
	$user_flag = ( !empty($HTTP_POST_VARS['user_flag']) ) ? $HTTP_POST_VARS['user_flag'] : '' ;
	// FLAGHACK-end
	$sql = "SELECT config_value
		FROM " . CONFIG_TABLE . "
		WHERE config_name = 'default_dateformat'";
	if ( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, 'Could not select default dateformat', '', __LINE__, __FILE__, $sql);
	}
	$row = $db->sql_fetchrow($result);
	$board_config['default_dateformat'] = $row['config_value'];
	$user_dateformat = ( !empty($HTTP_POST_VARS['dateformat']) ) ? trim(htmlspecialchars($HTTP_POST_VARS['dateformat'])) : $board_config['default_dateformat'];

	$user_avatar_local = ( isset($HTTP_POST_VARS['avatarselect']) && !empty($HTTP_POST_VARS['submitavatar']) && $board_config['allow_avatar_local'] ) ? htmlspecialchars($HTTP_POST_VARS['avatarselect']) : ( ( isset($HTTP_POST_VARS['avatarlocal'])  ) ? htmlspecialchars($HTTP_POST_VARS['avatarlocal']) : '' );
   $user_avatar_category = ( isset($HTTP_POST_VARS['avatarcatname']) && $board_config['allow_avatar_local'] ) ? htmlspecialchars($HTTP_POST_VARS['avatarcatname']) : '' ;

	$user_avatar_remoteurl = ( !empty($HTTP_POST_VARS['avatarremoteurl']) ) ? trim(htmlspecialchars($HTTP_POST_VARS['avatarremoteurl'])) : '';
	$user_avatar_upload = ( !empty($HTTP_POST_VARS['avatarurl']) ) ? trim($HTTP_POST_VARS['avatarurl']) : ( ( $HTTP_POST_FILES['avatar']['tmp_name'] != "none") ? $HTTP_POST_FILES['avatar']['tmp_name'] : '' );
	$user_avatar_name = ( !empty($HTTP_POST_FILES['avatar']['name']) ) ? $HTTP_POST_FILES['avatar']['name'] : '';
	$user_avatar_size = ( !empty($HTTP_POST_FILES['avatar']['size']) ) ? $HTTP_POST_FILES['avatar']['size'] : 0;
	$user_avatar_filetype = ( !empty($HTTP_POST_FILES['avatar']['type']) ) ? $HTTP_POST_FILES['avatar']['type'] : '';

   $user_avatar = ( empty($user_avatar_local) && $mode == 'editprofile' ) ? $userdata['user_avatar'] : ''; 
   $user_avatar_type = ( empty($user_avatar_local) && $mode == 'editprofile' ) ? $userdata['user_avatar_type'] : '';
// Begin Map Mod 
$longitude = ( !empty($HTTP_POST_VARS['longitude']) ) ? str_replace(',','.',trim(strip_tags( $HTTP_POST_VARS['longitude'] ) ) ) : ''; 
$latitude = ( !empty($HTTP_POST_VARS['latitude']) ) ? str_replace(',','.',trim(strip_tags( $HTTP_POST_VARS['latitude'] ) ) ) : ''; 
// End Map Mod

	if ( (isset($HTTP_POST_VARS['avatargallery']) || isset($HTTP_POST_VARS['submitavatar']) || isset($HTTP_POST_VARS['cancelavatar'])) && (!isset($HTTP_POST_VARS['submit'])) )
	{
		$username = stripslashes($username);
        $name_first = stripslashes($name_first);
        $name_last = stripslashes($name_last);
		$email = stripslashes($email);
		$cur_password = htmlspecialchars(stripslashes($cur_password));
		$new_password = htmlspecialchars(stripslashes($new_password));
		$password_confirm = htmlspecialchars(stripslashes($password_confirm));

		$icq = stripslashes($icq);
		$aim = stripslashes($aim);
		$msn = stripslashes($msn);
		$yim = stripslashes($yim);

		$website = stripslashes($website);
		$location = stripslashes($location);
		$occupation = stripslashes($occupation);
		$interests = stripslashes($interests);
	//
	// START Joe's Car Mod
	//
	$car_mark = stripslashes($car_mark);
        $car_mark_choice = stripslashes($car_mark_choice);

        $car_model = stripslashes($car_model);

        $car_model_choice = stripslashes($car_model_choice);

        $car_year = stripslashes($car_year);
        $car_year_choice = stripslashes($car_year_choice);
        $car_engine = stripslashes($car_engine);
        $car_engine_choice = stripslashes($car_engine_choice);

        $car_wheel = stripslashes($car_wheel);
        $car_trans = stripslashes($car_trans);
        $car_color = stripslashes($car_color);

        $car_rt = stripslashes($car_rt);
        $car_sixty = stripslashes($car_sixty);
        $car_three = stripslashes($car_three);
        $car_eigth = stripslashes($car_eigth);
        $car_eigthm = stripslashes($car_eigthm);
        $car_thou = stripslashes($car_thou);
        $car_quart = stripslashes($car_quart);
        $car_quartm = stripslashes($car_quartm);

        $mod_engine = stripslashes($mod_engine);
        $mod_exterior = stripslashes($mod_exterior);
        $mod_interior = stripslashes($mod_interior);
        $mod_rims = stripslashes($mod_rims);
        $mod_audio = stripslashes($mod_audio);
        $mod_future = stripslashes($mod_future);
	//
	// END Joe's Car Mod
	//
		$info = stripslashes($info);
		$user_absence_text = stripslashes($user_absence_text);
		$signature = htmlspecialchars(stripslashes($signature));

		$user_lang = stripslashes($user_lang);
		$user_dateformat = stripslashes($user_dateformat);

		if ( !isset($HTTP_POST_VARS['cancelavatar']))
		{
			$user_avatar = $user_avatar_category . '/' . $user_avatar_local;
			$user_avatar_type = USER_AVATAR_GALLERY;
		}
	}
}

//
// Let's make sure the user isn't logged in while registering,
// and ensure that they were trying to register a second time
// (Prevents double registrations)
//
if ($mode == 'register' && ($userdata['session_logged_in'] || $username == $userdata['username']))
{
	message_die(GENERAL_MESSAGE, $lang['Username_taken'], '', __LINE__, __FILE__);
}

//
// Did the user submit? In this case build a query to update the users profile in the DB
//
if ( isset($HTTP_POST_VARS['submit']) )
{
	include($phpbb_root_path . 'includes/usercp_avatar.'.$phpEx);

	$passwd_sql = '';
	if ( $mode == 'editprofile' )
	{
		if ( $user_id != $userdata['user_id'] )
		{
			$error = TRUE;
			$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Wrong_Profile'];
		}
	///
	/// Begin Names in Profile MOD
	///

	if ( $board_config['name_first_required'] )
	 {
	  if ( empty($name_first) )
	  {
	  $error = TRUE;
	  $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['name_first_empty'];
	  }
	 }
 
	 if ( $board_config['name_last_required'] )
	 {
	  if ( empty($name_last) )
	  {
	  $error = TRUE;
	  $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['name_last_empty'];
	  }
	 }

	///
	/// End Names in Profile MOD
	///
	}
	else if ( $mode == 'register' )
	{
	///
	/// Begin Names in Profile MOD
	///

	if ( $board_config['name_first_required'] )
	 {
	  if ( empty($name_first) )
	  {
	  $error = TRUE;
	  $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['name_first_empty'];
	  }
	 }
 
	 if ( $board_config['name_last_required'] )
	 {
	  if ( empty($name_last) )
	  {
	  $error = TRUE;
	  $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['name_last_empty'];
	  }
	 }

	///
	/// End Names in Profile MOD
	///
		if ( empty($username) || empty($new_password) || empty($password_confirm) || empty($email) )
		{
			$error = TRUE;
			$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Fields_empty'];
		}
		//
		// Anti Robotic Registration
		//
		$sql = "SELECT * FROM " . ANTI_ROBOT_TABLE . " WHERE session_id = '" . $userdata['session_id'] . "' LIMIT 1";
		if( !$result = $db->sql_query($sql) )
		{
			message_die(GENERAL_ERROR, 'Could not obtain registration information', '', __LINE__, __FILE__, $sql);
		}

		$anti_robot_row = $db->sql_fetchrow($result);
 
		if (( strtolower($HTTP_POST_VARS['reg_key']) != $anti_robot_row['reg_key'] ) or ($anti_robot_row['reg_key'] == ''))
		{
			$error = TRUE;
			$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Wrong_reg_key'];
		}
		else
		{
			$sql = "DELETE FROM " . ANTI_ROBOT_TABLE . " WHERE session_id = '" . $userdata['session_id'] . "'";
			if( !$result = $db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, 'Could not delete validation key', '', __LINE__, __FILE__, $sql);
			}
		}
		// --------------------------
		//
	}

	$passwd_sql = '';
	if ( !empty($new_password) && !empty($password_confirm) )
	{
		// Start add - Protect user account MOD
// validate that the password is complex
$result = validate_complex_password ($username, $new_password);
if ( $result['error'] )
{
	$error = TRUE;
	$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $result['error_msg'];

}
// End add - Protect user account MOD
		if ( $new_password != $password_confirm )
		{
			$error = TRUE;
			$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Password_mismatch'];
		}
		else if ( strlen($new_password) > 32 )
		{
			$error = TRUE;
			$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Password_long'];
		}
		else
		{
			if ( $mode == 'editprofile' )
			{
				$sql = "SELECT user_password
					FROM " . USERS_TABLE . "
					WHERE user_id = $user_id";
				if ( !($result = $db->sql_query($sql)) )
				{
					message_die(GENERAL_ERROR, 'Could not obtain user_password information', '', __LINE__, __FILE__, $sql);
				}

				$row = $db->sql_fetchrow($result);

				if ( $row['user_password'] != md5($cur_password) )
				{
					$error = TRUE;
					$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Current_password_mismatch'];
				}
			}

			if ( !$error )
			{
				$new_password = md5($new_password);
				$passwd_sql = "user_password = '$new_password', ";
			}
		}
	}
	else if ( ( empty($new_password) && !empty($password_confirm) ) || ( !empty($new_password) && empty($password_confirm) ) )
	{
		$error = TRUE;
		$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Password_mismatch'];
	}

	//
	// Do a ban check on this email address
	//
	if ( $email != $userdata['user_email'] || $mode == 'register' )
	{
		$result = validate_email($email);
		if ( $result['error'] )
		{
			$email = $userdata['user_email'];

			$error = TRUE;
			$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $result['error_msg'];
		}

		if ( $mode == 'editprofile' )
		{
			$sql = "SELECT user_password
				FROM " . USERS_TABLE . "
				WHERE user_id = $user_id";
			if ( !($result = $db->sql_query($sql)) )
			{
				message_die(GENERAL_ERROR, 'Could not obtain user_password information', '', __LINE__, __FILE__, $sql);
			}

			$row = $db->sql_fetchrow($result);

			if ( $row['user_password'] != md5($cur_password) )
			{
				$email = $userdata['user_email'];

				$error = TRUE;
				$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Current_password_mismatch'];
			}
		}
	}

	$username_sql = '';
	if ( $board_config['allow_namechange'] || $mode == 'register' )
	{
		if ( empty($username) )
		{
			// Error is already triggered, since one field is empty.
			$error = TRUE;
		}
		else if ( $username != $userdata['username'] || $mode == 'register' )
		{
			if (strtolower($username) != strtolower($userdata['username']) || $mode == 'register')
			{
				$result = validate_username($username);
				if ( $result['error'] )
				{
					$error = TRUE;
					$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $result['error_msg'];
				}
			}

			if (!$error)
			{
				$username_sql = "username = '" . str_replace("\'", "''", $username) . "', ";
			}
		}
	}

	if ( $signature != '' )
	{
		if ( strlen($signature) > $board_config['max_sig_chars'] )
		{
			$error = TRUE;
			$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Signature_too_long'];
		}

		if ( !isset($signature_bbcode_uid) || $signature_bbcode_uid == '' )
		{
			$signature_bbcode_uid = ( $allowbbcode ) ? make_bbcode_uid() : '';
		}
		$signature = prepare_message($signature, $allowhtml, $allowbbcode, $allowsmilies, $signature_bbcode_uid);
	}

	if ( $website != '' )
	{
		rawurlencode($website);
	}

	$avatar_sql = '';

	if ( isset($HTTP_POST_VARS['avatardel']) && $mode == 'editprofile' )
	{
      $avatar_sql = user_avatar_delete($userdata['user_avatar_type'], $userdata['user_avatar']); 
   } 
   else 
   if ( ( !empty($user_avatar_upload) || !empty($user_avatar_name) ) && $board_config['allow_avatar_upload'] )
	{
		if ( !empty($user_avatar_upload) )
		{
			$avatar_mode = (empty($user_avatar_name)) ? 'remote' : 'local'; 
			$avatar_sql = user_avatar_upload($mode, $avatar_mode, $userdata['user_avatar'], $userdata['user_avatar_type'], $error, $error_msg, $user_avatar_upload, $user_avatar_name, $user_avatar_size, $user_avatar_filetype);
		}
		else if ( !empty($user_avatar_name) )
		{
			$l_avatar_size = sprintf($lang['Avatar_filesize'], round($board_config['avatar_filesize'] / 1024));

			$error = true;
			$error_msg .= ( ( !empty($error_msg) ) ? '<br />' : '' ) . $l_avatar_size;
		}
	}
	else if ( $user_avatar_remoteurl != '' && $board_config['allow_avatar_remote'] )
	{
user_avatar_delete($userdata['user_avatar_type'], $userdata['user_avatar']);
		$avatar_sql = user_avatar_url($mode, $error, $error_msg, $user_avatar_remoteurl);
	}
	else if ( $user_avatar_local != '' && $board_config['allow_avatar_local'] )
	{
      user_avatar_delete($userdata['user_avatar_type'], $userdata['user_avatar']); 
      $avatar_sql = user_avatar_gallery($mode, $error, $error_msg, $user_avatar_local, $user_avatar_category);
	}
	// Start add - Birthday MOD
// find the birthday values, reflected by the $lang['Submit_date_format']
	if ($b_day || $b_md || $b_year) //if a birthday is submited, then validate it
	{
		$user_age=(date('md')>=$b_md.(($b_day <= 9) ? '0':'').$b_day) ? date('Y') - $b_year : date('Y') - $b_year - 1 ;
		// Check date, maximum / minimum user age
		if (!checkdate($b_md,$b_day,$b_year))
		{
			$error = TRUE;
			if( isset($error_msg) )$error_msg .= "<br />";
			$error_msg .= $lang['Wrong_birthday_format'];
		} else
		if ($user_age>$board_config['max_user_age'])
		{
			$error = TRUE;
			if( isset($error_msg) )$error_msg .= "<br />";
			$error_msg .= sprintf($lang['Birthday_to_high'],$board_config['max_user_age']);
		} else
		if ($user_age<$board_config['min_user_age'])
		{
			$error = TRUE;
			if( isset($error_msg) )$error_msg .= "<br />";
			$error_msg .= sprintf($lang['Birthday_to_low'],$board_config['min_user_age']);
		} else
		{
			$birthday = ($error) ? $birthday : mkrealdate($b_day,$b_md,$b_year);
			$next_birthday_greeting = (date('md')<$b_md.(($b_day <= 9) ? '0':'').$b_day) ? date('Y'):date('Y')+1 ;
		}
	} else
	{
		if ($board_config['birthday_required'])
		{
			$error = TRUE;
			if( isset($error_msg) )$error_msg .= "<br />";
			$error_msg .= sprintf($lang['Birthday_require']);
		}
		$birthday = 999999;
	}
// End add - Birthday MOD
	if ( !$error )
	{
		if ( $avatar_sql == '' )
		{
			$avatar_sql = ( $mode == 'editprofile' ) ? '' : "'', " . USER_AVATAR_NONE;
		}

		if ( $mode == 'editprofile' )
		{
			if ( $email != $userdata['user_email'] && $board_config['require_activation'] != USER_ACTIVATION_NONE && $userdata['user_level'] != ADMIN )
			{
				$user_active = 0;

				$user_actkey = gen_rand_string(true);
				$key_len = 54 - ( strlen($server_url) );
				$key_len = ( $key_len > 6 ) ? $key_len : 6;
				$user_actkey = substr($user_actkey, 0, $key_len);

				if ( $userdata['session_logged_in'] )
				{
					session_end($userdata['session_id'], $userdata['user_id']);
				}
			}
			else
			{
				$user_active = 'user_active'; 
				$user_actkey = 'user_actkey'; 
				// Start add - Protect user account MOD
				$passwd_sql .= (empty($passwd_sql)) ? "" : " user_passwd_change=".time().",";
				// End add - Protect user account MOD
			}

               		$car_engine_choice = ($car_engine_choice == $lang['Car_Engine_Choice']['0']) ? '' : $car_engine_choice;
                        $car_mark_choice = ($car_mark_choice == $lang['Car_Mark_Choice']['0']) ? '' : $car_mark_choice;
                        $car_model_choice = ($car_model_choice == $lang['Car_Model_Choice']['0']) ? '' : $car_model_choice;
                        $car_year_choice = ($car_year_choice == $lang['Car_Year_Choice']['0']) ? '' : $car_year_choice;
			$sql = "UPDATE " . USERS_TABLE . "
				SET " . $username_sql . $passwd_sql . "user_email = '" . str_replace("\'", "''", $email) ."', user_icq = '" . str_replace("\'", "''", $icq) . "', user_website = '" . str_replace("\'", "''", $website) . "', user_occ = '" . str_replace("\'", "''", $occupation) . "', user_from = '" . str_replace("\'", "''", $location) . "', user_from_flag = '$user_flag', user_interests = '" . str_replace("\'", "''", $interests) . "', user_car_mark = '" . str_replace("\'", "''", $car_mark) . "', user_car_mark_choice = '" . str_replace("\'", "''", $car_mark_choice) . "', user_car_model = '" . str_replace("\'", "''", $car_model) . "', user_car_model_choice = '" . str_replace("\'", "''", $car_model_choice) . "', user_car_year = '" . str_replace("\'", "''", $car_year) . "', user_car_year_choice = '" . str_replace("\'", "''", $car_year_choice) . "', user_car_engine = '" . str_replace("\'", "''", $car_engine) . "', user_car_engine_choice = '" . str_replace("\'", "''", $car_engine_choice) . "', user_car_wheel = '" . str_replace("\'", "''", $car_wheel) . "', user_car_trans = '" . str_replace("\'", "''", $car_trans) . "', user_car_color = '" . str_replace("\'", "''", $car_color) . "', user_car_rt = '" . str_replace("\'", "''", $car_rt) . "', user_car_sixty = '" . str_replace("\'", "''", $car_sixty) . "', user_car_three = '" . str_replace("\'", "''", $car_three) . "', user_car_eigth = '" . str_replace("\'", "''", $car_eigth) . "', user_car_eigthm = '" . str_replace("\'", "''", $car_eigthm) . "', user_car_thou = '" . str_replace("\'", "''", $car_thou) . "', user_car_quart = '" . str_replace("\'", "''", $car_quart) . "', user_car_quartm = '" . str_replace("\'", "''", $car_quartm) . "', user_mod_engine = '" . str_replace("\'", "''", $mod_engine) . "', user_mod_exterior = '" . str_replace("\'", "''", $mod_exterior) . "', user_mod_interior = '" . str_replace("\'", "''", $mod_interior) . "', user_mod_rims = '" . str_replace("\'", "''", $mod_rims) . "', user_mod_audio = '" . str_replace("\'", "''", $mod_audio) . "', user_mod_future = '" . str_replace("\'", "''", $mod_future) . "', user_name_first = '" . str_replace("\'", "''", $name_first) . "', user_name_last = '" . str_replace("\'", "''", $name_last) . "', user_allow_new_img_popup = $user_allow_new_img_popup, user_modell = '" . str_replace("\'", "''", $info) . "', user_absence_mode = $user_absence_mode, user_absence = $user_absence, user_absence_text = '" . str_replace("\'", "''", $user_absence_text) . "', user_birthday = '$birthday', user_next_birthday_greeting = '$next_birthday_greeting', user_viewemail = $viewemail, user_aim = '" . str_replace("\'", "''", str_replace(' ', '+', $aim)) . "', user_yim = '" . str_replace("\'", "''", $yim) . "', user_msnm = '" . str_replace("\'", "''", $msn) . "', user_attachsig = $attachsig, user_setbm = $setbm, user_allowsmile = $allowsmilies, user_allowhtml = $allowhtml, user_allowbbcode = $allowbbcode, user_allow_viewonline = $allowviewonline, user_notify = $notifyreply, user_notify_pm = $notifypm, user_popup_pm = $popup_pm, user_timezone = $user_timezone, user_dateformat = '" . str_replace("\'", "''", $user_dateformat) . "', user_lang = '" . str_replace("\'", "''", $user_lang) . "', user_style = $user_style, user_active = $user_active, user_actkey = '$user_actkey'" . $avatar_sql . ", user_gender = '$gender'
				WHERE user_id = $user_id";
			if ( !($result = $db->sql_query($sql)) )
			{
				message_die(GENERAL_ERROR, 'Could not update users table', '', __LINE__, __FILE__, $sql);
			}
			// We remove all stored login keys since the password has been updated
			// and change the current one (if applicable)
			if ( !empty($passwd_sql) )
			{
				session_reset_keys($user_id, $user_ip);
			}

// Begin Map Mod
$sql = "SELECT user_id
	FROM ". MAP_MOD_USER_TABLE . "
	WHERE user_id = $user_id ";
if (! $result = $db->sql_query($sql)) {
	message_die(GENERAL_ERROR, 'Could not get map data.', '', __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
if ($row['user_id']==$user_id) {
	$sql = "DELETE 
		FROM " . MAP_MOD_USER_TABLE . "
		WHERE user_id = $user_id ";
	if (! $result = $db->sql_query($sql)) {
		message_die(GENERAL_ERROR, 'Could not delete map data.', '', __LINE__, __FILE__, $sql);
	}
}
if (((float)$longitude != 0.0) || ((float)$latitude != 0.0)) {
	$sql = "INSERT INTO " .MAP_MOD_USER_TABLE. "
	VALUES (" . intval($user_id) . ", " . (float)$longitude . "," . (float)$latitude. ")";
	if(! $result = $db->sql_query($sql)) {
		message_die(GENERAL_ERROR, 'Could not update map table.', '', __LINE__, __FILE__, $sql);
	}
}
// End Map Mod
			if ( !$user_active )
			{
				//
				// The users account has been deactivated, send them an email with a new activation key
				//
				include($phpbb_root_path . 'includes/emailer.'.$phpEx);
				$emailer = new emailer($board_config['smtp_delivery']);

             if ( $board_config['require_activation'] != USER_ACTIVATION_ADMIN ) 
             { 
                $emailer->from($board_config['board_email']); 
                $emailer->replyto($board_config['board_email']); 
  
                $emailer->use_template('user_activate', stripslashes($user_lang)); 
                $emailer->email_address($email); 
                $emailer->set_subject($lang['Reactivate']); 
  
                $emailer->assign_vars(array( 
                   'SITENAME' => $board_config['sitename'], 
                   'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr(str_replace("\'", "'", $username), 0, 25)), 
                   'EMAIL_SIG' => (!empty($board_config['board_email_sig'])) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '', 
  
                   'U_ACTIVATE' => $server_url . '?mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey) 
                ); 
                $emailer->send(); 
                $emailer->reset(); 
             } 
             else if ( $board_config['require_activation'] == USER_ACTIVATION_ADMIN ) 
             { 
                $sql = 'SELECT user_email, user_lang 
                   FROM ' . USERS_TABLE . ' 
                   WHERE user_level = ' . ADMIN; 
                 
                if ( !($result = $db->sql_query($sql)) ) 
                { 
                   message_die(GENERAL_ERROR, 'Could not select Administrators', '', __LINE__, __FILE__, $sql); 
                } 
                 
                while ($row = $db->sql_fetchrow($result)) 
                { 
                   $emailer->from($board_config['board_email']); 
                   $emailer->replyto($board_config['board_email']); 
                    
                   $emailer->email_address(trim($row['user_email'])); 
                   $emailer->use_template("admin_activate", $row['user_lang']); 
                   $emailer->set_subject($lang['Reactivate']); 
  
                   $emailer->assign_vars(array( 
                      'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr(str_replace("\'", "'", $username), 0, 25)), 
                      'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']), 
  
                      'U_ACTIVATE' => $server_url . '?mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey) 
                   ); 
                   $emailer->send(); 
                   $emailer->reset(); 
                } 
                $db->sql_freeresult($result); 
             }

				$message = $lang['Profile_updated_inactive'] . '<br /><br />' . sprintf($lang['Click_return_index'],  '<a href="' . append_sid("portal.$phpEx") . '">', '</a>');
			}
			else
			{
				$message = $lang['Profile_updated'] . '<br /><br />' . sprintf($lang['Click_return_index'],  '<a href="' . append_sid("portal.$phpEx") . '">', '</a>');
			}

			$template->assign_vars(array(
				"META" => '<meta http-equiv="refresh" content="5;url=' . append_sid("portal.$phpEx") . '">')
			);

			message_die(GENERAL_MESSAGE, $message);
		}
		else
		{
			$sql = "SELECT MAX(user_id) AS total
				FROM " . USERS_TABLE;
			if ( !($result = $db->sql_query($sql)) )
			{
				message_die(GENERAL_ERROR, 'Could not obtain next user_id information', '', __LINE__, __FILE__, $sql);
			}

			if ( !($row = $db->sql_fetchrow($result)) )
			{
				message_die(GENERAL_ERROR, 'Could not obtain next user_id information', '', __LINE__, __FILE__, $sql);
			}
			$user_id = $row['total'] + 1;

            // CBACK CrackerTracker Register Flood Protection
            $stime = time() + $ctracker_config['regtime'];
            $sql = "UPDATE " . CTRACK . " SET value = " . $stime . " WHERE name = 'lastreg'";
    	    $db->sql_query($sql);

            if(!empty($HTTP_SERVER_VARS['REMOTE_ADDR']))
            {
	          $sql = "UPDATE " . CTRACK . " SET value = '" . $HTTP_SERVER_VARS['REMOTE_ADDR'] . "' WHERE name = 'lastreg_ip'";
              $db->sql_query($sql);
            }
            // END CBACK CrackerTracker Register Flood Protection
			//
			// Get current date
			//
			$sql = "INSERT INTO " . USERS_TABLE . "	(user_id, username, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_from_flag, user_interests, user_car_mark, user_car_mark_choice, user_car_model, user_car_model_choice, user_car_year, user_car_year_choice, user_car_engine, user_car_engine_choice, user_car_wheel, user_car_trans, user_car_color, user_car_rt, user_car_sixty, user_car_three, user_car_eigth, user_car_eigthm, user_car_thou, user_car_quart, user_car_quartm, user_mod_engine, user_mod_exterior, user_mod_interior, user_mod_rims, user_mod_audio, user_mod_future, user_name_first, user_name_last, user_allow_new_img_popup, user_modell, user_absence_mode, user_absence, user_absence_text, user_sig, user_sig_bbcode_uid, user_avatar, user_avatar_type, user_viewemail, user_aim, user_yim, user_msnm, user_attachsig, user_setbm, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_viewonline, user_notify, user_notify_pm, user_popup_pm, user_timezone, user_dateformat, user_lang, user_style, user_gender, user_level, user_allow_pm, user_birthday, user_next_birthday_greeting, user_passwd_change, user_active, user_actkey)
				VALUES ($user_id, '" . str_replace("\'", "''", $username) . "', " . time() . ", '" . str_replace("\'", "''", $new_password) . "', '" . str_replace("\'", "''", $email) . "', '" . str_replace("\'", "''", $icq) . "', '" . str_replace("\'", "''", $website) . "', '" . str_replace("\'", "''", $occupation) . "', '" . str_replace("\'", "''", $location) . "', '$user_flag', '" . str_replace("\'", "''", $interests) . "', '" . str_replace("\'", "''", $car_mark) . "', '" . str_replace("\'", "''", $car_mark_choice) . "', '" . str_replace("\'", "''", $car_model) . "', '" . str_replace("\'", "''", $car_model_choice) . "', '" . str_replace("\'", "''", $car_year) . "', '" . str_replace("\'", "''", $car_year_choice) . "', '" . str_replace("\'", "''", $car_engine) . "', '" . str_replace("\'", "''", $car_engine_choice) . "', '" . str_replace("\'", "''", $car_wheel) . "', '" . str_replace("\'", "''", $car_trans) . "', '" . str_replace("\'", "''", $car_color) . "', '" . str_replace("\'", "''", $car_rt) . "', '" . str_replace("\'", "''", $car_sixty) . "', '" . str_replace("\'", "''", $car_three) . "', '" . str_replace("\'", "''", $car_eigth) . "', '" . str_replace("\'", "''", $car_eigthm) . "', '" . str_replace("\'", "''", $car_thou) . "', '" . str_replace("\'", "''", $car_quart) . "', '" . str_replace("\'", "''", $car_quartm) . "', '" . str_replace("\'", "''", $mod_engine) . "', '" . str_replace("\'", "''", $mod_exterior) . "', '" . str_replace("\'", "''", $mod_interior) . "', '" . str_replace("\'", "''", $mod_rims) . "', '" . str_replace("\'", "''", $mod_audio) . "', '" . str_replace("\'", "''", $mod_future) . "', '" . str_replace("\'", "''", $name_first) . "', '" . str_replace("\'", "''", $name_last) . "', $user_allow_new_img_popup, '" . str_replace("\'", "''", $info) . "', $user_absence_mode, $user_absence, '" . str_replace("\'", "''", $user_absence_text) . "', '" . str_replace("\'", "''", $signature) . "', '$signature_bbcode_uid', $avatar_sql, $viewemail, '" . str_replace("\'", "''", str_replace(' ', '+', $aim)) . "', '" . str_replace("\'", "''", $yim) . "', '" . str_replace("\'", "''", $msn) . "', $attachsig, $setbm, $allowsmilies, $allowhtml, $allowbbcode, $allowviewonline, $notifyreply, $notifypm, $popup_pm, $user_timezone, '" . str_replace("\'", "''", $user_dateformat) . "', '" . str_replace("\'", "''", $user_lang) . "', $user_style, '$gender', 0, 1, '$birthday', '$next_birthday_greeting', ".time().",";
			if ( $board_config['require_activation'] == USER_ACTIVATION_SELF || $board_config['require_activation'] == USER_ACTIVATION_ADMIN || $coppa )
			{
				$user_actkey = gen_rand_string(true);
				$key_len = 54 - (strlen($server_url));
				$key_len = ( $key_len > 6 ) ? $key_len : 6;
				$user_actkey = substr($user_actkey, 0, $key_len);
				$sql .= "0, '" . str_replace("\'", "''", $user_actkey) . "')";
			}
			else
			{
				$sql .= "1, '')";
			}

			if ( !($result = $db->sql_query($sql, BEGIN_TRANSACTION)) )
			{
				message_die(GENERAL_ERROR, 'Could not insert data into users table', '', __LINE__, __FILE__, $sql);
			}
// Begin Map Mod
if (((float)$longitude != 0.0) || ((float)$latitude != 0.0)) {
	$sql = "INSERT INTO " . MAP_MOD_USER_TABLE . " (user_id, longitude, latitude)
		VALUES (" . intval($user_id) . ", " . (float)$longitude . "," . (float)$latitude . ")";
	if(! $result = $db->sql_query($sql))
	{
		message_die(GENERAL_ERROR, 'Could not update map table.', '', __LINE__, __FILE__, $sql);
	}
}
// End Map Mod

			$sql = "INSERT INTO " . GROUPS_TABLE . " (group_name, group_description, group_single_user, group_moderator)
				VALUES ('', 'Personal User', 1, 0)";
			if ( !($result = $db->sql_query($sql)) )
			{
				message_die(GENERAL_ERROR, 'Could not insert data into groups table', '', __LINE__, __FILE__, $sql);
			}

			$group_id = $db->sql_nextid();

			$sql = "INSERT INTO " . USER_GROUP_TABLE . " (user_id, group_id, user_pending)
				VALUES ($user_id, $group_id, 0)";
			if( !($result = $db->sql_query($sql, END_TRANSACTION)) )
			{
				message_die(GENERAL_ERROR, 'Could not insert data into user_group table', '', __LINE__, __FILE__, $sql);
			}

			if ( $coppa )
			{
				$message = $lang['COPPA'];
				$email_template = 'coppa_welcome_inactive';
			}
			else if ( $board_config['require_activation'] == USER_ACTIVATION_SELF )
			{
				$message = $lang['Account_inactive'];
				$email_template = 'user_welcome_inactive';
			}
			else if ( $board_config['require_activation'] == USER_ACTIVATION_ADMIN )
			{
				$message = $lang['Account_inactive_admin'];
				$email_template = 'admin_welcome_inactive';
			}
			else
			{
				$message = $lang['Account_added'];
				$email_template = 'user_welcome';
			}

			include($phpbb_root_path . 'includes/emailer.'.$phpEx);
			$emailer = new emailer($board_config['smtp_delivery']);

			$emailer->from($board_config['board_email']);
			$emailer->replyto($board_config['board_email']);

			$emailer->use_template($email_template, stripslashes($user_lang));
			$emailer->email_address($email);
			$emailer->set_subject(sprintf($lang['Welcome_subject'], $board_config['sitename']));

			if( $coppa )
			{
				$emailer->assign_vars(array(
					'SITENAME' => $board_config['sitename'],
					'WELCOME_MSG' => sprintf($lang['Welcome_subject'], $board_config['sitename']),
					'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr(str_replace("\'", "'", $username), 0, 25)),
					'PASSWORD' => $password_confirm,
					'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']),

					'FAX_INFO' => $board_config['coppa_fax'],
					'MAIL_INFO' => $board_config['coppa_mail'],
					'EMAIL_ADDRESS' => $email,
					'ICQ' => $icq,
					'AIM' => $aim,
					'YIM' => $yim,
					'MSN' => $msn,
					'WEB_SITE' => $website,
					'FROM' => $location,
					'OCC' => $occupation,
					'INTERESTS' => $interests,
					'SITENAME' => $board_config['sitename']));
			}
			else
			{
				$emailer->assign_vars(array(
					'SITENAME' => $board_config['sitename'],
					'WELCOME_MSG' => sprintf($lang['Welcome_subject'], $board_config['sitename']),
					'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr(str_replace("\'", "'", $username), 0, 25)),
					'PASSWORD' => $password_confirm,
					'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']),

					'U_ACTIVATE' => $server_url . '?mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey)
				);
			}

			$emailer->send();
			$emailer->reset();

			if ( $board_config['require_activation'] == USER_ACTIVATION_ADMIN )
			{
				$sql = "SELECT user_email, user_lang 
					FROM " . USERS_TABLE . "
					WHERE user_level = " . ADMIN;
				
				if ( !($result = $db->sql_query($sql)) )
				{
					message_die(GENERAL_ERROR, 'Could not select Administrators', '', __LINE__, __FILE__, $sql);
				}
				
				while ($row = $db->sql_fetchrow($result))
				{
					$emailer->from($board_config['board_email']);
					$emailer->replyto($board_config['board_email']);
					
					$emailer->email_address(trim($row['user_email']));
					$emailer->use_template("admin_activate", $row['user_lang']);
					$emailer->set_subject($lang['New_account_subject']);

					$emailer->assign_vars(array(
						'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr(str_replace("\'", "'", $username), 0, 25)),
						'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']),

						'U_ACTIVATE' => $server_url . '?mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey)
					);
					$emailer->send();
					$emailer->reset();
				}
				$db->sql_freeresult($result);
			}

			$message = $message . '<br /><br />' . sprintf($lang['Click_return_index'],  '<a href="' . append_sid("index.$phpEx") . '">', '</a>');

			message_die(GENERAL_MESSAGE, $message);
		} // if mode == register
	}
} // End of submit


if ( $error )
{
	//
	// If an error occured we need to stripslashes on returned data
	//
	$username = stripslashes($username);
	$name_first = stripslashes($name_first);
	$name_last = stripslashes($name_last);
	$email = stripslashes($email);
	$cur_password = '';
	$new_password = '';
	$password_confirm = '';

	$icq = stripslashes($icq);
	$aim = str_replace('+', ' ', stripslashes($aim));
	$msn = stripslashes($msn);
	$yim = stripslashes($yim);

	$website = stripslashes($website);
	$location = stripslashes($location);
	$occupation = stripslashes($occupation);
	$interests = stripslashes($interests);
	//
	// START Joe's Car Mod
	//
	$car_mark = stripslashes($car_mark);
        $car_mark_choice = stripslashes($car_mark_choice);

        $car_model = stripslashes($car_model);

        $car_model_choice = stripslashes($car_model_choice);

        $car_year = stripslashes($car_year);
        $car_year_choice = stripslashes($car_year_choice);
        $car_engine = stripslashes($car_engine);
        $car_engine_choice = stripslashes($car_engine_choice);

        $car_wheel = stripslashes($car_wheel);
        $car_trans = stripslashes($car_trans);
        $car_color = stripslashes($car_color);

        $car_rt = stripslashes($car_rt);
        $car_sixty = stripslashes($car_sixty);
        $car_three = stripslashes($car_three);
        $car_eigth = stripslashes($car_eigth);
        $car_eigthm = stripslashes($car_eigthm);
        $car_thou = stripslashes($car_thou);
        $car_quart = stripslashes($car_quart);
        $car_quartm = stripslashes($car_quartm);

        $mod_engine = stripslashes($mod_engine);
        $mod_exterior = stripslashes($mod_exterior);
        $mod_interior = stripslashes($mod_interior);
        $mod_rims = stripslashes($mod_rims);
        $mod_audio = stripslashes($mod_audio);
        $mod_future = stripslashes($mod_future);
	//
	// END Joe's Car Mod
	//
		//
		// START Joe's Car Mod
		//
		$car_mark = stripslashes($car_mark);
                $car_mark_choice = stripslashes($car_mark_choice);

                $car_model = stripslashes($car_model);

                $car_model_choice = stripslashes($car_model_choice);

                $car_year = stripslashes($car_year);
                $car_year_choice = stripslashes($car_year_choice);

                $car_engine = stripslashes($car_engine);
                $car_engine_choice = stripslashes($car_engine_choice);

                $car_wheel = stripslashes($car_wheel);
                $car_trans = stripslashes($car_trans);
                $car_color = stripslashes($car_color);

                $car_rt = stripslashes($car_rt);
                $car_sixty = stripslashes($car_sixty);
                $car_three = stripslashes($car_three);
                $car_eigth = stripslashes($car_eigth);
                $car_eigthm = stripslashes($car_eigthm);
                $car_thou = stripslashes($car_thou);
                $car_quart = stripslashes($car_quart);
                $car_quartm = stripslashes($car_quartm);
Bästa hälsningar - Mikael Andersson

Välkommen till: http://www.bikersite.se - Träffpunkten för svenska bikers!

Användarvisningsbild
WickeD
Extra aktiv medlem
Extra aktiv medlem
Inlägg: 979
Blev medlem: 2004-11-08 12:17
Ort: Sverige / Umeå
Kontakt:

Inlägg av WickeD » 2006-04-13 17:15

Fortsättning på filen:

Kod: Markera allt

        $mod_engine = stripslashes($mod_engine);
        $mod_exterior = stripslashes($mod_exterior);
        $mod_interior = stripslashes($mod_interior);
        $mod_rims = stripslashes($mod_rims);
        $mod_audio = stripslashes($mod_audio);
        $mod_future = stripslashes($mod_future);
	//
	// END Joe's Car Mod
	//
		$info = stripslashes($info);
		$user_absence_text = stripslashes($user_absence_text);
		$signature = htmlspecialchars(stripslashes($signature));

		$user_lang = stripslashes($user_lang);
		$user_dateformat = stripslashes($user_dateformat);

		if ( !isset($HTTP_POST_VARS['cancelavatar']))
		{
			$user_avatar = $user_avatar_category . '/' . $user_avatar_local;
			$user_avatar_type = USER_AVATAR_GALLERY;
		}
	}
}

//
// Let's make sure the user isn't logged in while registering,
// and ensure that they were trying to register a second time
// (Prevents double registrations)
//
if ($mode == 'register' && ($userdata['session_logged_in'] || $username == $userdata['username']))
{
	message_die(GENERAL_MESSAGE, $lang['Username_taken'], '', __LINE__, __FILE__);
}

//
// Did the user submit? In this case build a query to update the users profile in the DB
//
if ( isset($HTTP_POST_VARS['submit']) )
{
	include($phpbb_root_path . 'includes/usercp_avatar.'.$phpEx);

	$passwd_sql = '';
	if ( $mode == 'editprofile' )
	{
		if ( $user_id != $userdata['user_id'] )
		{
			$error = TRUE;
			$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Wrong_Profile'];
		}
	///
	/// Begin Names in Profile MOD
	///

	if ( $board_config['name_first_required'] )
	 {
	  if ( empty($name_first) )
	  {
	  $error = TRUE;
	  $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['name_first_empty'];
	  }
	 }
 
	 if ( $board_config['name_last_required'] )
	 {
	  if ( empty($name_last) )
	  {
	  $error = TRUE;
	  $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['name_last_empty'];
	  }
	 }

	///
	/// End Names in Profile MOD
	///
	}
	else if ( $mode == 'register' )
	{
	///
	/// Begin Names in Profile MOD
	///

	if ( $board_config['name_first_required'] )
	 {
	  if ( empty($name_first) )
	  {
	  $error = TRUE;
	  $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['name_first_empty'];
	  }
	 }
 
	 if ( $board_config['name_last_required'] )
	 {
	  if ( empty($name_last) )
	  {
	  $error = TRUE;
	  $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['name_last_empty'];
	  }
	 }

	///
	/// End Names in Profile MOD
	///
		if ( empty($username) || empty($new_password) || empty($password_confirm) || empty($email) )
		{
			$error = TRUE;
			$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Fields_empty'];
		}
		//
		// Anti Robotic Registration
		//
		$sql = "SELECT * FROM " . ANTI_ROBOT_TABLE . " WHERE session_id = '" . $userdata['session_id'] . "' LIMIT 1";
		if( !$result = $db->sql_query($sql) )
		{
			message_die(GENERAL_ERROR, 'Could not obtain registration information', '', __LINE__, __FILE__, $sql);
		}

		$anti_robot_row = $db->sql_fetchrow($result);
 
		if (( strtolower($HTTP_POST_VARS['reg_key']) != $anti_robot_row['reg_key'] ) or ($anti_robot_row['reg_key'] == ''))
		{
			$error = TRUE;
			$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Wrong_reg_key'];
		}
		else
		{
			$sql = "DELETE FROM " . ANTI_ROBOT_TABLE . " WHERE session_id = '" . $userdata['session_id'] . "'";
			if( !$result = $db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, 'Could not delete validation key', '', __LINE__, __FILE__, $sql);
			}
		}
		// --------------------------
		//
	}

	$passwd_sql = '';
	if ( !empty($new_password) && !empty($password_confirm) )
	{
		// Start add - Protect user account MOD
// validate that the password is complex
$result = validate_complex_password ($username, $new_password);
if ( $result['error'] )
{
	$error = TRUE;
	$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $result['error_msg'];

}
// End add - Protect user account MOD
		if ( $new_password != $password_confirm )
		{
			$error = TRUE;
			$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Password_mismatch'];
		}
		else if ( strlen($new_password) > 32 )
		{
			$error = TRUE;
			$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Password_long'];
		}
		else
		{
			if ( $mode == 'editprofile' )
			{
				$sql = "SELECT user_password
					FROM " . USERS_TABLE . "
					WHERE user_id = $user_id";
				if ( !($result = $db->sql_query($sql)) )
				{
					message_die(GENERAL_ERROR, 'Could not obtain user_password information', '', __LINE__, __FILE__, $sql);
				}

				$row = $db->sql_fetchrow($result);

				if ( $row['user_password'] != md5($cur_password) )
				{
					$error = TRUE;
					$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Current_password_mismatch'];
				}
			}

			if ( !$error )
			{
				$new_password = md5($new_password);
				$passwd_sql = "user_password = '$new_password', ";
			}
		}
	}
	else if ( ( empty($new_password) && !empty($password_confirm) ) || ( !empty($new_password) && empty($password_confirm) ) )
	{
		$error = TRUE;
		$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Password_mismatch'];
	}

	//
	// Do a ban check on this email address
	//
	if ( $email != $userdata['user_email'] || $mode == 'register' )
	{
		$result = validate_email($email);
		if ( $result['error'] )
		{
			$email = $userdata['user_email'];

			$error = TRUE;
			$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $result['error_msg'];
		}

		if ( $mode == 'editprofile' )
		{
			$sql = "SELECT user_password
				FROM " . USERS_TABLE . "
				WHERE user_id = $user_id";
			if ( !($result = $db->sql_query($sql)) )
			{
				message_die(GENERAL_ERROR, 'Could not obtain user_password information', '', __LINE__, __FILE__, $sql);
			}

			$row = $db->sql_fetchrow($result);

			if ( $row['user_password'] != md5($cur_password) )
			{
				$email = $userdata['user_email'];

				$error = TRUE;
				$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Current_password_mismatch'];
			}
		}
	}

	$username_sql = '';
	if ( $board_config['allow_namechange'] || $mode == 'register' )
	{
		if ( empty($username) )
		{
			// Error is already triggered, since one field is empty.
			$error = TRUE;
		}
		else if ( $username != $userdata['username'] || $mode == 'register' )
		{
			if (strtolower($username) != strtolower($userdata['username']) || $mode == 'register')
			{
				$result = validate_username($username);
				if ( $result['error'] )
				{
					$error = TRUE;
					$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $result['error_msg'];
				}
			}

			if (!$error)
			{
				$username_sql = "username = '" . str_replace("\'", "''", $username) . "', ";
			}
		}
	}

	if ( $signature != '' )
	{
		if ( strlen($signature) > $board_config['max_sig_chars'] )
		{
			$error = TRUE;
			$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Signature_too_long'];
		}

		if ( !isset($signature_bbcode_uid) || $signature_bbcode_uid == '' )
		{
			$signature_bbcode_uid = ( $allowbbcode ) ? make_bbcode_uid() : '';
		}
		$signature = prepare_message($signature, $allowhtml, $allowbbcode, $allowsmilies, $signature_bbcode_uid);
	}

	if ( $website != '' )
	{
		rawurlencode($website);
	}

	$avatar_sql = '';

	if ( isset($HTTP_POST_VARS['avatardel']) && $mode == 'editprofile' )
	{
      $avatar_sql = user_avatar_delete($userdata['user_avatar_type'], $userdata['user_avatar']); 
   } 
   else 
   if ( ( !empty($user_avatar_upload) || !empty($user_avatar_name) ) && $board_config['allow_avatar_upload'] )
	{
		if ( !empty($user_avatar_upload) )
		{
			$avatar_mode = (empty($user_avatar_name)) ? 'remote' : 'local'; 
			$avatar_sql = user_avatar_upload($mode, $avatar_mode, $userdata['user_avatar'], $userdata['user_avatar_type'], $error, $error_msg, $user_avatar_upload, $user_avatar_name, $user_avatar_size, $user_avatar_filetype);
		}
		else if ( !empty($user_avatar_name) )
		{
			$l_avatar_size = sprintf($lang['Avatar_filesize'], round($board_config['avatar_filesize'] / 1024));

			$error = true;
			$error_msg .= ( ( !empty($error_msg) ) ? '<br />' : '' ) . $l_avatar_size;
		}
	}
	else if ( $user_avatar_remoteurl != '' && $board_config['allow_avatar_remote'] )
	{
user_avatar_delete($userdata['user_avatar_type'], $userdata['user_avatar']);
		$avatar_sql = user_avatar_url($mode, $error, $error_msg, $user_avatar_remoteurl);
	}
	else if ( $user_avatar_local != '' && $board_config['allow_avatar_local'] )
	{
      user_avatar_delete($userdata['user_avatar_type'], $userdata['user_avatar']); 
      $avatar_sql = user_avatar_gallery($mode, $error, $error_msg, $user_avatar_local, $user_avatar_category);
	}
	// Start add - Birthday MOD
// find the birthday values, reflected by the $lang['Submit_date_format']
	if ($b_day || $b_md || $b_year) //if a birthday is submited, then validate it
	{
		$user_age=(date('md')>=$b_md.(($b_day <= 9) ? '0':'').$b_day) ? date('Y') - $b_year : date('Y') - $b_year - 1 ;
		// Check date, maximum / minimum user age
		if (!checkdate($b_md,$b_day,$b_year))
		{
			$error = TRUE;
			if( isset($error_msg) )$error_msg .= "<br />";
			$error_msg .= $lang['Wrong_birthday_format'];
		} else
		if ($user_age>$board_config['max_user_age'])
		{
			$error = TRUE;
			if( isset($error_msg) )$error_msg .= "<br />";
			$error_msg .= sprintf($lang['Birthday_to_high'],$board_config['max_user_age']);
		} else
		if ($user_age<$board_config['min_user_age'])
		{
			$error = TRUE;
			if( isset($error_msg) )$error_msg .= "<br />";
			$error_msg .= sprintf($lang['Birthday_to_low'],$board_config['min_user_age']);
		} else
		{
			$birthday = ($error) ? $birthday : mkrealdate($b_day,$b_md,$b_year);
			$next_birthday_greeting = (date('md')<$b_md.(($b_day <= 9) ? '0':'').$b_day) ? date('Y'):date('Y')+1 ;
		}
	} else
	{
		if ($board_config['birthday_required'])
		{
			$error = TRUE;
			if( isset($error_msg) )$error_msg .= "<br />";
			$error_msg .= sprintf($lang['Birthday_require']);
		}
		$birthday = 999999;
	}
// End add - Birthday MOD
	if ( !$error )
	{
		if ( $avatar_sql == '' )
		{
			$avatar_sql = ( $mode == 'editprofile' ) ? '' : "'', " . USER_AVATAR_NONE;
		}

		if ( $mode == 'editprofile' )
		{
			if ( $email != $userdata['user_email'] && $board_config['require_activation'] != USER_ACTIVATION_NONE && $userdata['user_level'] != ADMIN )
			{
				$user_active = 0;

				$user_actkey = gen_rand_string(true);
				$key_len = 54 - ( strlen($server_url) );
				$key_len = ( $key_len > 6 ) ? $key_len : 6;
				$user_actkey = substr($user_actkey, 0, $key_len);

				if ( $userdata['session_logged_in'] )
				{
					session_end($userdata['session_id'], $userdata['user_id']);
				}
			}
			else
			{
				$user_active = 'user_active'; 
				$user_actkey = 'user_actkey'; 
				// Start add - Protect user account MOD
				$passwd_sql .= (empty($passwd_sql)) ? "" : " user_passwd_change=".time().",";
				// End add - Protect user account MOD
			}

               		$car_engine_choice = ($car_engine_choice == $lang['Car_Engine_Choice']['0']) ? '' : $car_engine_choice;
                        $car_mark_choice = ($car_mark_choice == $lang['Car_Mark_Choice']['0']) ? '' : $car_mark_choice;
                        $car_model_choice = ($car_model_choice == $lang['Car_Model_Choice']['0']) ? '' : $car_model_choice;
                        $car_year_choice = ($car_year_choice == $lang['Car_Year_Choice']['0']) ? '' : $car_year_choice;
			$sql = "UPDATE " . USERS_TABLE . "
				SET " . $username_sql . $passwd_sql . "user_email = '" . str_replace("\'", "''", $email) ."', user_icq = '" . str_replace("\'", "''", $icq) . "', user_website = '" . str_replace("\'", "''", $website) . "', user_occ = '" . str_replace("\'", "''", $occupation) . "', user_from = '" . str_replace("\'", "''", $location) . "', user_from_flag = '$user_flag', user_interests = '" . str_replace("\'", "''", $interests) . "', user_car_mark = '" . str_replace("\'", "''", $car_mark) . "', user_car_mark_choice = '" . str_replace("\'", "''", $car_mark_choice) . "', user_car_model = '" . str_replace("\'", "''", $car_model) . "', user_car_model_choice = '" . str_replace("\'", "''", $car_model_choice) . "', user_car_year = '" . str_replace("\'", "''", $car_year) . "', user_car_year_choice = '" . str_replace("\'", "''", $car_year_choice) . "', user_car_engine = '" . str_replace("\'", "''", $car_engine) . "', user_car_engine_choice = '" . str_replace("\'", "''", $car_engine_choice) . "', user_car_wheel = '" . str_replace("\'", "''", $car_wheel) . "', user_car_trans = '" . str_replace("\'", "''", $car_trans) . "', user_car_color = '" . str_replace("\'", "''", $car_color) . "', user_car_rt = '" . str_replace("\'", "''", $car_rt) . "', user_car_sixty = '" . str_replace("\'", "''", $car_sixty) . "', user_car_three = '" . str_replace("\'", "''", $car_three) . "', user_car_eigth = '" . str_replace("\'", "''", $car_eigth) . "', user_car_eigthm = '" . str_replace("\'", "''", $car_eigthm) . "', user_car_thou = '" . str_replace("\'", "''", $car_thou) . "', user_car_quart = '" . str_replace("\'", "''", $car_quart) . "', user_car_quartm = '" . str_replace("\'", "''", $car_quartm) . "', user_mod_engine = '" . str_replace("\'", "''", $mod_engine) . "', user_mod_exterior = '" . str_replace("\'", "''", $mod_exterior) . "', user_mod_interior = '" . str_replace("\'", "''", $mod_interior) . "', user_mod_rims = '" . str_replace("\'", "''", $mod_rims) . "', user_mod_audio = '" . str_replace("\'", "''", $mod_audio) . "', user_mod_future = '" . str_replace("\'", "''", $mod_future) . "', user_name_first = '" . str_replace("\'", "''", $name_first) . "', user_name_last = '" . str_replace("\'", "''", $name_last) . "', user_allow_new_img_popup = $user_allow_new_img_popup, user_modell = '" . str_replace("\'", "''", $info) . "', user_absence_mode = $user_absence_mode, user_absence = $user_absence, user_absence_text = '" . str_replace("\'", "''", $user_absence_text) . "', user_birthday = '$birthday', user_next_birthday_greeting = '$next_birthday_greeting', user_viewemail = $viewemail, user_aim = '" . str_replace("\'", "''", str_replace(' ', '+', $aim)) . "', user_yim = '" . str_replace("\'", "''", $yim) . "', user_msnm = '" . str_replace("\'", "''", $msn) . "', user_attachsig = $attachsig, user_setbm = $setbm, user_allowsmile = $allowsmilies, user_allowhtml = $allowhtml, user_allowbbcode = $allowbbcode, user_allow_viewonline = $allowviewonline, user_notify = $notifyreply, user_notify_pm = $notifypm, user_popup_pm = $popup_pm, user_timezone = $user_timezone, user_dateformat = '" . str_replace("\'", "''", $user_dateformat) . "', user_lang = '" . str_replace("\'", "''", $user_lang) . "', user_style = $user_style, user_active = $user_active, user_actkey = '$user_actkey'" . $avatar_sql . ", user_gender = '$gender'
				WHERE user_id = $user_id";
			if ( !($result = $db->sql_query($sql)) )
			{
				message_die(GENERAL_ERROR, 'Could not update users table', '', __LINE__, __FILE__, $sql);
			}
			// We remove all stored login keys since the password has been updated
			// and change the current one (if applicable)
			if ( !empty($passwd_sql) )
			{
				session_reset_keys($user_id, $user_ip);
			}

// Begin Map Mod
$sql = "SELECT user_id
	FROM ". MAP_MOD_USER_TABLE . "
	WHERE user_id = $user_id ";
if (! $result = $db->sql_query($sql)) {
	message_die(GENERAL_ERROR, 'Could not get map data.', '', __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
if ($row['user_id']==$user_id) {
	$sql = "DELETE 
		FROM " . MAP_MOD_USER_TABLE . "
		WHERE user_id = $user_id ";
	if (! $result = $db->sql_query($sql)) {
		message_die(GENERAL_ERROR, 'Could not delete map data.', '', __LINE__, __FILE__, $sql);
	}
}
if (((float)$longitude != 0.0) || ((float)$latitude != 0.0)) {
	$sql = "INSERT INTO " .MAP_MOD_USER_TABLE. "
	VALUES (" . intval($user_id) . ", " . (float)$longitude . "," . (float)$latitude. ")";
	if(! $result = $db->sql_query($sql)) {
		message_die(GENERAL_ERROR, 'Could not update map table.', '', __LINE__, __FILE__, $sql);
	}
}
// End Map Mod
			if ( !$user_active )
			{
				//
				// The users account has been deactivated, send them an email with a new activation key
				//
				include($phpbb_root_path . 'includes/emailer.'.$phpEx);
				$emailer = new emailer($board_config['smtp_delivery']);

             if ( $board_config['require_activation'] != USER_ACTIVATION_ADMIN ) 
             { 
                $emailer->from($board_config['board_email']); 
                $emailer->replyto($board_config['board_email']); 
  
                $emailer->use_template('user_activate', stripslashes($user_lang)); 
                $emailer->email_address($email); 
                $emailer->set_subject($lang['Reactivate']); 
  
                $emailer->assign_vars(array( 
                   'SITENAME' => $board_config['sitename'], 
                   'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr(str_replace("\'", "'", $username), 0, 25)), 
                   'EMAIL_SIG' => (!empty($board_config['board_email_sig'])) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '', 
  
                   'U_ACTIVATE' => $server_url . '?mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey) 
                ); 
                $emailer->send(); 
                $emailer->reset(); 
             } 
             else if ( $board_config['require_activation'] == USER_ACTIVATION_ADMIN ) 
             { 
                $sql = 'SELECT user_email, user_lang 
                   FROM ' . USERS_TABLE . ' 
                   WHERE user_level = ' . ADMIN; 
                 
                if ( !($result = $db->sql_query($sql)) ) 
                { 
                   message_die(GENERAL_ERROR, 'Could not select Administrators', '', __LINE__, __FILE__, $sql); 
                } 
                 
                while ($row = $db->sql_fetchrow($result)) 
                { 
                   $emailer->from($board_config['board_email']); 
                   $emailer->replyto($board_config['board_email']); 
                    
                   $emailer->email_address(trim($row['user_email'])); 
                   $emailer->use_template("admin_activate", $row['user_lang']); 
                   $emailer->set_subject($lang['Reactivate']); 
  
                   $emailer->assign_vars(array( 
                      'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr(str_replace("\'", "'", $username), 0, 25)), 
                      'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']), 
  
                      'U_ACTIVATE' => $server_url . '?mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey) 
                   ); 
                   $emailer->send(); 
                   $emailer->reset(); 
                } 
                $db->sql_freeresult($result); 
             }

				$message = $lang['Profile_updated_inactive'] . '<br /><br />' . sprintf($lang['Click_return_index'],  '<a href="' . append_sid("portal.$phpEx") . '">', '</a>');
			}
			else
			{
				$message = $lang['Profile_updated'] . '<br /><br />' . sprintf($lang['Click_return_index'],  '<a href="' . append_sid("portal.$phpEx") . '">', '</a>');
			}

			$template->assign_vars(array(
				"META" => '<meta http-equiv="refresh" content="5;url=' . append_sid("portal.$phpEx") . '">')
			);

			message_die(GENERAL_MESSAGE, $message);
		}
		else
		{
			$sql = "SELECT MAX(user_id) AS total
				FROM " . USERS_TABLE;
			if ( !($result = $db->sql_query($sql)) )
			{
				message_die(GENERAL_ERROR, 'Could not obtain next user_id information', '', __LINE__, __FILE__, $sql);
			}

			if ( !($row = $db->sql_fetchrow($result)) )
			{
				message_die(GENERAL_ERROR, 'Could not obtain next user_id information', '', __LINE__, __FILE__, $sql);
			}
			$user_id = $row['total'] + 1;

            // CBACK CrackerTracker Register Flood Protection
            $stime = time() + $ctracker_config['regtime'];
            $sql = "UPDATE " . CTRACK . " SET value = " . $stime . " WHERE name = 'lastreg'";
    	    $db->sql_query($sql);

            if(!empty($HTTP_SERVER_VARS['REMOTE_ADDR']))
            {
	          $sql = "UPDATE " . CTRACK . " SET value = '" . $HTTP_SERVER_VARS['REMOTE_ADDR'] . "' WHERE name = 'lastreg_ip'";
              $db->sql_query($sql);
            }
            // END CBACK CrackerTracker Register Flood Protection
			//
			// Get current date
			//
			$sql = "INSERT INTO " . USERS_TABLE . "	(user_id, username, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_from_flag, user_interests, user_car_mark, user_car_mark_choice, user_car_model, user_car_model_choice, user_car_year, user_car_year_choice, user_car_engine, user_car_engine_choice, user_car_wheel, user_car_trans, user_car_color, user_car_rt, user_car_sixty, user_car_three, user_car_eigth, user_car_eigthm, user_car_thou, user_car_quart, user_car_quartm, user_mod_engine, user_mod_exterior, user_mod_interior, user_mod_rims, user_mod_audio, user_mod_future, user_name_first, user_name_last, user_allow_new_img_popup, user_modell, user_absence_mode, user_absence, user_absence_text, user_sig, user_sig_bbcode_uid, user_avatar, user_avatar_type, user_viewemail, user_aim, user_yim, user_msnm, user_attachsig, user_setbm, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_viewonline, user_notify, user_notify_pm, user_popup_pm, user_timezone, user_dateformat, user_lang, user_style, user_gender, user_level, user_allow_pm, user_birthday, user_next_birthday_greeting, user_passwd_change, user_active, user_actkey)
				VALUES ($user_id, '" . str_replace("\'", "''", $username) . "', " . time() . ", '" . str_replace("\'", "''", $new_password) . "', '" . str_replace("\'", "''", $email) . "', '" . str_replace("\'", "''", $icq) . "', '" . str_replace("\'", "''", $website) . "', '" . str_replace("\'", "''", $occupation) . "', '" . str_replace("\'", "''", $location) . "', '$user_flag', '" . str_replace("\'", "''", $interests) . "', '" . str_replace("\'", "''", $car_mark) . "', '" . str_replace("\'", "''", $car_mark_choice) . "', '" . str_replace("\'", "''", $car_model) . "', '" . str_replace("\'", "''", $car_model_choice) . "', '" . str_replace("\'", "''", $car_year) . "', '" . str_replace("\'", "''", $car_year_choice) . "', '" . str_replace("\'", "''", $car_engine) . "', '" . str_replace("\'", "''", $car_engine_choice) . "', '" . str_replace("\'", "''", $car_wheel) . "', '" . str_replace("\'", "''", $car_trans) . "', '" . str_replace("\'", "''", $car_color) . "', '" . str_replace("\'", "''", $car_rt) . "', '" . str_replace("\'", "''", $car_sixty) . "', '" . str_replace("\'", "''", $car_three) . "', '" . str_replace("\'", "''", $car_eigth) . "', '" . str_replace("\'", "''", $car_eigthm) . "', '" . str_replace("\'", "''", $car_thou) . "', '" . str_replace("\'", "''", $car_quart) . "', '" . str_replace("\'", "''", $car_quartm) . "', '" . str_replace("\'", "''", $mod_engine) . "', '" . str_replace("\'", "''", $mod_exterior) . "', '" . str_replace("\'", "''", $mod_interior) . "', '" . str_replace("\'", "''", $mod_rims) . "', '" . str_replace("\'", "''", $mod_audio) . "', '" . str_replace("\'", "''", $mod_future) . "', '" . str_replace("\'", "''", $name_first) . "', '" . str_replace("\'", "''", $name_last) . "', $user_allow_new_img_popup, '" . str_replace("\'", "''", $info) . "', $user_absence_mode, $user_absence, '" . str_replace("\'", "''", $user_absence_text) . "', '" . str_replace("\'", "''", $signature) . "', '$signature_bbcode_uid', $avatar_sql, $viewemail, '" . str_replace("\'", "''", str_replace(' ', '+', $aim)) . "', '" . str_replace("\'", "''", $yim) . "', '" . str_replace("\'", "''", $msn) . "', $attachsig, $setbm, $allowsmilies, $allowhtml, $allowbbcode, $allowviewonline, $notifyreply, $notifypm, $popup_pm, $user_timezone, '" . str_replace("\'", "''", $user_dateformat) . "', '" . str_replace("\'", "''", $user_lang) . "', $user_style, '$gender', 0, 1, '$birthday', '$next_birthday_greeting', ".time().",";
			if ( $board_config['require_activation'] == USER_ACTIVATION_SELF || $board_config['require_activation'] == USER_ACTIVATION_ADMIN || $coppa )
			{
				$user_actkey = gen_rand_string(true);
				$key_len = 54 - (strlen($server_url));
				$key_len = ( $key_len > 6 ) ? $key_len : 6;
				$user_actkey = substr($user_actkey, 0, $key_len);
				$sql .= "0, '" . str_replace("\'", "''", $user_actkey) . "')";
			}
			else
			{
				$sql .= "1, '')";
			}

			if ( !($result = $db->sql_query($sql, BEGIN_TRANSACTION)) )
			{
				message_die(GENERAL_ERROR, 'Could not insert data into users table', '', __LINE__, __FILE__, $sql);
			}
// Begin Map Mod
if (((float)$longitude != 0.0) || ((float)$latitude != 0.0)) {
	$sql = "INSERT INTO " . MAP_MOD_USER_TABLE . " (user_id, longitude, latitude)
		VALUES (" . intval($user_id) . ", " . (float)$longitude . "," . (float)$latitude . ")";
	if(! $result = $db->sql_query($sql))
	{
		message_die(GENERAL_ERROR, 'Could not update map table.', '', __LINE__, __FILE__, $sql);
	}
}
// End Map Mod

			$sql = "INSERT INTO " . GROUPS_TABLE . " (group_name, group_description, group_single_user, group_moderator)
				VALUES ('', 'Personal User', 1, 0)";
			if ( !($result = $db->sql_query($sql)) )
			{
				message_die(GENERAL_ERROR, 'Could not insert data into groups table', '', __LINE__, __FILE__, $sql);
			}

			$group_id = $db->sql_nextid();

			$sql = "INSERT INTO " . USER_GROUP_TABLE . " (user_id, group_id, user_pending)
				VALUES ($user_id, $group_id, 0)";
			if( !($result = $db->sql_query($sql, END_TRANSACTION)) )
			{
				message_die(GENERAL_ERROR, 'Could not insert data into user_group table', '', __LINE__, __FILE__, $sql);
			}

			if ( $coppa )
			{
				$message = $lang['COPPA'];
				$email_template = 'coppa_welcome_inactive';
			}
			else if ( $board_config['require_activation'] == USER_ACTIVATION_SELF )
			{
				$message = $lang['Account_inactive'];
				$email_template = 'user_welcome_inactive';
			}
			else if ( $board_config['require_activation'] == USER_ACTIVATION_ADMIN )
			{
				$message = $lang['Account_inactive_admin'];
				$email_template = 'admin_welcome_inactive';
			}
			else
			{
				$message = $lang['Account_added'];
				$email_template = 'user_welcome';
			}

			include($phpbb_root_path . 'includes/emailer.'.$phpEx);
			$emailer = new emailer($board_config['smtp_delivery']);

			$emailer->from($board_config['board_email']);
			$emailer->replyto($board_config['board_email']);

			$emailer->use_template($email_template, stripslashes($user_lang));
			$emailer->email_address($email);
			$emailer->set_subject(sprintf($lang['Welcome_subject'], $board_config['sitename']));

			if( $coppa )
			{
				$emailer->assign_vars(array(
					'SITENAME' => $board_config['sitename'],
					'WELCOME_MSG' => sprintf($lang['Welcome_subject'], $board_config['sitename']),
					'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr(str_replace("\'", "'", $username), 0, 25)),
					'PASSWORD' => $password_confirm,
					'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']),

					'FAX_INFO' => $board_config['coppa_fax'],
					'MAIL_INFO' => $board_config['coppa_mail'],
					'EMAIL_ADDRESS' => $email,
					'ICQ' => $icq,
					'AIM' => $aim,
					'YIM' => $yim,
					'MSN' => $msn,
					'WEB_SITE' => $website,
					'FROM' => $location,
					'OCC' => $occupation,
					'INTERESTS' => $interests,
					'SITENAME' => $board_config['sitename']));
			}
			else
			{
				$emailer->assign_vars(array(
					'SITENAME' => $board_config['sitename'],
					'WELCOME_MSG' => sprintf($lang['Welcome_subject'], $board_config['sitename']),
					'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr(str_replace("\'", "'", $username), 0, 25)),
					'PASSWORD' => $password_confirm,
					'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']),

					'U_ACTIVATE' => $server_url . '?mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey)
				);
			}

			$emailer->send();
			$emailer->reset();

			if ( $board_config['require_activation'] == USER_ACTIVATION_ADMIN )
			{
				$sql = "SELECT user_email, user_lang 
					FROM " . USERS_TABLE . "
					WHERE user_level = " . ADMIN;
				
				if ( !($result = $db->sql_query($sql)) )
				{
					message_die(GENERAL_ERROR, 'Could not select Administrators', '', __LINE__, __FILE__, $sql);
				}
				
				while ($row = $db->sql_fetchrow($result))
				{
					$emailer->from($board_config['board_email']);
					$emailer->replyto($board_config['board_email']);
					
					$emailer->email_address(trim($row['user_email']));
					$emailer->use_template("admin_activate", $row['user_lang']);
					$emailer->set_subject($lang['New_account_subject']);

					$emailer->assign_vars(array(
						'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr(str_replace("\'", "'", $username), 0, 25)),
						'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']),

						'U_ACTIVATE' => $server_url . '?mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey)
					);
					$emailer->send();
					$emailer->reset();
				}
				$db->sql_freeresult($result);
			}

			$message = $message . '<br /><br />' . sprintf($lang['Click_return_index'],  '<a href="' . append_sid("index.$phpEx") . '">', '</a>');

			message_die(GENERAL_MESSAGE, $message);
		} // if mode == register
	}
} // End of submit


if ( $error )
{
	//
	// If an error occured we need to stripslashes on returned data
	//
	$username = stripslashes($username);
	$name_first = stripslashes($name_first);
	$name_last = stripslashes($name_last);
	$email = stripslashes($email);
	$cur_password = '';
	$new_password = '';
	$password_confirm = '';

	$icq = stripslashes($icq);
	$aim = str_replace('+', ' ', stripslashes($aim));
	$msn = stripslashes($msn);
	$yim = stripslashes($yim);

	$website = stripslashes($website);
	$location = stripslashes($location);
	$occupation = stripslashes($occupation);
	$interests = stripslashes($interests);
	//
	// START Joe's Car Mod
	//
	$car_mark = stripslashes($car_mark);
        $car_mark_choice = stripslashes($car_mark_choice);

        $car_model = stripslashes($car_model);

        $car_model_choice = stripslashes($car_model_choice);

        $car_year = stripslashes($car_year);
        $car_year_choice = stripslashes($car_year_choice);
        $car_engine = stripslashes($car_engine);
        $car_engine_choice = stripslashes($car_engine_choice);

        $car_wheel = stripslashes($car_wheel);
        $car_trans = stripslashes($car_trans);
        $car_color = stripslashes($car_color);

        $car_rt = stripslashes($car_rt);
        $car_sixty = stripslashes($car_sixty);
        $car_three = stripslashes($car_three);
        $car_eigth = stripslashes($car_eigth);
        $car_eigthm = stripslashes($car_eigthm);
        $car_thou = stripslashes($car_thou);
        $car_quart = stripslashes($car_quart);
        $car_quartm = stripslashes($car_quartm);

        $mod_engine = stripslashes($mod_engine);
        $mod_exterior = stripslashes($mod_exterior);
        $mod_interior = stripslashes($mod_interior);
        $mod_rims = stripslashes($mod_rims);
        $mod_audio = stripslashes($mod_audio);
        $mod_future = stripslashes($mod_future);
	//
	// END Joe's Car Mod
	//
		//
		// START Joe's Car Mod
		//
		$car_mark = stripslashes($car_mark);
                $car_mark_choice = stripslashes($car_mark_choice);

                $car_model = stripslashes($car_model);

                $car_model_choice = stripslashes($car_model_choice);

                $car_year = stripslashes($car_year);
                $car_year_choice = stripslashes($car_year_choice);

                $car_engine = stripslashes($car_engine);
                $car_engine_choice = stripslashes($car_engine_choice);

                $car_wheel = stripslashes($car_wheel);
                $car_trans = stripslashes($car_trans);
                $car_color = stripslashes($car_color);

                $car_rt = stripslashes($car_rt);
                $car_sixty = stripslashes($car_sixty);
                $car_three = stripslashes($car_three);
                $car_eigth = stripslashes($car_eigth);
                $car_eigthm = stripslashes($car_eigthm);
                $car_thou = stripslashes($car_thou);
                $car_quart = stripslashes($car_quart);
                $car_quartm = stripslashes($car_quartm);

                $mod_engine = stripslashes($mod_engine);
                $mod_exterior = stripslashes($mod_exterior);
                $mod_interior = stripslashes($mod_interior);
                $mod_rims = stripslashes($mod_rims);
                $mod_audio = stripslashes($mod_audio);
                $mod_future = stripslashes($mod_future);
		//
		// END Joe's Car Mod
		//
	$info = stripslashes($info);
	$user_absence_text = stripslashes($user_absence_text);
	$signature = stripslashes($signature);
	$signature = ($signature_bbcode_uid != '') ? preg_replace("/:(([a-z0-9]+:)?)$signature_bbcode_uid(=|\])/si", '\\3', $signature) : $signature;

	$user_lang = stripslashes($user_lang);
	$user_dateformat = stripslashes($user_dateformat);

}
else if ( $mode == 'editprofile' && !isset($HTTP_POST_VARS['avatargallery']) && !isset($HTTP_POST_VARS['submitavatar']) && !isset($HTTP_POST_VARS['cancelavatar']) )
{
	$user_id = $userdata['user_id'];
	$username = $userdata['username'];
	$name_first = $userdata['user_name_first'];
	$name_last = $userdata['user_name_last'];
	$email = $userdata['user_email'];
	$cur_password = '';
	$new_password = '';
	$password_confirm = '';

	$icq = $userdata['user_icq'];
	$aim = str_replace('+', ' ', $userdata['user_aim']);
	$msn = $userdata['user_msnm'];
	$yim = $userdata['user_yim'];

	$website = $userdata['user_website'];
	$location = $userdata['user_from'];
	// FLAGHACK-start
	$user_flag = $userdata['user_from_flag'];	
	// FLAGHACK-end
	$occupation = $userdata['user_occ'];
	$interests = $userdata['user_interests'];
	//
	// START Joe's Car Mod
	//
	$car_mark = $userdata['user_car_mark'];
        $car_mark_choice = $userdata['user_car_mark_choice'];

        $car_model = $userdata['user_car_model'];

        $car_model_choice = $userdata['user_car_model_choice'];

        $car_year = $userdata['user_car_year'];
        $car_year_choice = $userdata['user_car_year_choice'];
        $car_engine = $userdata['user_car_engine'];
        $car_engine_choice = $userdata['user_car_engine_choice'];
        $car_wheel = $userdata['user_car_wheel'];
        $car_trans = $userdata['user_car_trans'];
        $car_color = $userdata['user_car_color'];

        $car_rt = $userdata['user_car_rt'];
        $car_sixty = $userdata['user_car_sixty'];
        $car_three = $userdata['user_car_three'];
        $car_eigth = $userdata['user_car_eigth'];
        $car_eigthm = $userdata['user_car_eigthm'];
        $car_thou = $userdata['user_car_thou'];
        $car_quart = $userdata['user_car_quart'];
        $car_quartm = $userdata['user_car_quartm'];

        $mod_engine = $userdata['user_mod_engine'];
        $mod_exterior = $userdata['user_mod_exterior'];
        $mod_interior = $userdata['user_mod_interior'];
        $mod_rims = $userdata['user_mod_rims'];
        $mod_audio = $userdata['user_mod_audio'];
        $mod_future = $userdata['user_mod_future'];
	//
	// END Joe's Car Mod
	//
	$info = $userdata['user_modell'];
	// Start add - Gender MOD
	$gender = $userdata['user_gender']; 
	// End add - Gender MOD
	// Start add - Birthday MOD
	$birthday = $userdata['user_birthday'];
	// End add - Birthday MOD
	$signature_bbcode_uid = $userdata['user_sig_bbcode_uid'];
	$signature = ($signature_bbcode_uid != '') ? preg_replace("/:(([a-z0-9]+:)?)$signature_bbcode_uid(=|\])/si", '\\3', $userdata['user_sig']) : $userdata['user_sig'];

	$viewemail = $userdata['user_viewemail'];
	$user_allow_new_img_popup = $userdata['user_allow_new_img_popup'];
	$user_absence_mode = $userdata['user_absence_mode'];
	$user_absence = $userdata['user_absence'];
	$user_absence_text = $userdata['user_absence_text'];
	$notifypm = $userdata['user_notify_pm'];
	$popup_pm = $userdata['user_popup_pm'];
	$notifyreply = $userdata['user_notify'];
	$attachsig = $userdata['user_attachsig'];
	$setbm = $userdata['user_setbm'];
	$allowhtml = $userdata['user_allowhtml'];
	$allowbbcode = $userdata['user_allowbbcode'];
	$allowsmilies = $userdata['user_allowsmile'];
	$allowviewonline = $userdata['user_allow_viewonline'];

	$user_avatar = ( $userdata['user_allowavatar'] ) ? $userdata['user_avatar'] : '';
	$user_avatar_type = ( $userdata['user_allowavatar'] ) ? $userdata['user_avatar_type'] : USER_AVATAR_NONE;

	$user_style = $userdata['user_style'];
	$user_lang = $userdata['user_lang'];
	$user_timezone = $userdata['user_timezone'];
	$user_dateformat = $userdata['user_dateformat'];
// Begin Map Mod
$sql = "SELECT * 
	FROM " . MAP_MOD_USER_TABLE . " 
	WHERE user_id=".$userdata['user_id'];
if(!$result = $db->sql_query($sql))
{
	message_die(GENERAL_ERROR, "Couldn't obtain map information.", "", __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
$longitude = $row['longitude'];
$latitude = $row['latitude'];
// End Map Mod
}

//
// Default pages
//
include($phpbb_root_path . 'includes/page_header.'.$phpEx);

make_jumpbox('viewforum.'.$phpEx);

if ( $mode == 'editprofile' )
{
	if ( $user_id != $userdata['user_id'] )
	{
		$error = TRUE;
		$error_msg = $lang['Wrong_Profile'];
	}
}

if( isset($HTTP_POST_VARS['avatargallery']) && !$error )
{
	include($phpbb_root_path . 'includes/usercp_avatar.'.$phpEx);

	$avatar_category = ( !empty($HTTP_POST_VARS['avatarcategory']) ) ? htmlspecialchars($HTTP_POST_VARS['avatarcategory']) : '';

	$template->set_filenames(array(
		'body' => 'profile_avatar_gallery.tpl')
	);

	$allowviewonline = !$allowviewonline;

	display_avatar_gallery($mode, $avatar_category, $user_id, $email, $current_email, $coppa, $username, $email, $new_password, $cur_password, $password_confirm, $icq, $aim, $msn, $yim, $website, $location, $occupation, $interests, $name_first, $name_last, $signature, $viewemail, $notifypm, $popup_pm, $notifyreply, $attachsig, $allowhtml, $allowbbcode, $allowsmilies, $allowviewonline, $user_style, $user_lang, $user_timezone, $user_dateformat, $car_mark, $car_mark_choice, $car_model, $car_model_choice, $car_year, $car_year_choice, $car_engine, $car_engine_choice, $car_wheel, $car_trans, $car_color, $car_rt, $car_sixty, $car_three, $car_eigth, $car_eigthm, $car_thou, $car_quart, $car_quartm, $mod_engine, $mod_exterior, $mod_interior, $mod_rims, $mod_audio, $mod_future, $user_allow_new_img_popup, $userdata['session_id'], $longitude, $latitude);
}
else
{
	include($phpbb_root_path . 'includes/functions_selects.'.$phpEx);

	if ( !isset($coppa) )
	{
		$coppa = FALSE;
	}

   if ( !isset($user_style) ) 
   { 
      $user_style = $board_config['default_style'];
	}

	$avatar_img = '';
	if ( $user_avatar_type )
	{
		switch( $user_avatar_type )
		{
			case USER_AVATAR_UPLOAD:
				$avatar_img = ( $board_config['allow_avatar_upload'] ) ? '<img src="' . $board_config['avatar_path'] . '/' . $user_avatar . '" alt="" />' : '';
				break;
			case USER_AVATAR_REMOTE:
				$avatar_img = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $user_avatar . '" alt="" />' : '';
				break;
			case USER_AVATAR_GALLERY:
				$avatar_img = ( $board_config['allow_avatar_local'] ) ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $user_avatar . '" alt="" />' : '';
				break;
		}
	}

	$s_hidden_fields = '<input type="hidden" name="mode" value="' . $mode . '" /><input type="hidden" name="agreed" value="true" /><input type="hidden" name="coppa" value="' . $coppa . '" />';
	if( $mode == 'editprofile' )
	{
		$s_hidden_fields .= '<input type="hidden" name="user_id" value="' . $userdata['user_id'] . '" />';
		//
		// Send the users current email address. If they change it, and account activation is turned on
		// the user account will be disabled and the user will have to reactivate their account.
		//
		$s_hidden_fields .= '<input type="hidden" name="current_email" value="' . $userdata['user_email'] . '" />';
	}

	if ( !empty($user_avatar_local) )
	{
		$s_hidden_fields .= '<input type="hidden" name="avatarlocal" value="' . $user_avatar_local . '" /><input type="hidden" name="avatarcatname" value="' . $user_avatar_category . '" />';
	}

	$html_status =  ( $userdata['user_allowhtml'] && $board_config['allow_html'] ) ? $lang['HTML_is_ON'] : $lang['HTML_is_OFF'];
	$bbcode_status = ( $userdata['user_allowbbcode'] && $board_config['allow_bbcode']  ) ? $lang['BBCode_is_ON'] : $lang['BBCode_is_OFF'];
	$smilies_status = ( $userdata['user_allowsmile'] && $board_config['allow_smilies']  ) ? $lang['Smilies_are_ON'] : $lang['Smilies_are_OFF'];
	
	// Start add - Gender MOD
switch ($gender) 
{ 
   case 1: $gender_male_checked="checked=\"checked\"";break; 
   case 2: $gender_female_checked="checked=\"checked\"";break; 
   default:$gender_no_specify_checked="checked=\"checked\""; 
}
// End add - Gender MOD
	// Start add - Birthday MOD
if ( $birthday!=999999 )
{
	$b_day = realdate('j', $birthday);
	$b_md = realdate('n', $birthday);
	$b_year = realdate('Y', $birthday);
	$birthday = realdate($lang['Submit_date_format'], $birthday);
} else
{
	$b_day = '';
	$b_md = '';
	$b_year = '';
	$birthday = '';
}
// End add - Birthday MOD

	if ( $error )
	{
		$template->set_filenames(array(
			'reg_header' => 'error_body.tpl')
		);
		$template->assign_vars(array(
			'ERROR_MESSAGE' => $error_msg)
		);
		$template->assign_var_from_handle('ERROR_BOX', 'reg_header');
	}

	$template->set_filenames(array(
		'body' => 'profile_add_body.tpl')
	);
	$s_car_model_choice = '<select name="car_model_choice">';
        for($i = 0; $i < count($lang['Car_Model_Choice']); $i++ )
        {
                $s_car_model_choice .= '<option value="' . $lang['Car_Model_Choice'][$i] . '">' . $lang['Car_Model_Choice'][$i]. '</option>';
        }
        $s_car_model_choice .= '</select>';
        $s_car_model_choice = str_replace("value=\"".$car_model_choice."\">", "value=\"".$car_model_choice."\" SELECTED>" ,$s_car_model_choice);

        $s_car_year_choice = '<select name="car_year_choice">';
        for($i = 0; $i < count($lang['Car_Year_Choice']); $i++ )
        {
                $s_car_year_choice .= '<option value="' . $lang['Car_Year_Choice'][$i] . '">' . $lang['Car_Year_Choice'][$i]. '</option>';
        }
        $s_car_year_choice .= '</select>';
        $s_car_year_choice = str_replace("value=\"".$car_year_choice."\">", "value=\"".$car_year_choice."\" SELECTED>" ,$s_car_year_choice);

        $s_car_mark_choice = '<select name="car_mark_choice">';
        for($i = 0; $i < count($lang['Car_Mark_Choice']); $i++ )
        {
                $s_car_mark_choice .= '<option value="' . $lang['Car_Mark_Choice'][$i] . '">' . $lang['Car_Mark_Choice'][$i]. '</option>';
        }
        $s_car_mark_choice .= '</select>';
        $s_car_mark_choice = str_replace("value=\"".$car_mark_choice."\">", "value=\"".$car_mark_choice."\" SELECTED>" ,$s_car_mark_choice);


        $s_car_engine_choice = '<select name="car_engine_choice">';
        for($i = 0; $i < count($lang['Car_Engine_Choice']); $i++ )
        {
                $s_car_engine_choice .= '<option value="' . $lang['Car_Engine_Choice'][$i] . '">' . $lang['Car_Engine_Choice'][$i]. '</option>';
        }
        $s_car_engine_choice .= '</select>';
        $s_car_engine_choice = str_replace("value=\"".$car_engine_choice."\">", "value=\"".$car_engine_choice."\" SELECTED>" ,$s_car_engine_choice);
	if ( ($userdata['user_level'] == USER && $board_config['users_allow_absence'] == TRUE) || ($userdata['user_level'] != USER && $userdata['user_level'] != ANONYMOUS) )
	{
		$template->assign_block_vars('allow_absence', array());
	}

	$s_user_absence_mode = '<select name = "user_absence_mode">';
	$s_user_absence_mode .= '<option value = "1">' . $lang['On_holidays'] . '</option>';
	$s_user_absence_mode .= '<option value = "2">' . $lang['User_ill'] . '</option>';
	$s_user_absence_mode .= '<option value = "3">' . $lang['Longer_absenct'] . '</option>';
	$s_user_absence_mode .= '</select>';

	$s_user_absence_mode = str_replace('value = "' . $userdata['user_absence_mode'] . '">', 'value = "' . $userdata['user_absence_mode'] . '" SELECTED>' ,$s_user_absence_mode);
	if ( $mode == 'editprofile' )
	{
		$template->assign_block_vars('switch_edit_profile', array());
	}
	// FLAGHACK-start
	// query to get the list of flags
	$sql = "SELECT *
		FROM " . FLAG_TABLE . "
		ORDER BY flag_id";
	if(!$flags_result = $db->sql_query($sql))
	{
		message_die(GENERAL_ERROR, "Couldn't obtain flags information.", "", __LINE__, __FILE__, $sql);
	}
	$flag_row = $db->sql_fetchrowset($ranksresult);
	$num_flags = $db->sql_numrows($ranksresult) ;

	// build the html select statement
	$flag_start_image = 'blank.gif' ;
	$selected = ( isset($user_flag) ) ? '' : ' selected="selected"'  ;
	$flag_select = "<select name=\"user_flag\" onChange=\"document.images['user_flag'].src = 'images/flags/'
 + this.value;\" >";
	$flag_select .= "<option value=\"blank.gif\"$selected>" . $lang['Select_Country'] . "</option>";
	for ($i = 0; $i < $num_flags; $i++)
	{
		$flag_name = $flag_row[$i]['flag_name'];
		$flag_image = $flag_row[$i]['flag_image'];
		$selected = ( isset( $user_flag) ) ? (($user_flag == $flag_image) ? 'selected="selected"' : '' ) : '' ;
		$flag_select .= "\t<option value=\"$flag_image\"$selected>$flag_name</option>";
		if ( isset( $user_flag) && ($user_flag == $flag_image))
		{
			$flag_start_image = $flag_image ;
		}
	}
	$flag_select .= '</select>';
	// FLAGHACK-end
	if ( ($mode == 'register') || ($board_config['allow_namechange']) )
	{
		$template->assign_block_vars('switch_namechange_allowed', array());
	}
	else
	{
		$template->assign_block_vars('switch_namechange_disallowed', array());
	}
	// Start add - Birthday MOD
	$s_b_day = '<span class="genmed">' . $lang['Day'] . '&nbsp;</span><select name="b_day" size="1" class="gensmall"> 
		<option value="0">&nbsp;-&nbsp;</option> 
		<option value="1">&nbsp;1&nbsp;</option>
		<option value="2">&nbsp;2&nbsp;</option>
		<option value="3">&nbsp;3&nbsp;</option>
		<option value="4">&nbsp;4&nbsp;</option>
		<option value="5">&nbsp;5&nbsp;</option>
		<option value="6">&nbsp;6&nbsp;</option>
		<option value="7">&nbsp;7&nbsp;</option>
		<option value="8">&nbsp;8&nbsp;</option>
		<option value="9">&nbsp;9&nbsp;</option>
		<option value="10">&nbsp;10&nbsp;</option>
		<option value="11">&nbsp;11&nbsp;</option>
		<option value="12">&nbsp;12&nbsp;</option>
		<option value="13">&nbsp;13&nbsp;</option>
		<option value="14">&nbsp;14&nbsp;</option>
		<option value="15">&nbsp;15&nbsp;</option>
		<option value="16">&nbsp;16&nbsp;</option>
		<option value="17">&nbsp;17&nbsp;</option>
		<option value="18">&nbsp;18&nbsp;</option>
		<option value="19">&nbsp;19&nbsp;</option>
		<option value="20">&nbsp;20&nbsp;</option>
		<option value="21">&nbsp;21&nbsp;</option>
		<option value="22">&nbsp;22&nbsp;</option>
		<option value="23">&nbsp;23&nbsp;</option>
		<option value="24">&nbsp;24&nbsp;</option>
		<option value="25">&nbsp;25&nbsp;</option>
		<option value="26">&nbsp;26&nbsp;</option>
		<option value="27">&nbsp;27&nbsp;</option>
		<option value="28">&nbsp;28&nbsp;</option>
		<option value="29">&nbsp;29&nbsp;</option>
		<option value="30">&nbsp;30&nbsp;</option>
		<option value="31">&nbsp;31&nbsp;</option>
	  	</select>&nbsp;&nbsp;';
	$s_b_md = '<span class="genmed">' . $lang['Month'] . '&nbsp;</span><select name="b_md" size="1" class="gensmall"> 
     		<option value="0">&nbsp;-&nbsp;</option> 
		<option value="1">&nbsp;'.$lang['datetime']['January'].'&nbsp;</option>
		<option value="2">&nbsp;'.$lang['datetime']['February'].'&nbsp;</option>
		<option value="3">&nbsp;'.$lang['datetime']['March'].'&nbsp;</option>
		<option value="4">&nbsp;'.$lang['datetime']['April'].'&nbsp;</option>
		<option value="5">&nbsp;'.$lang['datetime']['May'].'&nbsp;</option>
Bästa hälsningar - Mikael Andersson

Välkommen till: http://www.bikersite.se - Träffpunkten för svenska bikers!

Användarvisningsbild
WickeD
Extra aktiv medlem
Extra aktiv medlem
Inlägg: 979
Blev medlem: 2004-11-08 12:17
Ort: Sverige / Umeå
Kontakt:

Inlägg av WickeD » 2006-04-13 17:17

Och en till del av filen:

Kod: Markera allt

		<option value="6">&nbsp;'.$lang['datetime']['June'].'&nbsp;</option>
		<option value="7">&nbsp;'.$lang['datetime']['July'].'&nbsp;</option>
		<option value="8">&nbsp;'.$lang['datetime']['August'].'&nbsp;</option>
		<option value="9">&nbsp;'.$lang['datetime']['September'].'&nbsp;</option>
		<option value="10">&nbsp;'.$lang['datetime']['October'].'&nbsp;</option>
		<option value="11">&nbsp;'.$lang['datetime']['November'].'&nbsp;</option>
		<option value="12">&nbsp;'.$lang['datetime']['December'].'&nbsp;</option>
		</select>&nbsp;&nbsp;';
	$s_b_day= str_replace("value=\"".$b_day."\">", "value=\"".$b_day."\" SELECTED>" ,$s_b_day);
	$s_b_md = str_replace("value=\"".$b_md."\">", "value=\"".$b_md."\" SELECTED>" ,$s_b_md);
	$s_b_year = '<span class="genmed">' . $lang['Year'] . '&nbsp;</span><input type="text" class="post" style="width: 50px" name="b_year" size="4" maxlength="4" value="' . $b_year . '" />&nbsp;&nbsp;'; 
	$i = 0;
	$s_birthday = '';
	for ($i=0; $i<=strlen($lang['Submit_date_format']); $i++)
	{
		switch ($lang['Submit_date_format'][$i])
		{
			case d:  $s_birthday .= $s_b_day;break;
			case m:  $s_birthday .= $s_b_md;break;
			case Y:  $s_birthday .= $s_b_year;break;
		}
	}
// End add - Birthday MOD
	//
	// Let's do an overall check for settings/versions which would prevent
	// us from doing file uploads....
	//
	$ini_val = ( phpversion() >= '4.0.0' ) ? 'ini_get' : 'get_cfg_var';
	$form_enctype = ( @$ini_val('file_uploads') == '0' || strtolower(@$ini_val('file_uploads') == 'off') || phpversion() == '4.0.4pl1' || !$board_config['allow_avatar_upload'] || ( phpversion() < '4.0.3' && @$ini_val('open_basedir') != '' ) ) ? '' : 'enctype="multipart/form-data"';
	//
	// Anti Robotic Registration
	//
	if ($mode == 'register')
	{
		$sql = "DELETE FROM " . ANTI_ROBOT_TABLE . " WHERE timestamp < '" . (time() - 3600) . "' OR session_id = '" . $userdata['session_id'] . "'";
		if( !$result = $db->sql_query($sql) )
		{
				message_die(GENERAL_ERROR, 'Could not delete validation key', '', __LINE__, __FILE__, $sql);
		}

		$reg_key = gen_reg_key();

		$sql = "INSERT INTO ". ANTI_ROBOT_TABLE . " VALUES ('" . $userdata['session_id'] . "', '" . $reg_key . "', '" . time() . "')";
		if( !$result = $db->sql_query($sql) )
		{
				message_die(GENERAL_ERROR, 'Could not check registration information', '', __LINE__, __FILE__, $sql);
		}
	}
	//-----------------------
	//
	$template->assign_vars(array(
		'NAME_FIRST' => $name_first,
		'NAME_LAST' => $name_last,
		'USERNAME' => isset($username) ? $username : '',
		'CUR_PASSWORD' => isset($cur_password) ? $cur_password : '',
		'NEW_PASSWORD' => isset($new_password) ? $new_password : '',
		'PASSWORD_CONFIRM' => isset($password_confirm) ? $password_confirm : '',
		'EMAIL' => isset($email) ? $email : '',
		//signature editor
		'SIG_EDIT_LINK' => append_sid("profile.$phpEx?mode=signature"),
		'SIG_DESC' => $lang['sig_description'],
		'SIG_BUTTON_DESC' => $lang['sig_edit'],
		//signature editor
		'YIM' => $yim,
		'ICQ' => $icq,
		'MSN' => $msn,
		'AIM' => $aim,
		'OCCUPATION' => $occupation,
		'INTERESTS' => $interests,
		//
		// START Joe's Car Mod
		//
		'CAR_MARK' => $car_mark,
                'L_CAR_MARK' => $lang['Car_Mark'],
                'CAR_MODEL' => $car_model,
                'L_CAR_MODEL' => $lang['Car_Model'],

                'S_CAR_ENGINE_CHOICE' => $s_car_engine_choice,
                'S_CAR_MARK_CHOICE' => $s_car_mark_choice,
                'S_CAR_MODEL_CHOICE' => $s_car_model_choice,
                'S_CAR_YEAR_CHOICE' => $s_car_year_choice,

                'CAR_YEAR' => $car_year,
                'L_CAR_YEAR' => $lang['Car_Year'],
                'CAR_ENGINE' => $car_engine,
                'L_CAR_ENGINE' => $lang['Car_Engine'],
                'CAR_WHEEL' => $car_wheel,
                'L_CAR_WHEEL' => $lang['Car_Wheel'],
                'CAR_TRANS' => $car_trans,
                'L_CAR_TRANS' => $lang['Car_Trans'],
                'CAR_COLOR' => $car_color,
                'L_CAR_COLOR' => $lang['Car_Color'],

                'CAR_RT' => $car_rt,
                'L_CAR_RT' => $lang['Car_Rt'],
                'CAR_SIXTY' => $car_sixty,
                'L_CAR_SIXTY' => $lang['Car_Sixty'],
                'CAR_THREE' => $car_three,
                'L_CAR_THREE' => $lang['Car_Three'],
                'CAR_EIGTH' => $car_eigth,
                'L_CAR_EIGTH' => $lang['Car_Eigth'],
                'CAR_EIGTHM' => $car_eigthm,
                'L_CAR_EIGTHM' => $lang['Car_Eigthm'],
                'CAR_THOU' => $car_thou,
                'L_CAR_THOU' => $lang['Car_Thou'],
                'CAR_QUART' => $car_quart,
                'L_CAR_QUART' => $lang['Car_Quart'],
                'CAR_QUARTM' => $car_quartm,
                'L_CAR_QUARTM' => $lang['Car_Quartm'],

                'MOD_ENGINE' => $mod_engine,
                'L_MOD_ENGINE' => $lang['Car_Engine'],
                'MOD_EXTERIOR' => $mod_exterior,
                'L_MOD_EXTERIOR' => $lang['Car_Exterior'],
                'MOD_INTERIOR' => $mod_interior,
                'L_MOD_INTERIOR' => $lang['Car_Interior'],
                'MOD_RIMS' => $mod_rims,
                'L_MOD_RIMS' => $lang['Car_Rims'],
                'MOD_AUDIO' => $mod_audio,
                'L_MOD_AUDIO' => $lang['Car_Audio'],
                'MOD_FUTURE' => $mod_future,
                'L_MOD_FUTURE' => $lang['Car_Future'],
		//
		// END Joe's Car Mod
		//
		'ALLOW_NEW_IMG_POPUP_YES' => ( $user_allow_new_img_popup ) ? 'checked="checked"' : '',
		'ALLOW_NEW_IMG_POPUP_NO' => ( !$user_allow_new_img_popup ) ? 'checked="checked"' : '',
		'L_ALLOW_NEW_IMG_POPUP' => $lang['User_allow_new_img_popup'],
		'INFO' => $info,
		'L_INFO' => $lang['Info'],
		'L_USER_ABSENCE' => $lang['User_absence'],
		'L_USER_ABSENCE_MODE' => $lang['User_absence_mode'],
		'L_USER_ABSENCE_TEXT' => $lang['User_absence_text'],
		'USER_ABSENCE_YES' => ($user_absence) ? 'checked="checked"' : '',
		'USER_ABSENCE_NO' => (!$user_absence) ? 'checked="checked"' : '',
		'S_USER_ABSENCE_MODE' => $s_user_absence_mode,
		'S_USER_ABSENCE_TEXT' => $user_absence_text,
		// Start add - Birthday MOD
		'S_BIRTHDAY' => $s_birthday,
		'BIRTHDAY_REQUIRED' => ($board_config['birthday_required']) ? '*' : '',
		// End add - Birthday MOD 
		'LOCATION' => $location,
		// FLAGHACK-start
		'L_FLAG' => $lang['Country_Flag'],
		'FLAG_SELECT' => $flag_select,
		'FLAG_START' => $flag_start_image,
		// FLAGHACK-end
		'WEBSITE' => $website,
		'SIGNATURE' => str_replace('<br />', "\n", $signature),
		// Start add - Gender MOD
		'LOCK_GENDER' =>($mode!='register') ? 'DISABLED':'', 
		'GENDER' => $gender, 
		'GENDER_NO_SPECIFY_CHECKED' => $gender_no_specify_checked, 
		'GENDER_MALE_CHECKED' => $gender_male_checked, 
		'GENDER_FEMALE_CHECKED' => $gender_female_checked, 
		// End add - Gender MOD
		'VIEW_EMAIL_YES' => ( $viewemail ) ? 'checked="checked"' : '',
		'VIEW_EMAIL_NO' => ( !$viewemail ) ? 'checked="checked"' : '',
		'HIDE_USER_YES' => ( !$allowviewonline ) ? 'checked="checked"' : '',
		'HIDE_USER_NO' => ( $allowviewonline ) ? 'checked="checked"' : '',
		'NOTIFY_PM_YES' => ( $notifypm ) ? 'checked="checked"' : '',
		'NOTIFY_PM_NO' => ( !$notifypm ) ? 'checked="checked"' : '',
		'POPUP_PM_YES' => ( $popup_pm ) ? 'checked="checked"' : '',
		'POPUP_PM_NO' => ( !$popup_pm ) ? 'checked="checked"' : '',
		'ALWAYS_ADD_SIGNATURE_YES' => ( $attachsig ) ? 'checked="checked"' : '',
		'ALWAYS_ADD_SIGNATURE_NO' => ( !$attachsig ) ? 'checked="checked"' : '',
		'ALWAYS_SET_BOOKMARK_YES' => ( $setbm ) ? 'checked="checked"' : '',
		'ALWAYS_SET_BOOKMARK_NO' => ( !$setbm ) ? 'checked="checked"' : '',
		'NOTIFY_REPLY_YES' => ( $notifyreply ) ? 'checked="checked"' : '',
		'NOTIFY_REPLY_NO' => ( !$notifyreply ) ? 'checked="checked"' : '',
		'ALWAYS_ALLOW_BBCODE_YES' => ( $allowbbcode ) ? 'checked="checked"' : '',
		'ALWAYS_ALLOW_BBCODE_NO' => ( !$allowbbcode ) ? 'checked="checked"' : '',
		'ALWAYS_ALLOW_HTML_YES' => ( $allowhtml ) ? 'checked="checked"' : '',
		'ALWAYS_ALLOW_HTML_NO' => ( !$allowhtml ) ? 'checked="checked"' : '',
		'ALWAYS_ALLOW_SMILIES_YES' => ( $allowsmilies ) ? 'checked="checked"' : '',
		'ALWAYS_ALLOW_SMILIES_NO' => ( !$allowsmilies ) ? 'checked="checked"' : '',
		'ALLOW_AVATAR' => $board_config['allow_avatar_upload'],
		'AVATAR' => $avatar_img,
		'AVATAR_SIZE' => $board_config['avatar_filesize'],
		'LANGUAGE_SELECT' => language_select($user_lang, 'language'),
		'STYLE_SELECT' => style_select($user_style, 'style'),
		'TIMEZONE_SELECT' => tz_select($user_timezone, 'timezone'),
		'DATE_FORMAT_SELECT' => date_format_select($user_dateformat, $user_timezone),
		'HTML_STATUS' => $html_status,
		'BBCODE_STATUS' => sprintf($bbcode_status, '<a href="' . append_sid("faq.$phpEx?mode=bbcode") . '" target="_phpbbcode">', '</a>'),
		'SMILIES_STATUS' => $smilies_status,

		'L_NAME_FIRST' => $lang['name_first'],
		'L_NAME_LAST' => $lang['name_last'],
		'L_NAME_FIRST_DISPLAY_WARNING' => $lang['name_first_display_warning'],
		'L_NAME_LAST_DISPLAY_WARNING' => $lang['name_last_display_warning'],
		'L_CURRENT_PASSWORD' => $lang['Current_password'],
		'L_NEW_PASSWORD' => ( $mode == 'register' ) ? $lang['Password'] : $lang['New_password'],
		'L_CONFIRM_PASSWORD' => $lang['Confirm_password'],
		'L_CONFIRM_PASSWORD_EXPLAIN' => ( $mode == 'editprofile' ) ? $lang['Confirm_password_explain'] : '',
		'L_PASSWORD_IF_CHANGED' => ( $mode == 'editprofile' ) ? $lang['password_if_changed'] : '',
		'L_PASSWORD_CONFIRM_IF_CHANGED' => ( $mode == 'editprofile' ) ? $lang['password_confirm_if_changed'] : '',
		'L_SUBMIT' => $lang['Submit'],
		'L_RESET' => $lang['Reset'],
		'L_ICQ_NUMBER' => $lang['ICQ'],
		'L_MESSENGER' => $lang['MSNM'],
		'L_YAHOO' => $lang['YIM'],
		'L_WEBSITE' => $lang['Website'],
		'L_AIM' => $lang['AIM'],
		'L_LOCATION' => $lang['Location'],
		'L_OCCUPATION' => $lang['Occupation'],
		'L_BOARD_LANGUAGE' => $lang['Board_lang'],
		'L_BOARD_STYLE' => $lang['Board_style'],
		'L_TIMEZONE' => $lang['Timezone'],
		'L_DATE_FORMAT' => $lang['Date_format'],
		'L_DATE_FORMAT_EXPLAIN' => $lang['Date_format_explain'],
		'L_YES' => $lang['Yes'],
		'L_NO' => $lang['No'],
		'L_INTERESTS' => $lang['Interests'],
		// Start add - Gender MOD
		'L_GENDER' =>$lang['Gender'], 
		'L_GENDER_MALE' =>$lang['Male'], 
		'L_GENDER_FEMALE' =>$lang['Female'], 
		'L_GENDER_NOT_SPECIFY' =>$lang['No_gender_specify'], 
		// End add - Gender MOD
		// Start add - Birthday MOD
		'L_BIRTHDAY' => $lang['Birthday'],
		// End add - Birthday MOD
		'L_ALWAYS_ALLOW_SMILIES' => $lang['Always_smile'],
		'L_ALWAYS_ALLOW_BBCODE' => $lang['Always_bbcode'],
		'L_ALWAYS_ALLOW_HTML' => $lang['Always_html'],
		'L_HIDE_USER' => $lang['Hide_user'],
		'L_ALWAYS_ADD_SIGNATURE' => $lang['Always_add_sig'],
		'L_ALWAYS_SET_BOOKMARK' => $lang['Always_set_bm'],
		
		'L_AVATAR_PANEL' => $lang['Avatar_panel'],
		'L_AVATAR_EXPLAIN' => sprintf($lang['Avatar_explain'], $board_config['avatar_max_width'], $board_config['avatar_max_height'], (round($board_config['avatar_filesize'] / 1024))),
		'L_UPLOAD_AVATAR_FILE' => $lang['Upload_Avatar_file'],
		'L_UPLOAD_AVATAR_URL' => $lang['Upload_Avatar_URL'],
		'L_UPLOAD_AVATAR_URL_EXPLAIN' => $lang['Upload_Avatar_URL_explain'],
		'L_AVATAR_GALLERY' => $lang['Select_from_gallery'],
		'L_SHOW_GALLERY' => $lang['View_avatar_gallery'],
		'L_LINK_REMOTE_AVATAR' => $lang['Link_remote_Avatar'],
		'L_LINK_REMOTE_AVATAR_EXPLAIN' => $lang['Link_remote_Avatar_explain'],
		'L_DELETE_AVATAR' => $lang['Delete_Image'],
		'L_CURRENT_IMAGE' => $lang['Current_Image'],

		'L_SIGNATURE' => $lang['Signature'],
		'L_SIGNATURE_EXPLAIN' => sprintf($lang['Signature_explain'], $board_config['max_sig_chars']),
		'L_NOTIFY_ON_REPLY' => $lang['Always_notify'],
		'L_NOTIFY_ON_REPLY_EXPLAIN' => $lang['Always_notify_explain'],
		'L_NOTIFY_ON_PRIVMSG' => $lang['Notify_on_privmsg'],
		'L_POPUP_ON_PRIVMSG' => $lang['Popup_on_privmsg'],
		'L_POPUP_ON_PRIVMSG_EXPLAIN' => $lang['Popup_on_privmsg_explain'],
		'L_PREFERENCES' => $lang['Preferences'],
		'L_PUBLIC_VIEW_EMAIL' => $lang['Public_view_email'],
		'L_ITEMS_REQUIRED' => $lang['Items_required'],
		'L_REGISTRATION_INFO' => $lang['Registration_info'],
		'L_PROFILE_INFO' => $lang['Profile_info'],
		'L_PROFILE_INFO_NOTICE' => $lang['Profile_info_warn'],
		'L_EMAIL_ADDRESS' => $lang['Email_address'],
		// Anti Robotic Registration MOD
		'L_VALIDATION' => $lang['Validation'],
		'L_VALIDATION_EXPLAIN' => $lang['Validation_explain'],
		'S_ANTI_ROBOT1' => append_sid('antirobot_pic.'.$phpEx.'?id=1'),
		'S_ANTI_ROBOT2' => append_sid('antirobot_pic.'.$phpEx.'?id=2'),
		'S_ANTI_ROBOT3' => append_sid('antirobot_pic.'.$phpEx.'?id=3'),
		'S_ANTI_ROBOT4' => append_sid('antirobot_pic.'.$phpEx.'?id=4'),
		'S_ANTI_ROBOT5' => append_sid('antirobot_pic.'.$phpEx.'?id=5'),
// Begin Map Mod
'LONGITUDE' => $longitude,
'LATITUDE' => $latitude,
'L_LONGITUDE' => $lang['map_longitude'],
'L_LATITUDE' => $lang['map_latitude'],
'L_LONGITUDE_HELP' => $lang['map_longitudehelp'],
'L_LATITUDE_HELP' => $lang['map_latitudehelp'],
'L_MAP_INFO' => $lang['map_section_title'],
'L_MAP_DESCRIPTION' => $lang['map_section_description'],
'L_DEGREES' => $lang['map_degrees'],
'L_MINUTES' => $lang['map_minutes'],
'L_FIND_PLACE' => $lang['map_find_place'],
'U_FIND_PLACE' => append_sid("map_search.$phpEx"),
// End Map Mod
		'S_ALLOW_AVATAR_UPLOAD' => $board_config['allow_avatar_upload'],
		'S_ALLOW_AVATAR_LOCAL' => $board_config['allow_avatar_local'],
		'S_ALLOW_AVATAR_REMOTE' => $board_config['allow_avatar_remote'],
		'S_HIDDEN_FIELDS' => $s_hidden_fields,
		'S_FORM_ENCTYPE' => $form_enctype,
		'S_PROFILE_ACTION' => append_sid("profile.$phpEx"))
	);

	//
	// This is another cheat using the block_var capability
	// of the templates to 'fake' an IF...ELSE...ENDIF solution
	// it works well :)
	//
	if ( $mode != 'register' )
	{
		if ( $userdata['session_logged_in'] || $userdata['user_allowavatar'] && ( $board_config['allow_avatar_upload'] || $board_config['allow_avatar_local'] || $board_config['allow_avatar_remote'] ) )
		{
			$template->assign_block_vars('switch_avatar_block', array() );

			if ( $board_config['allow_avatar_upload'] && file_exists(@phpbb_realpath('./' . $board_config['avatar_path'])) )
			{
				if ( $form_enctype != '' )
				{
					$template->assign_block_vars('switch_avatar_block.switch_avatar_local_upload', array() );
				}
				$template->assign_block_vars('switch_avatar_block.switch_avatar_remote_upload', array() );
			}

			if ( $board_config['allow_avatar_remote'] )
			{
				$template->assign_block_vars('switch_avatar_block.switch_avatar_remote_link', array() );
			}

			if ( $board_config['allow_avatar_local'] && file_exists(@phpbb_realpath('./' . $board_config['avatar_gallery_path'])) )
			{
				$template->assign_block_vars('switch_avatar_block.switch_avatar_local_gallery', array() );
			}
		}
	}
	else
	{
		$template->assign_block_vars('switch_validation', array() );
	}
}

///
/// Begin Names in Profile MOD
///

if ( $board_config['name_first_required'] )
	{
	$template->assign_block_vars('switch_name_first_required',array() );
	}

if ( $board_config['name_last_required'] )
	{
	$template->assign_block_vars('switch_name_last_required',array() );
	}
 
if ( $board_config['name_first_display'] )
	{
	$template->assign_block_vars('switch_name_first_display', array());
	}

if ( $board_config['name_last_display'] )
	{
	$template->assign_block_vars('switch_name_last_display', array());
	}

///
/// End Names in Profile MOD
///
$template->pparse('body');

include($phpbb_root_path . 'includes/page_tail.'.$phpEx);

?>
Bästa hälsningar - Mikael Andersson

Välkommen till: http://www.bikersite.se - Träffpunkten för svenska bikers!

Användarvisningsbild
WickeD
Extra aktiv medlem
Extra aktiv medlem
Inlägg: 979
Blev medlem: 2004-11-08 12:17
Ort: Sverige / Umeå
Kontakt:

Inlägg av WickeD » 2006-04-13 17:22

Detta kör jag fast på nu:

Install säger:

Kod: Markera allt

#-----[ OPEN ]---------------------------------------------
# 
index.php
Detta hittar jag inte i den filen:

Kod: Markera allt

#
#-----[ FIND ]---------------------------------------------
# 
while( $category_rows[] = $db->sql_fetchrow($result) );

#
#-----[ REPLACE WITH ]---------------------------------------------
#
while ($row = $db->sql_fetchrow($result))
{
	$category_rows[] = $row;
}

#
#-----[ FIND ]-----------------------------------------------
# 
	// Okay, let's build the index
	//
	for($i = 0; $i < $total_categories; $i++)
	{
		$cat_id = $category_rows[$i]['cat_id'];

		//
		// Should we display this category/forum set?
		//
		$display_forums = false;
		for($j = 0; $j < $total_forums; $j++)
		{
			if ( $is_auth_ary[$forum_data[$j]['forum_id']]['auth_view'] && $forum_data[$j]['cat_id'] == $cat_id )
			{
				$display_forums = true;
			}
		}

		//
		// Yes, we should, so first dump out the category
		// title, then, if appropriate the forum list
		//
		if ( $display_forums )

#
#-----[ REPLACE WITH ]---------------------------------------------
#
	// Let's decide which categories we should display
	//
	$display_categories = array();

	for ($i = 0; $i < $total_forums; $i++ )
	{
		if ($is_auth_ary[$forum_data[$i]['forum_id']]['auth_view'])
		{
			$display_categories[$forum_data[$i]['cat_id']] = true;
		}
	}

	//
	// Okay, let's build the index
	//
	for($i = 0; $i < $total_categories; $i++)
	{
		$cat_id = $category_rows[$i]['cat_id'];

		//
		// Yes, we should, so first dump out the category
		// title, then, if appropriate the forum list
		//
		if (isset($display_categories[$cat_id]) && $display_categories[$cat_id])
Detta är min fil:

Kod: Markera allt

<?php
/***************************************************************************
 *                                index.php
 *                            -------------------
 *   begin                : Saturday, Feb 13, 2001
 *   copyright            : (C) 2001 The phpBB Group
 *   email                : support@phpbb.com
 *
 *   $Id: index.php,v 1.99.2.2 2004/03/01 15:56:52 psotfx Exp $
 *
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/

define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
//-- add
include_once($phpbb_root_path . 'includes/functions_announces.'. $phpEx);
//-- fin mod : announces ---------------------------------------------------------------------------

if (file_exists($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . "/lang_main_link.$phpEx"))
		{
			include_once($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . "/lang_main_link.$phpEx");
		}
		elseif (file_exists($phpbb_root_path . "language/lang_english/lang_main_link.$phpEx"))
		{
			include_once($phpbb_root_path . "language/lang_english/lang_main_link.$phpEx");
		}
		else
		{
			message_die(GENERAL_ERROR, "Unable to find a suitable language file for Advanced Links Mod", '');
		}
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//

include_once($phpbb_root_path.'includes/functions_color_groups.'.$phpEx);
color_groups_setup_list();

$viewcat = ( !empty($HTTP_GET_VARS[POST_CAT_URL]) ) ? $HTTP_GET_VARS[POST_CAT_URL] : -1;
$viewcat = intval($viewcat);
if ($viewcat <= 0) $viewcat = -1;
$viewcatkey = ($viewcat < 0) ? 'Root' : POST_CAT_URL . $viewcat;
if( isset($HTTP_GET_VARS['mark']) || isset($HTTP_POST_VARS['mark']) )
{
	$mark_read = ( isset($HTTP_POST_VARS['mark']) ) ? $HTTP_POST_VARS['mark'] : $HTTP_GET_VARS['mark'];
}
else
{
	$mark_read = '';
}

//
// Handle marking posts
//
if( $mark_read == 'forums' )
{
	if ( $viewcat < 0 )
	{
	if( $userdata['session_logged_in'] )
	{
		setcookie($board_config['cookie_name'] . '_f_all', time(), 0, $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']);
	}

	$template->assign_vars(array(
		"META" => '<meta http-equiv="refresh" content="3;url='  .append_sid("index.$phpEx") . '">')
	);
	}
	else
	{
		if( $userdata['session_logged_in'] )
		{
			// get the list of object authorized
			$keys = array();
			$keys = get_auth_keys($viewcatkey);

			// mark each forums
			for ($i=0; $i < count($keys['id']); $i++) if ($tree['type'][ $keys['idx'][$i] ] == POST_FORUM_URL)
			{
				$forum_id = $tree['id'][ $keys['idx'][$i] ];
				$sql = "SELECT MAX(post_time) AS last_post FROM " . POSTS_TABLE . " WHERE forum_id = $forum_id";
				if ( !($result = $db->sql_query($sql)) ) message_die(GENERAL_ERROR, 'Could not obtain forums information', '', __LINE__, __FILE__, $sql);
				if ( $row = $db->sql_fetchrow($result) )
				{
					$tracking_forums = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) : array();
					$tracking_topics = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) : array();

					if ( ( count($tracking_forums) + count($tracking_topics) ) >= 150 && empty($tracking_forums[$forum_id]) )
					{
						asort($tracking_forums);
						unset($tracking_forums[key($tracking_forums)]);
					}

					if ( $row['last_post'] > $userdata['user_lastvisit'] )
					{
						$tracking_forums[$forum_id] = time();
						setcookie($board_config['cookie_name'] . '_f', serialize($tracking_forums), 0, $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']);
					}
				}
			}
		}

		$template->assign_vars(array(
			"META" => '<meta http-equiv="refresh" content="3;url='  .append_sid("index.$phpEx?" . POST_CAT_URL . "=$viewcat") . '">')
		);
	}
	$message = $lang['Forums_marked_read'] . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a> ');

	message_die(GENERAL_MESSAGE, $message);
}
//
// End handle marking posts
//

//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
// $tracking_topics = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_t"]) : array();
// $tracking_forums = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_f"]) : array();
//-- fin mod : categories hierarchy ----------------------------------------------------------------

//
// If you don't use these stats on your index you may want to consider
// removing them
//
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
// $total_posts = get_db_stat('postcount');
// $total_users = get_db_stat('usercount');
//-- add
include_once($phpbb_root_path . 'includes/mods_settings/mod_categories_hierarchy.' . $phpEx);
if ( ($board_config['display_viewonline'] == 2) || ( ($viewcat < 0) && ($board_config['display_viewonline'] == 1) ) )
{
	if ( empty($board_config['max_posts']) || empty($board_config['max_users']) )
	{
		board_stats();
	}
	$total_posts = $board_config['max_posts'];
	$total_users = $board_config['max_users'];
//-- fin mod : categories hierarchy ----------------------------------------------------------------
$newest_userdata = get_db_stat('newestuser');
$newest_user = $newest_userdata['username'];
$newest_uid = $newest_userdata['user_id'];

if( $total_posts == 0 )
{
	$l_total_post_s = $lang['Posted_articles_zero_total'];
}
else if( $total_posts == 1 )
{
	$l_total_post_s = $lang['Posted_article_total'];
}
else
{
	$l_total_post_s = $lang['Posted_articles_total'];
}

if( $total_users == 0 )
{
	$l_total_user_s = $lang['Registered_users_zero_total'];
}
else if( $total_users == 1 )
{
	$l_total_user_s = $lang['Registered_user_total'];
}
else
{
	$l_total_user_s = $lang['Registered_users_total'];
}

//-- mod : categories hierarchy --------------------------------------------------------------------
//-- add
}
//-- fin mod : categories hierarchy ----------------------------------------------------------------

//
// Start page proper
//
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
//-- fin mod : categories hierarchy ----------------------------------------------------------------
	$sql = "SELECT *
		FROM ". LINK_CONFIG_TABLE;
	if(!$result = $db->sql_query($sql))
	{
		message_die(GENERAL_ERROR, "Could not query Link config information", "", __LINE__, __FILE__, $sql);
	}
	
	while( $row = $db->sql_fetchrow($result) )
	{
		$link_config_name = $row['config_name'];
		$link_config_value = $row['config_value'];
		$link_config[$link_config_name] = $link_config_value;
		$link_self_img = $link_config['site_logo'];
		$site_logo_height = $link_config['height'];
		$site_logo_width = $link_config['width'];
	}

	// Birthday Mod, Show users with birthday 
$sql = ($board_config['birthday_check_day']) ? "SELECT user_id, username, user_birthday,user_level FROM " . USERS_TABLE. " WHERE user_birthday!=999999 ORDER BY username" :"";
if($result = $db->sql_query($sql)) 
{ 
	if (!empty($result)) 
	{ 
		$time_now = time();
		$this_year = create_date('Y', $time_now, $board_config['board_timezone']);
		$date_today = create_date('Ymd', $time_now, $board_config['board_timezone']);
		$date_forward = create_date('Ymd', $time_now+($board_config['birthday_check_day']*86400), $board_config['board_timezone']);
	      while ($birthdayrow = $db->sql_fetchrow($result))
		{ 
usleep(2);
		      $user_birthday2 = $this_year.($user_birthday = realdate("md",$birthdayrow['user_birthday'] )); 
      		if ( $user_birthday2 < $date_today ) $user_birthday2 += 10000;
			if ( $user_birthday2 > $date_today  && $user_birthday2 <= $date_forward ) 
			{ 
				// user are having birthday within the next days
				$user_age = ( $this_year.$user_birthday < $date_today ) ? $this_year - realdate ('Y',$birthdayrow['user_birthday'])+1 : $this_year- realdate ('Y',$birthdayrow['user_birthday']); 
				$style_color = color_group_colorize_name($birthdayrow['user_id'],true);
				$birthday_week_list .= ' <a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $birthdayrow['user_id']) . '" class="gensmall">' . $style_color . ' ('.$user_age.')</a>,'; 
			} else if ( $user_birthday2 == $date_today ) 
      		{ 
				//user have birthday today 
				$user_age = $this_year - realdate ( 'Y',$birthdayrow['user_birthday'] ); 
				$style_color = color_group_colorize_name($birthdayrow['user_id'],true);

				$birthday_today_list .= ' <a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $birthdayrow['user_id']) . '" class="gensmall">' . $style_color . ' ('.$user_age.')</a>,'; 
		      }
			 
		}
		if ($birthday_today_list) $birthday_today_list[ strlen( $birthday_today_list)-1] = ' ';
		if ($birthday_week_list) $birthday_week_list[ strlen( $birthday_week_list)-1] = ' ';
	} 
	$db->sql_freeresult($result);
}
// Start add - Last visit MOD
$time_now=time();
$time1Hour=$time_now-3600;
$minutes = date('is', $time_now);
$hour_now = $time_now - (60*($minutes[0].$minutes[1])) - ($minutes[2].$minutes[3]); 
$dato=create_date('H', $time_now,$board_config['board_timezone']);
$timetoday = $hour_now - (3600*$dato); 
$sql = 'SELECT session_ip, MAX(session_time) as session_time FROM '.SESSIONS_TABLE.' WHERE session_user_id="'.ANONYMOUS.'" AND session_time >= '.$timetoday.' AND session_time< '.($timetoday+86399).' GROUP BY session_ip';
if (!$result = $db->sql_query($sql)) message_die(GENERAL_ERROR, "Couldn't retrieve guest user today data", "", __LINE__, __FILE__, $sql); 
while( $guest_list = $db->sql_fetchrow($result))
{ 
	if ($guest_list['session_time'] >$time1Hour) $users_lasthour++;
}
$guests_today = $db->sql_numrows($result);
$sql = 'SELECT user_id,username,user_allow_viewonline,user_level,user_lastlogon FROM ' . USERS_TABLE . ' WHERE user_id!="'.ANONYMOUS.'" AND user_session_time >= '.$timetoday.' AND user_session_time< '.($timetoday+86399).' ORDER BY username'; 
if (!$result = $db->sql_query($sql)) message_die(GENERAL_ERROR, "Couldn't retrieve user today data", "", __LINE__, __FILE__, $sql); 
while( $todayrow = $db->sql_fetchrow($result)) 
{ 
	$style_color = ""; 
	if ($todayrow['user_lastlogon']>=$time1Hour)
	{
		$users_lasthour++;
	}
	$style_color = color_group_colorize_name($todayrow['user_id'],true);
 	$users_today_list.=( $todayrow['user_allow_viewonline'])?' <a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $todayrow['user_id']) . '" class="gensmall">' . $style_color . '</a>,' : (($userdata[user_level]==ADMIN) ? ' <a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $todayrow['user_id']) . '" class="gensmall"><i>' . $style_color .'</i></a>,' : '');  
	if (!$todayrow['user_allow_viewonline']) $logged_hidden_today++;
	else $logged_visible_today++;
}
if ($users_today_list) 
{
	$users_today_list[ strlen( $users_today_list)-1] = ' '; 
} else
{
	$users_today_list = $lang['None'];
}
$total_users_today = $db->sql_numrows($result)+$guests_today;

$users_today_list = $lang['Registered_users'].' ' . $users_today_list;
$l_today_user_s = ($total_users_today) ? ( ( $total_users_today == 1 )? $lang['User_today_total'] : $lang['Users_today_total'] ) : $lang['Users_today_zero_total'];
$l_today_r_user_s = ($logged_visible_today) ? ( ( $logged_visible_today == 1 ) ? $lang['Reg_user_total'] : $lang['Reg_users_total'] ) : $lang['Reg_users_zero_total'];
$l_today_h_user_s = ($logged_hidden_today) ? (($logged_hidden_today == 1) ? $lang['Hidden_user_total'] : $lang['Hidden_users_total'] ) : $lang['Hidden_users_zero_total'];
$l_today_g_user_s = ($guests_today) ? (($guests_today == 1) ? $lang['Guest_user_total'] : $lang['Guest_users_total']) : $lang['Guest_users_zero_total'];
$l_today_users = sprintf($l_today_user_s, $total_users_today);
$l_today_users .= sprintf($l_today_r_user_s, $logged_visible_today); 
$l_today_users .= sprintf($l_today_h_user_s, $logged_hidden_today); 
$l_today_users .= sprintf($l_today_g_user_s, $guests_today);
// End add - Last visit MOD

if ($plus_config['index_layout'] == 'index_body_plus.tpl')
	{
	$today_registered_users = 0;
	$yesterday_registered_users = 0;

		$today_time = time();
$yesterday_time = $today_time - 86400;

$day = create_date('d', $yesterday_time, $userdata['user_timezone']);
$month = create_date('m', $yesterday_time, $userdata['user_timezone']);
$year = create_date('Y', $yesterday_time, $userdata['user_timezone']);

$y_day_from = strtotime($year.'-'.$month.'-'.$day.' 00:00:00');

$day = create_date('d', $today_time, $userdata['user_timezone']);
$month = create_date('m', $today_time, $userdata['user_timezone']);
$year = create_date('Y', $today_time, $userdata['user_timezone']);

$t_day_from = strtotime($year.'-'.$month.'-'.$day.' 00:00:00');

	$sql = "SELECT count(distinct user_id) as total_users FROM " . USERS_TABLE . "
	WHERE user_regdate >= $y_day_from
		AND user_regdate < $t_day_from
		AND user_id <> " . ANONYMOUS;
if ( !$result = $db->sql_query($sql) )
{
	message_die(GENERAL_ERROR, 'Could not get yesterday registered users', '', __LINE__, __FILE__, $sql);
}

while ( $row = $db->sql_fetchrow($result) )
{
	$yesterday_registered_users = $row['total_users'];
}

$db->sql_freeresult($result);

	$sql = "SELECT count(distinct user_id) as total_users FROM " . USERS_TABLE . "
		WHERE user_regdate >= $t_day_from
		AND user_id <> " . ANONYMOUS;
if ( !$result = $db->sql_query($sql) )
{
	message_die(GENERAL_ERROR, 'Could not get yesterday registered users', '', __LINE__, __FILE__, $sql);
}

while ( $row = $db->sql_fetchrow($result) )
{
	$today_registered_users = $row['total_users'];
}

$db->sql_freeresult($result);
}
	//
	// Start output of page
	//
	//-- mod : categories hierarchy --------------------------------------------------------------------
//-- add
// set the parm of the mark read func
$mark = ($viewcat == -1 ) ? '' : '&' . POST_CAT_URL . '=' . $viewcat;
// monitor the board statistic
if (($board_config['display_viewonline'] == 2) || (($viewcat < 0) && ($board_config['display_viewonline'] == 1)))
{
//-- fin mod : categories hierarchy ---------------------------------------------------------------- 
	define('SHOW_ONLINE', true);
	//-- mod : categories hierarchy --------------------------------------------------------------------
//-- add
}
//-- fin mod : categories hierarchy ----------------------------------------------------------------
	$page_title = $lang['Index'];
	include($phpbb_root_path . 'includes/page_header.'.$phpEx);

	$template->set_filenames(array(
		'body' => $plus_config['index_layout'])
	);
	
	if ($plus_config['index_layout'] == 'index_body_plus.tpl')
	{
        	$template->assign_vars(array(
        	'TOTAL_USERS' => $total_users,
        	'TOTAL_POSTS' => $total_posts,
        	'NEWEST_USER' => sprintf($lang['Newest_user_plus'], '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$newest_uid") . '">', $newest_user, '</a>'),
        	'TODAY_USERS' => $today_registered_users,
        	'YESTERDAY_USERS' => $yesterday_registered_users,
        	'USERS_TODAY_LIST' => $users_today_list,
        	'GUESTS_ONLINE' => $guests_online,
        	'REGGED_ONLINE' => $logged_visible_online,
        	'L_FORUM' => $lang['Forum'],
		'L_TOPICS' => $lang['Topics'],
		'L_REPLIES' => $lang['Replies'],
		'L_VIEWS' => $lang['Views'],
		'L_POSTS' => $lang['Posts'],
		'L_LASTPOST' => $lang['Last_Post'], 
		'L_LAST_VISIT' => $lang['Last_Visit'],
		'L_NO_NEW_POSTS' => $lang['No_new_posts'],
		'L_NEW_POSTS' => $lang['New_posts'],
		'L_NO_NEW_POSTS_LOCKED' => $lang['No_new_posts_locked'], 
		'L_NEW_POSTS_LOCKED' => $lang['New_posts_locked'], 
		'L_ONLINE_EXPLAIN' => $lang['Online_explain'], 
        	'FORUM_IMG' => $images['forum'],
		'FORUM_NEW_IMG' => $images['forum_new'],
		'FORUM_LOCKED_IMG' => $images['forum_locked'],
        	'L_WHOSBIRTHDAY_WEEK' => ($board_config['birthday_check_day'] > 1) ? sprintf( (($birthday_week_list) ? $lang['Birthday_week'] : $lang['Nobirthday_week']), $board_config['birthday_check_day']).$birthday_week_list : '',
		'L_WHOSBIRTHDAY_TODAY' => ($board_config['birthday_check_day']) ? ($birthday_today_list) ? $lang['Birthday_today'].$birthday_today_list : $lang['Nobirthday_today'] : '',
        	'L_USERS_LASTHOUR' =>($users_lasthour)?sprintf($lang['Users_lasthour_explain'],$users_lasthour):$lang['Users_lasthour_none_explain'],
		'L_USERS_TODAY' =>$l_today_users,
        	'L_LINKS' => $lang['Site_links'],
		'U_LINKS' => append_sid("links.$phpEx"),
		'U_LINKS_JS' => "links.js.$phpEx",
		'U_SITE_LOGO' => $link_self_img,
		'SITE_LOGO_WIDTH' => $site_logo_width,
		'SITE_LOGO_HEIGHT' => $site_logo_height,
        	'L_LIVE_STATS' => $lang['Live_Statistics'],
        	'L_MEMBERS' => $lang['Top_Member'],
        	'L_LATEST' => $lang['Latest_Member'],
        	'L_NEW_TODAY' => $lang['New_Today'],
        	'L_NEW_YESTERDAY' => $lang['New_Yesterday'],
        	'L_MEMBERS_OVERALL' => $lang['Members_Overall'],
        	'L_ONLINE_NOW' => $lang['Online_Now'],
        	'L_GUESTS' => $lang['Guests_P'],
        	'L_MEMBERS' => $lang['Members_P'],
        	'L_STATS' => $lang['Box_Stats'],
        	'L_USER_RECORD' => $lang['User_Record'],
        	'L_TOTAL_POSTS' => $lang['Total_Posts'],
        	'L_BIRTHDAYS' => $lang['Birthdays_P'],
        	'L_FORUM_LOCKED' => $lang['Forum_is_locked'],
        	'L_MODERATOR' => $lang['Moderators'],
		'L_MARK_FORUMS_READ' => $lang['Mark_all_forums'],
		'U_MARK_READ' => append_sid("index.$phpEx?mark=forums$mark"),
		'L_ONLINE_MEMBERS' => $lang['Online_Members_P']) 
        	);
        }
	else
	{
	$template->assign_vars(array(
		'TOTAL_POSTS' => sprintf($l_total_post_s, $total_posts),
		'TOTAL_USERS' => sprintf($l_total_user_s, $total_users),
		'NEWEST_USER' => sprintf($lang['Newest_user'], '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$newest_uid") . '">', $newest_user, '</a>'), 

		'FORUM_IMG' => $images['forum'],
		'FORUM_NEW_IMG' => $images['forum_new'],
		'FORUM_LOCKED_IMG' => $images['forum_locked'],
		// Start add - Last visit MOD
		'USERS_TODAY_LIST' => $users_today_list,

		'L_USERS_LASTHOUR' =>($users_lasthour)?sprintf($lang['Users_lasthour_explain'],$users_lasthour):$lang['Users_lasthour_none_explain'],
		'L_USERS_TODAY' =>$l_today_users,
		// End add - Last visit MOD

		// Start add - Birthday MOD
		'L_WHOSBIRTHDAY_WEEK' => ($board_config['birthday_check_day'] > 1) ? sprintf( (($birthday_week_list) ? $lang['Birthday_week'] : $lang['Nobirthday_week']), $board_config['birthday_check_day']).$birthday_week_list : '',
		'L_WHOSBIRTHDAY_TODAY' => ($board_config['birthday_check_day']) ? ($birthday_today_list) ? $lang['Birthday_today'].$birthday_today_list : $lang['Nobirthday_today'] : '',
// End add - Birthday MOD

		'L_FORUM' => $lang['Forum'],
		'L_TOPICS' => $lang['Topics'],
		'L_REPLIES' => $lang['Replies'],
		'L_VIEWS' => $lang['Views'],
		'L_POSTS' => $lang['Posts'],
		'L_LASTPOST' => $lang['Last_Post'], 
		'L_NO_NEW_POSTS' => $lang['No_new_posts'],
		'L_NEW_POSTS' => $lang['New_posts'],
		'L_NO_NEW_POSTS_LOCKED' => $lang['No_new_posts_locked'], 
		'L_NEW_POSTS_LOCKED' => $lang['New_posts_locked'], 
		'L_ONLINE_EXPLAIN' => $lang['Online_explain'], 
		'L_LINKS' => $lang['Site_links'],
		'U_LINKS' => append_sid("links.$phpEx"),
		'U_LINKS_JS' => "links.js.$phpEx",
		'U_SITE_LOGO' => $link_self_img,
		'SITE_LOGO_WIDTH' => $site_logo_width,
		'SITE_LOGO_HEIGHT' => $site_logo_height,
		'L_MODERATOR' => $lang['Moderators'], 
		'L_FORUM_LOCKED' => $lang['Forum_is_locked'],
		'L_MARK_FORUMS_READ' => $lang['Mark_all_forums'], 
		//-- mod : categories hierarchy --------------------------------------------------------------------
// here we added
//	$mark
//-- modify
		'U_MARK_READ' => append_sid("index.$phpEx?mark=forums$mark"))
	);
}
//-- mod : announces -------------------------------------------------------------------------------
//-- add
	// categories hierarchy v 2 compliancy
	if (empty($viewcatkey) && ($viewcat > -1))
	{
		$viewcatkey = POST_CAT_URL . $viewcat;
	}
	else
	{
		if (empty($viewcatkey)) $viewcatkey = 'Root';
	}
	announces_from_forums($viewcatkey);
//-- fin mod : announces ---------------------------------------------------------------------------

	//
	// Okay, let's build the index
	//
	//-- mod : categories hierarchy --------------------------------------------------------------------

// don't display the board statistics
if ( ($board_config['display_viewonline'] == 2) || ( ($viewcat < 0) && ($board_config['display_viewonline'] == 1) ) )
{
	$template->assign_block_vars('disable_viewonline', array());
}

// display the index
$display = display_index($viewcatkey);
if ($plus_config['show_links'] == 1)
{
        $template->assign_block_vars('switch_show_links', array());
}
if ($plus_config['show_last_visit'] == 1)
{
        $template->assign_block_vars('switch_show_lastvisit', array());
}
if ( !$display )
//-- fin mod : categories hierarchy ----------------------------------------------------------------
{
	message_die(GENERAL_MESSAGE, $lang['No_forums']);
}

//
// Generate the page
//
$template->pparse('body');

include($phpbb_root_path . 'includes/page_tail.'.$phpEx);

?>
Bästa hälsningar - Mikael Andersson

Välkommen till: http://www.bikersite.se - Träffpunkten för svenska bikers!

Användarvisningsbild
WickeD
Extra aktiv medlem
Extra aktiv medlem
Inlägg: 979
Blev medlem: 2004-11-08 12:17
Ort: Sverige / Umeå
Kontakt:

Inlägg av WickeD » 2006-04-13 17:34

Detta klarar jag inte heller av:

Install säger:

Kod: Markera allt

#-----[ OPEN ]---------------------------------------------
# 
login.php

#
#-----[ FIND ]---------------------------------------------
# 
					$row['user_last_login_try'] >= (time() - ($board_config['login_reset_time'] * 60)) && $row['user_login_tries'] >= $board_config['max_login_attempts'])

#
#-----[ REPLACE WITH ]---------------------------------------------
#
					$row['user_last_login_try'] >= (time() - ($board_config['login_reset_time'] * 60)) && $row['user_login_tries'] >= $board_config['max_login_attempts'] && $userdata['user_level'] != ADMIN)
Detta är min fil:

Kod: Markera allt

<?php
/***************************************************************************
 *                                login.php
 *                            -------------------
 *   begin                : Saturday, Feb 13, 2001
 *   copyright            : (C) 2001 The phpBB Group
 *   email                : support@phpbb.com
 *
 *   $Id: login.php,v 1.47.2.15 2004/03/18 18:15:51 acydburn Exp $
 *
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/

//
// Allow people to reach login page if
// board is shut down
//
define("IN_LOGIN", true);

define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);

//
// Set page ID for session management
//
$userdata = session_pagestart($user_ip, PAGE_LOGIN);
init_userprefs($userdata);
//
// End session management
//

// session id check
if (!empty($HTTP_POST_VARS['sid']) || !empty($HTTP_GET_VARS['sid']))
{
	$sid = (!empty($HTTP_POST_VARS['sid'])) ? $HTTP_POST_VARS['sid'] : $HTTP_GET_VARS['sid'];
}
else
{
	$sid = '';
}
			//
			// CBACK CrackerTracker Visual Login Confirmation
			// visual confirmation code Generator taken from phpBB (c) phpBB Group
			//
			if ( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
			{
				$mode = ( isset($HTTP_GET_VARS['mode']) ) ? $HTTP_GET_VARS['mode'] : $HTTP_POST_VARS['mode'];
				$mode = htmlspecialchars($mode);

				if ( $mode == 'confirm' )
				{
					if ( $userdata['session_logged_in'] )
					{
						exit;
					}
					include($phpbb_root_path . 'ctracker/ct_confirm.'.$phpEx);
					exit;
			    }
			}
			//
			// Now we check if the User is trying to Log in if he already has used one attempt or not
			// if not we disable the Visual Confirmation Code and with this we allow a normal login without any Confirmation
			// if the User tried to log in once we just continue with the normal Script and then we show the Visible Code every time the user
			// tries to log in before checking Password or anything.
			// Well OK its more DB gaming but many users want comfort AND security so let's do it ;-)
			//
			if(!empty($HTTP_POST_VARS['username']) && $ctracker_config['loginfeature'] == 1)
			{
			  $secure_username = '';
			  $secure_username = isset($HTTP_POST_VARS['username']) ? phpbb_clean_username($HTTP_POST_VARS['username']) : '';
			  $sql = "SELECT ct_logintry FROM " . USERS_TABLE . " WHERE username = '" . str_replace("\\'", "''", $secure_username) . "'";
			  if ( !($result = $db->sql_query($sql)) )
			  {
			    message_die(GENERAL_ERROR, 'Error in obtaining userdata', '', __LINE__, __FILE__, $sql);
			  }
			  if( $row = $db->sql_fetchrow($result) )
		      {
			    if($row['ct_logintry'] == 0)
				{
				  $ctracker_config['loginfeature'] = 0;
				}
		      } 
			}
			else
			{
			  $ctracker_config['loginfeature'] = 0;
			}

            if ( $ctracker_config['loginfeature'] == 1 && !$userdata['session_logged_in'] && !empty($HTTP_POST_VARS['confirm_id']) && !empty($HTTP_POST_VARS['confirm_code']))
			{
                    $confirm_id = htmlspecialchars($HTTP_POST_VARS['confirm_id']);					if (!preg_match('/^[A-Za-z0-9]+$/', $confirm_id))
					{
						$confirm_id = '';
					}

					$sql = 'SELECT code
						FROM ' . CTVISKEY . "
						WHERE confirm_id = '$confirm_id'
							AND session_id = '" . $userdata['session_id'] . "'";
					if (!($result = $db->sql_query($sql)))
					{
						message_die(GENERAL_ERROR, 'Could not obtain confirmation code', __LINE__, __FILE__, $sql);
					}

					if ($row = $db->sql_fetchrow($result))
					{
						if ($row['code'] != $HTTP_POST_VARS['confirm_code'])
						{
                            message_die(GENERAL_MESSAGE, $lang['ct_forum_sl1']);
						}
						else
						{
							$sql = 'DELETE FROM ' . CTVISKEY . "
								WHERE confirm_id = '$confirm_id'
									AND session_id = '" . $userdata['session_id'] . "'";
							if (!$db->sql_query($sql))
							{
								message_die(GENERAL_ERROR, 'Could not delete confirmation code', __LINE__, __FILE__, $sql);
							}
						}
					}
					else
					{
                            message_die(GENERAL_MESSAGE, $lang['ct_forum_sl1']);
					}
					$db->sql_freeresult($result);
			}

            $vcheck_need  = FALSE;
            $vcheck_login = TRUE;
            if($ctracker_config['loginfeature'] == 1 )
            {
              $vcheck_need = TRUE;
              $vcheck_login = FALSE;
            }

            if (($vcheck_need = FALSE || $userdata['session_logged_in']) or (isset($HTTP_GET_VARS['logout']) || !empty($HTTP_POST_VARS['confirm_id']) && !empty($HTTP_POST_VARS['confirm_code'])))
		  	{
			  $vcheck_login = TRUE;
		  	}

if(( $vcheck_login == TRUE ) and ( isset($HTTP_POST_VARS['login']) || isset($HTTP_GET_VARS['login']) || isset($HTTP_POST_VARS['logout']) || isset($HTTP_GET_VARS['logout']) ))
{
	if( ( isset($HTTP_POST_VARS['login']) || isset($HTTP_GET_VARS['login']) ) && (!$userdata['session_logged_in'] || isset($HTTP_POST_VARS['admin'])) )
	{
		$username = isset($HTTP_POST_VARS['username']) ? phpbb_clean_username($HTTP_POST_VARS['username']) : '';
		$password = isset($HTTP_POST_VARS['password']) ? $HTTP_POST_VARS['password'] : '';

		$sql = "SELECT user_id, username, user_password, user_active, user_level, user_badlogin, user_blocktime, user_email, user_lang, user_timezone,user_passwd_change
			FROM " . USERS_TABLE . "
			WHERE username = '" . str_replace("\\'", "''", $username) . "'";
		if ( !($result = $db->sql_query($sql)) )
		{
			message_die(GENERAL_ERROR, 'Error in obtaining userdata', '', __LINE__, __FILE__, $sql);
		}

		if( $row = $db->sql_fetchrow($result) )
		{
			if( $row['user_level'] != ADMIN && $board_config['board_disable'] )
			{
				redirect(append_sid("portal.$phpEx", true));
			}
			else
			{
				// Start add - Protect user account MOD
				if ($row['user_blocktime']<time() )
				{
				// End add - Protect user account MOD
				if( md5($password) == $row['user_password'] && $row['user_active'] )
				{
					$autologin = ( isset($HTTP_POST_VARS['autologin']) ) ? TRUE : 0;

					$admin = (isset($HTTP_POST_VARS['admin'])) ? 1 : 0;
					$session_id = session_begin($row['user_id'], $user_ip, PAGE_INDEX, FALSE, $autologin, $admin);
					$db->sql_query('UPDATE ' . USERS_TABLE . ' SET ct_logintry = 0 WHERE user_id = ' . $row['user_id']);

					if( $session_id )
					{
						// Start add - Protect user account MOD
						$sql = "UPDATE " . USERS_TABLE . " SET user_badlogin='0'
							WHERE username = '" . str_replace("\'", "''", $username) . "'";
						if ( !($result = $db->sql_query($sql)) )
						{
							message_die(GENERAL_ERROR, 'Error updating correct login data', '', __LINE__, __FILE__, $sql);
						}
						// End add - Protect user account MOD
						$url = ( !empty($HTTP_POST_VARS['redirect']) ) ? str_replace('&', '&', htmlspecialchars($HTTP_POST_VARS['redirect'])) : "portal.$phpEx";
						// Start add - Protect user account MOD
if ($session_id['user_id']!=ANONYMOUS)
{
include($phpbb_root_path . "includes/functions_validate.$phpEx");
$pass_result = validate_complex_password ($username, $password);
if ( $session_id['user_passwd_change']==0 || $pass_result['error']== true)
{
	//force a change of password, do not allow a secound login
	$sql = "UPDATE " . USERS_TABLE . " SET user_passwd_change='-9999'
	WHERE user_id = '" . $session_id['user_id'] . "'";
	if ( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, 'Error updating correct login data2', '', __LINE__, __FILE__, $sql);
	}
	$url .= ( ereg( "\?" , $url) ) ? '&ch_passwd=1' : '?ch_passwd=1';
} else
if (  intval((time()-$session_id['user_passwd_change']) / 86400) >= $board_config['max_password_age'])
{
	session_end($session_id['session_id'], $session_id['user_id']);
	$message = $lang['Passwd_have_expired'] . '<br /><br /><a href="'.append_sid("profile.$phpEx?mode=sendpassword").'">'.$lang['Send_new_passwd'].'</a><br /><br />' .  sprintf($lang['Click_return_portal'], '<a href="' . append_sid("portal.$phpEx") . '">', '</a>');
	message_die(GENERAL_MESSAGE, $message);
} else
if (  intval((time()-$session_id['user_passwd_change']) / 86400)+(($board_config['max_password_age']<14) ? 1 : 14) >= $board_config['max_password_age'] )
{
	$url .= ( ereg( "\?" , $url) ) ? '&ch_passwd=1' : '?ch_passwd=1';
}
}
// End add - Protect user account MOD
						redirect(append_sid($url, true));
					}
					else
					{
						message_die(CRITICAL_ERROR, "Couldn't start session : login", "", __LINE__, __FILE__);
					}
				}
				// Only store a failed login attempt for an active user - inactive users can't login even with a correct password
				elseif( $row['user_active'] )
				{
					if ($row['user_id'] != ANONYMOUS)
					{
						$sql = 'UPDATE ' . USERS_TABLE . '
							SET ct_logintry = 1
							WHERE user_id = ' . $row['user_id'];
						$db->sql_query($sql);
					}
					$redirect = ( !empty($HTTP_POST_VARS['redirect']) ) ? str_replace('&', '&', htmlspecialchars($HTTP_POST_VARS['redirect'])) : '';
					$redirect = str_replace('?', '&', $redirect);
					
					if (strstr(urldecode($redirect), "\n") || strstr(urldecode($redirect), "\r"))
					{
						message_die(GENERAL_ERROR, 'Tried to redirect to potentially insecure url.');
					}
					
					$template->assign_vars(array(
						'META' => "<meta http-equiv=\"refresh\" content=\"3;url=login.$phpEx?redirect=$redirect\">")
					);
					// Start add - Protect user account MOD
if ($row['user_active'] )
{
	//count bad login
	// block the user for X min
	if (($row['user_badlogin']+1) % $board_config['max_login_error'])
	{
		$sql = "UPDATE " . USERS_TABLE . " SET user_badlogin=user_badlogin+1
			WHERE username = '" . str_replace("\'", "''", $username) . "'";
		if ( !($result = $db->sql_query($sql)) )
		{
			message_die(GENERAL_ERROR, 'Error updating bad login data'.$user_ip, '', __LINE__, __FILE__, $sql);
		}
	} else
	{
		$blocktime = ", user_block_by='$user_ip', user_blocktime='" . (time()+($board_config['block_time']*60)) . "'";
		$sql = "UPDATE " . USERS_TABLE . " SET user_badlogin=user_badlogin+1 $blocktime
			WHERE username = '" . str_replace("\'", "''", $username) . "'";
		if ( !($result = $db->sql_query($sql)) )
		{
			message_die(GENERAL_ERROR, 'Error updating bad login data'.$user_ip, '', __LINE__, __FILE__, $sql);
		}

		if ($row['user_email']  && $row['user_blocktime']<(time()-3600))
		{
		      include($phpbb_root_path . 'includes/emailer.'.$phpEx); 
			$server_name = trim($board_config['server_name']);
     	      	$emailer = new emailer($board_config['smtp_delivery']); 
     	       	$emailer->email_address($row['user_email']); 
     	        $email_headers = "To: \"".$row['username']."\" <".$row['user_email']. ">\r\n"; 
     	       	$email_headers .= "From: \"".$board_config['sitename']."\" <".$board_config['board_email'].">\r\n"; 
     	      	$email_headers .= "X-AntiAbuse: Board servername - " . $server_name . "\r\n"; 
     	      	$email_headers .= "X-AntiAbuse: User IP - " . decode_ip($user_ip) . "\r\n"; 
		$emailer->use_template('bad_login', $row['user_lang']);
     	       	$emailer->extra_headers($email_headers); 
     		      $emailer->assign_vars(array( 
     		      	'USER' => '"'.$row['username'].'"',
				'BLOCK_TIME' => $board_config['block_time'],
           			'BAD_LOGINS' => $row['user_badlogin']+1, 
				'BLOCK_UNTIL' => create_date ($lang['Time_format'],time()+($board_config['block_time']*60),$row['user_timezone']),
           			'SITENAME' => $board_config['sitename'], 
     	     			'BOARD_EMAIL' => $board_config['board_email'])); 
       	    	$emailer->send(); 
       	    	$emailer->reset(); 
		}
	}
}
// End add - Protect user account MOD

					$message = $lang['Error_login'] . '<br /><br />' . sprintf($lang['Click_return_login'], "<a href=\"login.$phpEx?redirect=$redirect\">", '</a>') . '<br /><br />' .  sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');

					message_die(GENERAL_MESSAGE, $message);
				}
				// Start add - Protect user account MOD
} else
{
	$message = (($lang['Error_login_tomutch'])?$lang['Error_login_tomutch']:$lang['Error_login']) . '<br /><br />' . sprintf($lang['Click_return_login'], '<a href="' . append_sid("login.$phpEx?redirect=$redirect") . '">', '</a>') . '<br /><br />' .  sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
	message_die(GENERAL_MESSAGE, $message);
}
// End add - Protect user account MOD

			}
		}
		else
		{
			$redirect = ( !empty($HTTP_POST_VARS['redirect']) ) ? str_replace('&', '&', htmlspecialchars($HTTP_POST_VARS['redirect'])) : "";
			$redirect = str_replace("?", "&", $redirect);
			
			if (strstr(urldecode($redirect), "\n") || strstr(urldecode($redirect), "\r"))
			{
				message_die(GENERAL_ERROR, 'Tried to redirect to potentially insecure url.');
			}
			
			$template->assign_vars(array(
				'META' => "<meta http-equiv=\"refresh\" content=\"3;url=login.$phpEx?redirect=$redirect\">")
			);

			$message = $lang['Error_login'] . '<br /><br />' . sprintf($lang['Click_return_login'], "<a href=\"login.$phpEx?redirect=$redirect\">", '</a>') . '<br /><br />' .  sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');

			message_die(GENERAL_MESSAGE, $message);
		}
	}
	else if( ( isset($HTTP_GET_VARS['logout']) || isset($HTTP_POST_VARS['logout']) ) && $userdata['session_logged_in'] )
	{
      // session id check 
      if ($sid == '' || $sid != $userdata['session_id']) 
      { 
         message_die(GENERAL_ERROR, 'Invalid_session'); 
      } 
		if( $userdata['session_logged_in'] )
		{
			session_end($userdata['session_id'], $userdata['user_id']);
		}

		if (!empty($HTTP_POST_VARS['redirect']) || !empty($HTTP_GET_VARS['redirect']))
		{
			$url = (!empty($HTTP_POST_VARS['redirect'])) ? htmlspecialchars($HTTP_POST_VARS['redirect']) : htmlspecialchars($HTTP_GET_VARS['redirect']);
			$url = str_replace('&', '&', $url);
			redirect(append_sid($url, true));
		}
		else
		{
			redirect(append_sid("portal.$phpEx", true));
		}
	}
	else
	{
		$url = ( !empty($HTTP_POST_VARS['redirect']) ) ? str_replace('&', '&', htmlspecialchars($HTTP_POST_VARS['redirect'])) : "portal.$phpEx";
		// Start add - Protect user account MOD
if ($session_id['user_id']!=ANONYMOUS)
{
include($phpbb_root_path . "includes/functions_validate.$phpEx");
$pass_result = validate_complex_password ($username, $password);
if ( $session_id['user_passwd_change']==0 || $pass_result['error']== true)
{
	//force a change of password, do not allow a secound login
	$sql = "UPDATE " . USERS_TABLE . " SET user_passwd_change='-9999'
	WHERE user_id = '" . $session_id['user_id'] . "'";
	if ( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, 'Error updating correct login data2', '', __LINE__, __FILE__, $sql);
	}
	$url .= ( ereg( "\?" , $url) ) ? '&ch_passwd=1' : '?ch_passwd=1';
} else
if (  intval((time()-$session_id['user_passwd_change']) / 86400) >= $board_config['max_password_age'])
{
	session_end($session_id['session_id'], $session_id['user_id']);
	$message = $lang['Passwd_have_expired'] . '<br /><br /><a href="'.append_sid("profile.$phpEx?mode=sendpassword").'">'.$lang['Send_new_passwd'].'</a><br /><br />' .  sprintf($lang['Click_return_portal'], '<a href="' . append_sid("portal.$phpEx") . '">', '</a>');
	message_die(GENERAL_MESSAGE, $message);
} else
if (  intval((time()-$session_id['user_passwd_change']) / 86400)+(($board_config['max_password_age']<14) ? 1 : 14) >= $board_config['max_password_age'] )
{
	$url .= ( ereg( "\?" , $url) ) ? '&ch_passwd=1' : '?ch_passwd=1';
}
}
// End add - Protect user account MOD
		redirect(append_sid($url, true));
	}
}
else
{
	//
	// Do a full login page dohickey if
	// user not already logged in
	//
	if( !$userdata['session_logged_in'] || (isset($HTTP_GET_VARS['admin']) && $userdata['session_logged_in'] && $userdata['user_level'] == ADMIN))
	{
		$page_title = $lang['Login'];
		include($phpbb_root_path . 'includes/page_header.'.$phpEx);

		$template->set_filenames(array(
			'body' => 'login_body.tpl')
		);

      $forward_page = '';
    //
    // CBACK CrackerTracker Login Confirmation
    // Confirmation Generator Taken from phpBB (C) phpBB Group
    //
    $confirm_image = '';
    if( $ctracker_config['loginfeature'] == 1 && !$userdata['session_logged_in'])
    {
	    $sql = 'SELECT session_id
		    FROM ' . SESSIONS_TABLE;
	    if (!($result = $db->sql_query($sql)))
	    {
			message_die(GENERAL_ERROR, 'Could not select session data', '', __LINE__, __FILE__, $sql);
		}

		if ($row = $db->sql_fetchrow($result))
		{
			$confirm_sql = '';
			do
			{
				$confirm_sql .= (($confirm_sql != '') ? ', ' : '') . "'" . $row['session_id'] . "'";
			}
			while ($row = $db->sql_fetchrow($result));

			$sql = 'DELETE FROM ' .  CTVISKEY . "
				WHERE session_id NOT IN ($confirm_sql)";
			if (!$db->sql_query($sql))
			{
				message_die(GENERAL_ERROR, 'Could not delete stale confirm data', '', __LINE__, __FILE__, $sql);
			}
		}
		$db->sql_freeresult($result);

		$confirm_chars = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',  'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',  'U', 'V', 'W', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9');

		list($usec, $sec) = explode(' ', microtime());
		mt_srand($sec * $usec);

		$max_chars = count($confirm_chars) - 1;
		$code = '';
		for ($i = 0; $i < 6; $i++)
		{
			$code .= $confirm_chars[mt_rand(0, $max_chars)];
		}

		$confirm_id = md5(uniqid($user_ip));

		$sql = 'INSERT INTO ' . CTVISKEY . " (confirm_id, session_id, code)
			VALUES ('$confirm_id', '". $userdata['session_id'] . "', '$code')";
		if (!$db->sql_query($sql))
		{
			message_die(GENERAL_ERROR, 'Could not insert new confirm code information', '', __LINE__, __FILE__, $sql);
		}

		unset($code);

		$confirm_image = (@extension_loaded('zlib')) ? '<img src="' . append_sid("login.$phpEx?mode=confirm&id=$confirm_id") . '" alt="" title="" />' : '<img src="' . append_sid("login.$phpEx?mode=confirm&id=$confirm_id&c=1") . '" alt="" title="" /><img src="' . append_sid("login.$phpEx?mode=confirm&id=$confirm_id&c=2") . '" alt="" title="" /><img src="' . append_sid("login.$phpEx?mode=confirm&id=$confirm_id&c=3") . '" alt="" title="" /><img src="' . append_sid("login.$phpEx?mode=confirm&id=$confirm_id&c=4") . '" alt="" title="" /><img src="' . append_sid("login.$phpEx?mode=confirm&id=$confirm_id&c=5") . '" alt="" title="" /><img src="' . append_sid("login.$phpEx?mode=confirm&id=$confirm_id&c=6") . '" alt="" title="" />';
		$hidden_form_fields .= '<input type="hidden" name="confirm_id" value="' . $confirm_id . '" />';

		$template->assign_block_vars('switch_confirm', array());
	}
		if( isset($HTTP_POST_VARS['redirect']) || isset($HTTP_GET_VARS['redirect']) )
		{
			$forward_to = $HTTP_SERVER_VARS['QUERY_STRING'];

			if( preg_match("/^redirect=([a-z0-9\.#\/\?&=\+\-_]+)/si", $forward_to, $forward_matches) )
			{
				$forward_to = ( !empty($forward_matches[3]) ) ? $forward_matches[3] : $forward_matches[1];
				$forward_match = explode('&', $forward_to);

				if(count($forward_match) > 1)
				{

					for($i = 1; $i < count($forward_match); $i++)
					{
						if( !ereg("sid=", $forward_match[$i]) )
						{
							if( $forward_page != '' )
							{
								$forward_page .= '&';
							}
							$forward_page .= $forward_match[$i];
						}
					}
					$forward_page = $forward_match[0] . '?' . $forward_page;
				}
				else
				{
					$forward_page = $forward_match[0];
				}
			}
		}

		$username = ( $userdata['user_id'] != ANONYMOUS ) ? $userdata['username'] : '';

		$s_hidden_fields = '<input type="hidden" name="redirect" value="' . $forward_page . '" />';

		$s_hidden_fields .= (isset($HTTP_GET_VARS['admin'])) ? '<input type="hidden" name="admin" value="1" />' : '';

      make_jumpbox('viewforum.'.$phpEx);
		$template->assign_vars(array(
			'USERNAME' => $username,

			'L_ENTER_PASSWORD' => (isset($HTTP_GET_VARS['admin'])) ? $lang['Admin_reauthenticate'] : $lang['Enter_password'],
			'L_SEND_PASSWORD' => $lang['Forgotten_password'],
			'CONFIRM_IMG' => $confirm_image,
			'L_CONFIRM_CODE' => $lang['ct_forum_slo'],

			'U_SEND_PASSWORD' => append_sid("profile.$phpEx?mode=sendpassword"),

			'S_HIDDEN_FIELDS' => $s_hidden_fields . $hidden_form_fields)
		);

		$template->pparse('body');

		include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
	}
	else
	{
		redirect(append_sid("portal.$phpEx", true));
	}

}

?>
Bästa hälsningar - Mikael Andersson

Välkommen till: http://www.bikersite.se - Träffpunkten för svenska bikers!

Användarvisningsbild
WickeD
Extra aktiv medlem
Extra aktiv medlem
Inlägg: 979
Blev medlem: 2004-11-08 12:17
Ort: Sverige / Umeå
Kontakt:

Inlägg av WickeD » 2006-04-13 17:49

Du får ursäkta Holger att jag postade så många inlägg, men jag har gjort alla andra ändringar i alla andra filer.

Så det är detta som fattas.

Jag uppskattar verkligen om du har tid att hjälpa mig.

//Micke
Bästa hälsningar - Mikael Andersson

Välkommen till: http://www.bikersite.se - Träffpunkten för svenska bikers!

dallas
Extra aktiv medlem
Extra aktiv medlem
Inlägg: 196
Blev medlem: 2005-09-03 22:07
Ort: Stenungsund

Inlägg av dallas » 2006-04-14 10:14

Hej.

Kollade lite på mina filer....
vet att du kör någon variant (Plus) som inte jag har men
jag hittade allt det du inte hittar i mina filer.

includes/usercp_confirm.php
den filen har jag

Några ställen som du letar efter är uppdateringar som gjordes i 2.0.19

denna ingår där:

Kod: Markera allt

#-----[ OPEN ]--------------------------------------------- 
# 
login.php 

# 
#-----[ FIND ]--------------------------------------------- 
# 
               $row['user_last_login_try'] >= (time() - ($board_config['login_reset_time'] * 60)) && $row['user_login_tries'] >= $board_config['max_login_attempts'])
så här såg hela uppdateringen ut:

Kod: Markera allt

////// 2.0.19
				// If the last login is more than x minutes ago, then reset the login tries/time
				if ($row['user_last_login_try'] && $board_config['login_reset_time'] && $row['user_last_login_try'] < (time() - ($board_config['login_reset_time'] * 60)))
				{
					$db->sql_query('UPDATE ' . USERS_TABLE . ' SET user_login_tries = 0, user_last_login_try = 0 WHERE user_id = ' . $row['user_id']);
					$row['user_last_login_try'] = $row['user_login_tries'] = 0;
				}
				
				// Check to see if user is allowed to login again... if his tries are exceeded
				if ($row['user_last_login_try'] && $board_config['login_reset_time'] && $board_config['max_login_attempts'] && 
					$row['user_last_login_try'] >= (time() - ($board_config['login_reset_time'] * 60)) && $row['user_login_tries'] >= $board_config['max_login_attempts'])
				{
					message_die(GENERAL_MESSAGE, sprintf($lang['Login_attempts_exceeded'], $board_config['max_login_attempts'], $board_config['login_reset_time']));
				}
				//////

includes/usercp_register.php

Kod: Markera allt

# 
#-----[ FIND ]----------------------------------------------- 
# Line 300 
            // Only compare one char if the zlib-extension is not loaded 
            if (!@extension_loaded('zlib')) 
            { 
               $row['code'] = substr($row['code'], -1); 
            }
detta är också en 2.0.19 uppdatering

Kod: Markera allt

/// 2.0.19
				// Only compare one char if the zlib-extension is not loaded
				if (!@extension_loaded('zlib'))
				{
					$row['code'] = substr($row['code'], -1);
				}
				///
som sagt allt det du FIND letar, hittar jag
men jag har inte hunnit göra uppdateringen till 2.0.20 ännu
så jag får väl se själv hur det går så småningom

dallas

Skriv svar

Vilka är online

Användare som besöker denna kategori: 1 och 0 gäst