FE User and User/Group Rights-Management Development

Discuss phpwcms here, please do not post support requests, bug reports, or feature requests! Non-phpwcms questions, discussion goes in General Chat!
nebenaube
Posts: 139
Joined: Fri 23. Nov 2007, 20:39
Location: Redlands, CA
Contact:

Re: FE User and User/Group Rights-Management Development

Post by nebenaube »

english bitte... or is this just the beginning of the Jensensen treatment? I wasn't coding for the general solution just towards it.
nebenaube
Posts: 139
Joined: Fri 23. Nov 2007, 20:39
Location: Redlands, CA
Contact:

Re: FE User and User/Group Rights-Management Development

Post by nebenaube »

claus wrote:HimmelArschNZwirn - das funktioniert wie's Katzenmachen!
He, Oliver, jetzt bist Du dran mit dem ganzen restlichen fundable-Kram! Lass' Dich nicht lumpen.... gib's einfach her! :lol:

babelfish.yahoo.com says:
HimmelArschNZwirn - wie' functions; s cat making! He, olive, now are you to with the whole remaining fundable stuff! Leaving; You not rags…. gib' s simply ago!
It seems offensive. You know, it's not like I have access to any design documents...
rushclub
Posts: 915
Joined: Tue 17. Feb 2004, 18:52

Re: FE User and User/Group Rights-Management Development

Post by rushclub »

HimmelArschNZwirn
something like heureka ;)

rush
3 (!) Jahre warten reichen mir. Ich bin erst mal weg.
User avatar
update
Moderator
Posts: 6455
Joined: Mon 10. Jan 2005, 17:29
Location: germany / outdoor

Re: FE User and User/Group Rights-Management Development

Post by update »

okay okay - here is my own babelfish - you've asked for, now you'll get it :lol:
HeavenAssAndThreads - this is working like hell!
Hey, Oliver, now it's your turn (again) to deliver the remaining pieces and features left over from fundable action. Now splash out... simply pass it over
nebenaube wrote:It seems offensive
If truth's main objective is offensiveness - yes, then you are right ;)

BTW: I cannot see the users in the backend and they don't get any newsletter either (only test letters. I'm certainly missing something...
It's mostly all about maintaining two or three customer's sites Still supporter for the band Mykket Morton. Visit Mykket Morton on FB. Listen Mykket Morton and live videos on youtube.
Now building a venue for young artists to get wet on stage, rehearsal rooms, a studio, a guitar shop - yes I'm going to build some guitars.
nebenaube
Posts: 139
Joined: Fri 23. Nov 2007, 20:39
Location: Redlands, CA
Contact:

Re: FE User and User/Group Rights-Management Development

Post by nebenaube »

I can't see any fe users in the back end either, but they can log in. I haven't investigated that yet... Like I said, I'm working on it. It just figures that I'd get a week or so into tweaking it to work for me and the real deal would probably appear!

also, on my windows workstation (localhost) my backend users can't authenticate through the felogin content part, but they can when tested on my reasonably uptodate freebsd server.
nebenaube
Posts: 139
Joined: Fri 23. Nov 2007, 20:39
Location: Redlands, CA
Contact:

Re: FE User and User/Group Rights-Management Development

Post by nebenaube »

hm... maybe this part?

Code: Select all

      //TODO: Fix after testing
            $TestEmailAddress = "yours@whereever.whatever";   
            // send email to user that just registered
nebenaube
Posts: 139
Joined: Fri 23. Nov 2007, 20:39
Location: Redlands, CA
Contact:

Re: FE User and User/Group Rights-Management Development

Post by nebenaube »

hmm... I take it that the update is not in r272 then? Can anyone confirm if it is there or not yet?
User avatar
juergen
Moderator
Posts: 4556
Joined: Mon 10. Jan 2005, 18:10
Location: Weinheim
Contact:

Re: FE User and User/Group Rights-Management Development

Post by juergen »

Ha ?

What is the relation of Frontend User Registration to Backend Users ? Rights ? Groups ? Nothing ! So anyone please correct me if I am wrong !
nebenaube
Posts: 139
Joined: Fri 23. Nov 2007, 20:39
Location: Redlands, CA
Contact:

Re: FE User and User/Group Rights-Management Development

Post by nebenaube »

no this just works for the frontend users that register from the front end and there is no management oh, you're talking about r272... ok... my bad. I'm working on the management function in the back end now... Remember this is my branch that I'm working on. FE User and User/Group Rights-Management Development is a broad umbrella that includes front end registration and it doesn't work straight out of the box yet. {edited for grammer}
Last edited by nebenaube on Tue 11. Nov 2008, 18:25, edited 1 time in total.
User avatar
Jensensen
Posts: 3000
Joined: Tue 17. Oct 2006, 21:11
Location: auf der mlauer

Re: FE User and User/Group Rights-Management Development

Post by Jensensen »

nebenaube wrote:...doesn't work straight out of the box yet..
:mrgreen: :lol: :mrgreen:
{so_much} | Knick-Knack. | GitHub
Umlaute im URL sind meistens immer Kacke.
nebenaube
Posts: 139
Joined: Fri 23. Nov 2007, 20:39
Location: Redlands, CA
Contact:

Re: FE User and User/Group Rights-Management Development

Post by nebenaube »

hmmm... this happens next:

if you strip out the variables/columns I'm using to add MaxMind's geoip data to both phpwcms_user and phpwcms_userdetail you'll find that you can register in the front end and see (as admin) the new front end user in the back end.

phpwcms_user is the account aspect
phpwcms_user detail is the personal info
both tables constitute the profile
I have no clue how groups are envisioned to work yet, either someone will enlighten me or I'll cross that bridge when I get there.

How much of this works from where it's at is anybody's guess but since we are all waiting on this and no one seems to want to code it here goes... If you have any clue about coding and how this system works, then the changes you need to run without incorporating geoip should not be difficult.

[on edit] this is my next version of fe_user.php

Code: Select all

<?php
/*************************************************************************************
   Copyright notice
   
   (c) 2002-2008 Oliver Georgi (oliver@phpwcms.de) // All rights reserved.
 
   This script is part of PHPWCMS. The PHPWCMS web content management system 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.
  
   The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html
   A copy is found in the textfile GPL.txt and important notices to the license 
   from the author is found in LICENSE.txt distributed with these scripts.
  
   This script is distributed in the hope that it will be useful, but WITHOUT ANY 
   WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
   PARTICULAR PURPOSE.  See the GNU General Public License for more details.
 
   This copyright notice MUST APPEAR in all copies of the script!
*************************************************************************************/

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// fe_user.php modification for generic front end user registration without an elaborate signup survey.
// note: example code for a survey (Oliver's original) is retained in comments.
//
// this file lives on the web server path domain_name/template/nc_script/frontend_render/fe_user.php
//
// the main modifications consisted of disabling non-generic components of the registration survey form
// and changes to support multiple languages.
//
// Added a Check to configure what language we're using -- There must be a built-in fuction for this but I haven't looked for it.
// Added a include to get the language file we're using
//
//TODO: switch for language...
// currently I'm doing this which supports my purposes
//	switch($language){
//		case 'de': $user_title = array('Herr', 'Frau', ''); break;
//		case 'en': $user_title = array('Mr',   'Mrs', ''); break;
//		case 'tr': $user_title = array('Herr', 'Frau', ''); break;
//		  default: $user_title = array('Mr',   'Mrs', ''); break;
//	}
// when it should be incorporated into the language file.

//the following database alterations are required
//ALTER TABLE `phpwcms_userdetail` ADD `detail_ip` VARCHAR( 255 ) NOT NULL   AFTER `userdetail_lastlogin`;
//ALTER TABLE `phpwcms_userdetail` ADD `detail_lat` VARCHAR( 255 ) NOT NULL  AFTER `detail_ip`;
//ALTER TABLE `phpwcms_userdetail` ADD `detail_long` VARCHAR( 255 ) NOT NULL AFTER `detail_lat`;
//ALTER TABLE `phpwcms_userdetail` ADD `detail_ywc` VARCHAR( 255 ) NOT NULL  AFTER `detail_long`;
//ALTER TABLE `phpwcms_userdetail` ADD `detail_dma` VARCHAR( 255 ) NOT NULL  AFTER `detail_ywc`;
//ALTER TABLE `phpwcms_userdetail` ADD `detail_area_code` VARCHAR( 255 ) NOT NULL AFTER `detail_dma`;




//Check to see what language we're using
if ($phpwcms['default_lang']=='de'){
 $language="de";
}else {
 if ($phpwcms['default_lang']=='en'){
   $language="en";
 }else{
   if ($phpwcms['default_lang']=='tr'){
	 $language="tr";
   }else{   
     $language="en";
   }
 }	
}

// get the language file we're using
include( PHPWCMS_ROOT."/include/inc_lang/backend/".$language."/lang.inc.php");



// first check what to do
if(_getFeUserLoginStatus() && strpos($content['all'], '{FE_USER_MANAGE}')) {

	$fe_action = '{FE_USER_MANAGE}';
	if( $_SESSION[ $_loginData['session_key'].'_userdata']['source'] == 'BACKEND' ) {
		$fe_action = false;
	}

}else{
	
	if(strpos($content['all'], '{FE_USER_REGISTER}')) {
		$fe_action = '{FE_USER_REGISTER}';
    }else{
		$fe_action = false;
	}
}

// fe user register
if($fe_action) {

	$udata = array(
						'user_login'		=> '',
						'user_password'		=> '',
						
						'user_company'		=> '',
						'user_title'		=> '',
						'user_name'			=> '',
						'user_firstname'	=> '',
						'user_street'		=> '',
						'user_zip'			=> '',
						'user_city'			=> '',
						'user_tel'			=> '',
						'user_email'		=> '',
						
						'user_ip'			=> '',
						'user_lat'			=> '',
						'user_long'			=> '',
						'user_ywc'			=> '',
						'user_dma'			=> '',
						'user_area_code'	=> '',
						
						'user_profile_1'	=> '', 
						'user_profile_2'	=> '', 
						'user_profile_3'	=> '',
						'user_profile_4'	=> '',
						'user_profile_5'	=> '',
						'user_profile_6'	=> '',
						'user_profile_7'	=> array(4=>1),
						'user_profile_8'	=> '',
						'user_profile_9'	=> '',
						'user_profile_10'	=> '',
						'user_profile_11'	=> '',
						'user_profile_12'	=> '',
						'user_profile_13'	=> '',
						'user_profile_14'	=> '',
					);		

	switch($fe_action) {
	
		case '{FE_USER_MANAGE}':	$_uri = 'index.php'.returnGlobalGET_QueryString('htmlentities', array('profile_manage'=>'edit'), array('profile_register', 'rofile_reminder') );
									
									// at the moment it is only possible to edit user data of "real" FRONTEND users
									// BACKEND users should login to backend and edit their data there

									$sql  = 'SELECT * FROM '.DB_PREPEND.'phpwcms_userdetail WHERE ';
									$sql .= 'detail_id=' . intval($_SESSION[ $_loginData['session_key'].'_userdata']['id']).' LIMIT 1';
									$result = _dbQuery($sql);
									if(isset($result[0])) {
										$udata = unserialize($result[0]['detail_notes']);
									}
									$udata['user_password'] = '';
									
									break;
									
		case '{FE_USER_REGISTER}':	$_uri = 'index.php'.returnGlobalGET_QueryString('htmlentities', array('profile_register'=>'create'), array('profile_manage', 'profile_reminder') );
		

									break;
	
	}

	
	$uerror = array(
	
		'status'			=> false,
	
		'user_login'		=> '',
		'user_password'		=> '',
		'user_company'		=> '',
		'user_title'		=> '',
		'user_name'			=> '',
		'user_firstname'	=> '',
		'user_street'		=> '',
		'user_zip'			=> '',
		'user_city'			=> '',
		'user_tel'			=> '',
		'user_email'		=> '',
		'user_ip'			=> '',
		'user_lat'			=> '',
		'user_long'			=> '',
		'user_ywc'			=> '',
		'user_dma'			=> '',
		'user_area_code'	=> '',
		'user_profile_1'	=> '', 
		'user_profile_2'	=> '',
		'user_profile_3'	=> '',
		'user_profile_4'	=> '',
		'user_profile_5'	=> '',
		'user_profile_6'	=> '',
		'user_profile_7'	=> '',
		'user_profile_8'	=> '',
		'user_profile_9'	=> '',
		'user_profile_10'	=> '',
		'user_profile_11'	=> '',
		'user_profile_12'	=> '',
		'user_profile_13'	=> '',
		'user_profile_14'	=> '',
	
	);

	//TODO: recode for better switch on language...
	switch($language){
		case 'de': $user_title = array('Herr', 'Frau', ''); break;
		case 'en': $user_title = array('Mr',   'Mrs', ''); break;
		case 'tr': $user_title = array('Herr', 'Frau', ''); break;
		  default: $user_title = array('Mr',   'Mrs', ''); break;
	}

	if(isset($_POST['user_login'])) {
	
		$fe_csv = array();
		
		$udata['user_login']		= clean_slweg($_POST['user_login']);
		$udata['user_password']		= slweg($_POST['user_password']);
		$udata['user_password2']	= slweg($_POST['user_password2']);
			
		$udata['user_company']		= clean_slweg($_POST['user_company']);
		$udata['user_title']		= clean_slweg($_POST['user_title']);
		$udata['user_name']			= clean_slweg($_POST['user_name']);
		$udata['user_firstname']	= clean_slweg($_POST['user_firstname']);
		$udata['user_street']		= clean_slweg($_POST['user_street']);
		$udata['user_zip']			= clean_slweg($_POST['user_zip']);
		$udata['user_city']			= clean_slweg($_POST['user_city']);
		$udata['user_tel']			= preg_replace('/[^0-9\+\-\(\) ]/', '', clean_slweg($_POST['user_tel']) );
		$udata['user_email']		= clean_slweg($_POST['user_email']);

		$fe_csv['login'] 		= $udata['user_login'];
		$fe_csv['company'] 		= $udata['user_company'];
		$fe_csv['title'] 		= $udata['user_title'];
		$fe_csv['name'] 		= $udata['user_name'];
		$fe_csv['firstname']	= $udata['user_firstname'];
		$fe_csv['street'] 		= $udata['user_street'];
		$fe_csv['zip'] 			= $udata['user_zip'];
		$fe_csv['city'] 		= $udata['user_city'];
		$fe_csv['tel'] 			= $udata['user_tel'];
		$fe_csv['email'] 		= $udata['user_email'];
		
		if($fe_action == '{FE_USER_REGISTER}') {
		
			
			$udata['user_profile_1']	= isset($_POST['user_profile_1']) ? intval($_POST['user_profile_1']) : '';
			$udata['user_profile_2']	= isset($_POST['user_profile_2']) ? clean_slweg($_POST['user_profile_2']) : '';
			
			$udata['user_profile_5']	= isset($_POST['user_profile_5']) ? intval($_POST['user_profile_5']) : '';
			$udata['user_profile_6']	= clean_slweg($_POST['user_profile_6']);
			$udata['user_profile_8']	= clean_slweg($_POST['user_profile_8']);
			$udata['user_profile_9']	= isset($_POST['user_profile_9']) ? clean_slweg($_POST['user_profile_9']) : '';
			$udata['user_profile_10']	= clean_slweg($_POST['user_profile_10']);
			$udata['user_profile_11']	= isset($_POST['user_profile_11']) ? clean_slweg($_POST['user_profile_11']) : '';
			
			$udata['user_profile_13']	= isset($_POST['user_profile_13']) ? clean_slweg($_POST['user_profile_13']) : '';
			$udata['user_profile_14']	= clean_slweg($_POST['user_profile_14']);
		
		
		
			$sql  = 'SELECT COUNT(*) FROM '.DB_PREPEND."phpwcms_userdetail WHERE ";
			$sql .= "detail_login LIKE '" . aporeplace($udata['user_login'])."'";
		
			if( empty($udata['user_login']) ) {
				$uerror['user_login'] = $BL['user_login_empty'];
			} elseif( strlen($udata['user_login']) < 4 ) {
				$uerror['user_login'] = $BL['user_login_len'];
			} elseif( _dbCount( $sql )	) {
				$uerror['user_login'] = $BL['user_login_assigned'];
			}
			
			if( empty($udata['user_password']) ) {
				$uerror['user_password'] = $BL['user_password_empty'];
			} elseif( strlen($udata['user_password']) < 4 ) {
				$uerror['user_password'] = $BL['user_password_len'];
			} elseif( $udata['user_password'] !== $udata['user_password2'] ) {
				$uerror['user_password'] = $BL['user_password_nomatch'];
			}
			
			
			if(isset($_POST['user_profile_3']) && is_array($_POST['user_profile_3'])) {
				foreach($_POST['user_profile_3'] as $key => $value) {
					$udata['user_profile_3'][$key] = clean_slweg($value);
				}
			}
			
			if(isset($_POST['user_profile_4']) && is_array($_POST['user_profile_4'])) {
				foreach($_POST['user_profile_4'] as $key => $value) {
					$udata['user_profile_4'][$key] = clean_slweg($value);
				}
			}
			
			if(isset($_POST['user_profile_7']) && is_array($_POST['user_profile_7'])) {
				foreach($_POST['user_profile_7'] as $key => $value) {
					$udata['user_profile_7'][$key] = intval($value);
				}
			}
			
			if(isset($_POST['user_profile_12']) && is_array($_POST['user_profile_12'])) {
				foreach($_POST['user_profile_12'] as $key => $value) {
					$udata['user_profile_12'][$key] = clean_slweg($value);
				}
			}
			
					
			
		} else {
		
			$udata['user_login'] = $_SESSION[ $_loginData['session_key'].'_userdata']['login'];

			if( !empty($udata['user_password']) && strlen($udata['user_password']) < 4 ) {
				$uerror['user_password'] = $BL['user_password_len'];
			} elseif( $udata['user_password'] !== $udata['user_password2'] ) {
				$uerror['user_password'] = $BL['user_password_nomatch'];
			}
			
			$udata['user_profile_7'][3] = empty($_POST['user_profile_7'][3]) ? 0 : 1;
					
		}
		
		$sql  = 'SELECT COUNT(*) FROM '.DB_PREPEND."phpwcms_userdetail WHERE ";
		$sql .= "detail_login != '" . aporeplace($udata['user_login']) . "' AND ";
		$sql .= "detail_email = '" . aporeplace(strtolower($udata['user_email']))."'";
		
		if( empty($udata['user_email']) ) {
			$uerror['user_email'] = $BL['user_email_empty'];
		} elseif( !is_valid_email($udata['user_email']) ) {
			$uerror['user_email'] = $BL['user_email_invalid'];
		} elseif( _dbCount( $sql )	) {
			$uerror['user_email'] = $BL['user_email_registered'];
		}
		
		if( empty($udata['user_tel']) ) {
			//$uerror['user_tel'] = $BL['user_tel_empty'];
		} elseif( preg_match('/[^0-9\+\-\(\) ]/', $udata['user_tel']) ) {
			$uerror['user_tel'] = $BL['user_tel_invalid'];
		}
		
		if( empty($udata['user_name']) ) {
			$uerror['user_name'] = $BL['user_name_empty'];
		}
		
		if( empty($udata['user_firstname']) ) {
			$uerror['user_firstname'] = $BL['user_firstname_empty'];
		}
		if( empty($udata['user_company']) ) {
			$uerror['user_company'] = $BL['user_company_empty'];
		}
		if( empty($udata['user_street']) ) {
			$uerror['user_street'] = $BL['user_street_empty'];
		}
		if( empty($udata['user_zip']) ) {
			$uerror['user_zip'] = $BL['user_zip_empty'];
		}
		if( empty($udata['user_city']) ) {
			$uerror['user_city'] = $BL['user_city_empty'];
		}
	
	}
	
	$fe_reg = array();	
	
	if($fe_action == '{FE_USER_REGISTER}') {


		$fe_reg[] = $BL['be_profile_registration_text'];
		
	} else {
	
		$fe_reg[] = $BL['be_profile_form_check'] ;
	
	}

	// render the registration form...
	
	$fe_reg[] = '<form action="' .$_uri. '" method="post">';
	
	// Fieldset 1 -> login basics
	$fe_reg[] = '<fieldset>';
	$fe_reg[] = '<legend>'.$BL["login_text"].'</legend>';
	
	$fe_reg[] = is_uerror('user_login');
	$fe_reg[] = '<p>';
	$fe_reg[] = '<label class="labelpos" for="user_login">'.$BL["login_username"].'</label><br />';
	if($fe_action == '{FE_USER_REGISTER}') {
		$fe_reg[] = '<input type="text" name="user_login" id="user_login" value="' .html_specialchars($udata['user_login']). '" class="textfield" maxlength="200" size="25" />';
	} else {
		$fe_reg[] = '<strong>' .html_specialchars($udata['user_login']). '</strong>';
		$fe_reg[] = '<input type="hidden" name="user_login" value="' .html_specialchars($udata['user_login']). '" />';
	}
	$fe_reg[] = '</p>';

	$fe_reg[] = is_uerror('user_password');
	$fe_reg[] = '<p>';
	$fe_reg[] = '<label class="labelpos" for="user_password">'.$BL["login_userpass"].'</label><br />';
	$fe_reg[] = '<input type="password" name="user_password" id="user_password" class="textfield" maxlength="20" size="25" />';
	$fe_reg[] = '</p>';

	$fe_reg[] = '<p>';
	$fe_reg[] = '<label class="labelpos" for="user_password2">'.$BL["login_userpass_repeat"].'</label><br />';
	$fe_reg[] = '<input type="password" name="user_password2" id="user_password2" class="textfield" maxlength="20" size="25" />';
	$fe_reg[] = '</p>';
	$fe_reg[] = '</fieldset>';
	
	//$fe_reg[] = '<fieldset>';
	//$fe_reg[] = '<legend>'. $BL['be_profile_data_title'].' </legend>';
	//$fe_reg[] = $BL['be_profile_data_text'];
	
	//$fe_reg[] = is_uerror('user_company');
	//$fe_reg[] = '<p>';
	//$fe_reg[] = '<label class="labelpos" for="user_company">'.$BL['be_profile_label_company'].'</label><br />';
	//$fe_reg[] = '<input type="text" name="user_company" id="user_company" value="' .html_specialchars($udata['user_company']). '" class="textfield" maxlength="200" size="25" />';
	//$fe_reg[] = '</p>';
	
	//$fe_reg[] = '<p>';
	//$fe_reg[] = '<label class="labelpos">'.$BL['be_profile_label_title'].'</label>';
	
	//foreach($user_title as $key => $value) {
	//	$fe_reg['title'.$key]  = '<input type="radio" name="user_title" id="title'.$key.'" value="' ;
	//	$fe_reg['title'.$key] .= html_specialchars($value) . '"'.is_checked($value, $udata['user_title'], 1, 0).' />';
	//	if($value) {
	//		$fe_reg['title'.$key] .= '<label class="inline" for="title'.$key.'">' . html_specialchars($value) . '</label><br />';
	//	} else {
	//		$fe_reg['title'.$key] .= '<label class="inline" for="title'.$key.'">Other</label><br />';
	//	}
	//}
	//$fe_reg[] = '</p>';

	//$fe_reg[] = is_uerror('user_firstname');
	//$fe_reg[] = '<p>';
	//$fe_reg[] = '<label class="labelpos" for="user_firstname">'.$BL['be_profile_label_firstname'].'</label><br />';
	//$fe_reg[] = '<input type="text" name="user_firstname" id="user_firstname" value="' .html_specialchars($udata['user_firstname']). '" class="textfield" maxlength="200" size="25" />';
	//$fe_reg[] = '</p>';

	//$fe_reg[] = is_uerror('user_name');
	//$fe_reg[] = '<p>';
	//$fe_reg[] = '<label class="labelpos" for="user_name">'.$BL['be_profile_label_name'].'</label><br />';
	//$fe_reg[] = '<input type="text" name="user_name" id="user_name" value="' .html_specialchars($udata['user_name']). '" class="textfield" maxlength="200" size="25" />';
	//$fe_reg[] = '</p>';
	
	//$fe_reg[] = is_uerror('user_street');
	//$fe_reg[] = '<p>';
	//$fe_reg[] = '<label class="labelpos" for="user_street">'.$BL['be_profile_label_street'].'</label><br />';
	//$fe_reg[] = '<input type="text" name="user_street" id="user_street" value="' .html_specialchars($udata['user_street']). '" class="textfield" maxlength="200" size="25" />';
	//$fe_reg[] = '</p>';
	
	
	//$fe_reg[] = is_uerror('user_city');
	//$fe_reg[] = '<p>';
	//$fe_reg[] = '<label class="labelpos">'.$BL['be_profile_label_city'].'</label><br />';
	//$fe_reg[] = '<input type="text" name="user_city" id="user_city" value="' .html_specialchars($udata['user_city']). '" class="textfield_city" maxlength="200" size="25" />';
	//$fe_reg[] = '</p>';

	//$fe_reg[] = is_uerror('user_zip');
	//$fe_reg[] = '<p>';
	//$fe_reg[] = '<label class="labelpos">'.$BL['be_profile_label_zip'].'</label><br />';
	//$fe_reg[] = '<input type="text" name="user_zip" id="user_zip" value="' .html_specialchars($udata['user_zip']). '" class="textfield_zip" maxlength="5" size="5" />';
	//$fe_reg[] = '</p>';

	//$fe_reg[] = '</fieldset>';
	
	$fe_reg[] = '<fieldset>';
	$fe_reg[] = '<legend> '.$BL['be_profile_data_contact'].'</legend>';

	//$fe_reg[] = is_uerror('user_tel');
	//$fe_reg[] = '<p>';
	//$fe_reg[] = '<label class="labelpos" for="user_tel">'.$BL['be_profile_label_phone'].'</label><br />';
	//$fe_reg[] = '<input type="text" name="user_tel" id="user_tel" value="' .html_specialchars($udata['user_tel']). '" class="textfield" maxlength="200" size="25" />';
	//$fe_reg[] = '</p>';	
	
	$fe_reg[] = is_uerror('user_email');
	$fe_reg[] = '<p>';
	$fe_reg[] = '<label class="labelpos" for="user_email">'.$BL['be_profile_label_email'].'</label><br />';
	$fe_reg[] = '<input type="text" name="user_email" id="user_email" value="' .html_specialchars($udata['user_email']). '" class="textfield" maxlength="200" size="25" />';
	$fe_reg[] = '</p>';	
	$fe_reg[] = '</fieldset>';


	//  disable part of the profile survey form
	/*
	if($fe_action == '{FE_USER_REGISTER}') {


		$fe_reg[] = '<fieldset class="profile">';
		$fe_reg[] = '<legend> Infos zu HP ProCurve </legend>';

		//$fe_reg[] = is_uerror('user_profile_1');
		$fe_reg[] = '';
		$fe_reg[] = '<p class="title">Vertreiben Sie bereits HP ProCurve L&ouml;sungen?</p>';
		$fe_reg[] = '<label class="inline">' .
					'<input type="radio" name="user_profile_1" value="1"'.is_checked(1, $udata['user_profile_1'], 1, 0).' />' .
					'Ja</label>';
		$fe_reg[] = '<label class="inline">' .
					'<input type="radio" name="user_profile_1" value="0"'.is_checked(0, $udata['user_profile_1'], 1, 0).' />' .
					'Nein</label>';
		$fe_reg[] = '';
		
		//$fe_reg[] = is_uerror('user_profile_2');
		$fe_reg[] = '<p>';
		$fe_reg[] = '<p class="title">Wenn Ja, welche?</p>';
		$fe_reg[] = '<label class="inline">' .
					'<input type="radio" name="user_profile_2" value="SMB"'.is_checked('SMB', $udata['user_profile_2'], 1, 0).' />' .
					'SMB</label>';
		$fe_reg[] = '<label class="inline">' .
					'<input type="radio" name="user_profile_2" value="Enterprise"'.is_checked('Enterprise', $udata['user_profile_2'], 1, 0).' />' .
					'Enterprise</label>';
		$fe_reg[] = '<label class="inline">' .
					'<input type="radio" name="user_profile_2" value="Beides"'.is_checked('Beides', $udata['user_profile_2'], 1, 0).' />' .
					'Beides</label>';
		$fe_reg[] = '</p>';
		
		//$fe_reg[] = is_uerror('user_profile_3');
		$fe_reg[] = '<p>';
		$fe_reg[] = '<p class="title">Wenn Nein, Welche Networking L&ouml;sungen vertreiben Sie?</p>';
		$fe_reg[] = '<label class="inline">' .
					'<input type="checkbox" name="user_profile_3[cisco]" value="Cisco"'.is_checked(1, isset($udata['user_profile_3']['cisco']) ? 1 : 0 , 1, 0).' />' .
					'Cisco</label>';
		$fe_reg[] = '<label class="inline">' .
					'<input type="checkbox" name="user_profile_3[nortel]" value="Nortel"'.is_checked(1, isset($udata['user_profile_3']['nortel']) ? 1 : 0 , 1, 0).' />' .
					'Nortel</label>';
		$fe_reg[] = '<label class="inline">' .
					'<input type="checkbox" name="user_profile_3[keine]" value="Keine"'.is_checked(1, isset($udata['user_profile_3']['keine']) ? 1 : 0 , 1, 0).' />' .
					'Keine</label>';
		$fe_reg[] = '<label class="inline">' .
					'<input type="checkbox" name="user_profile_3[andere]" value="Andere"'.is_checked(1, isset($udata['user_profile_3']['andere']) ? 1 : 0 , 1, 0).' />' .
					'Andere</label> <input type="text" name="user_profile_3[andere_text]" value="' .
					(isset($udata['user_profile_3']['andere_text']) ? html_specialchars($udata['user_profile_3']['andere_text']) : '') . 
					'" size="15" maxlength="100" class="textfield inline" />';
	
		$fe_reg[] = '</p>';
		
		
		
		$fe_reg[] = '<p>';
		$fe_reg[] = '<p class="title">Vertreiben Sie andere Technologien von HP?</p>';
		$fe_reg[] = 'Ja &#8211; <label class="inline">' .
					'<input type="checkbox" name="user_profile_4[server]" value="Server"'.is_checked(1, isset($udata['user_profile_4']['server']) ? 1 : 0 , 1, 0).' />' .
					'Server</label>';
		$fe_reg[] = '<label class="inline">' .
					'<input type="checkbox" name="user_profile_4[storage]" value="Storage"'.is_checked(1, isset($udata['user_profile_4']['storage']) ? 1 : 0 , 1, 0).' />' .
					'Storage</label>';
		$fe_reg[] = '<label class="inline">' .
					'<input type="checkbox" name="user_profile_4[software]" value="Software"'.is_checked(1, isset($udata['user_profile_4']['software']) ? 1 : 0 , 1, 0).' />' .
					'Software</label>';
		$fe_reg[] = '<label class="inline">' .
					'<input type="checkbox" name="user_profile_4[andere]" value="Andere"'.is_checked(1, isset($udata['user_profile_4']['andere']) ? 1 : 0 , 1, 0).' />' .
					'Andere</label> <input type="text" name="user_profile_4[andere_text]" value="' .
					(isset($udata['user_profile_4']['andere_text']) ? html_specialchars($udata['user_profile_4']['andere_text']) : '') . 
					'" size="15" maxlength="100" class="textfield inline" />';
	
		$fe_reg[] = '</p>';
		
		$fe_reg[] = '</fieldset>';
	
	
		$fe_reg[] = '<fieldset class="profile">';
		$fe_reg[] = '<legend> Infos zum Partnerstatus </legend>';
	
		$fe_reg[] = '';
		$fe_reg[] = '<p class="title">Sind Sie bereits HP Vertriebspartner?</p>';
		$fe_reg[] = '<label class="inline">' .
					'<input type="radio" name="user_profile_5" value="1"'.is_checked(1, $udata['user_profile_5'], 1, 0).' />' .
					'Ja</label>';
		$fe_reg[] = '<label class="inline">' .
					'<input type="radio" name="user_profile_5" value="0"'.is_checked(0, $udata['user_profile_5'], 1, 0).' />' .
					'Nein</label>';
		$fe_reg[] = '';
		
		$fe_reg[] = '<p>';
		$fe_reg[] = 'Wenn Ja, welcher Status';
		$fe_reg[] = '<input type="text" name="user_profile_6" value="' . html_specialchars($udata['user_profile_6']) . '" size="15" maxlength="150" class="textfield inline" />';
		$fe_reg[] = '</p>';
		
		$fe_reg[] = '</fieldset>';
	
	}
*/


// include this part of the profile survey form
	
		$fe_reg[] = '<fieldset class="profile_info">';
		$fe_reg[] = '<legend>'.$BL['be_newsletter_title'].'</legend>';
	


	//  disable part of the profile survey form
	/*
	if($fe_action == '{FE_USER_REGISTER}') {
		
		$fe_reg[] = '<p>';
		$fe_reg[] = '<label class="inline">' .
					'<input type="checkbox" name="user_profile_7[0]" value="1"'.is_checked(1, empty($udata['user_profile_7'][0]) ? 0 : 1 , 1, 0).' />' .
					'Ich wünsche Informationen zu den HP ProCurve Lösungen.</label>';
		$fe_reg[] = '</p>';
	
		$fe_reg[] = '<p>';				
		$fe_reg[] = '<label class="inline">' .
					'<input type="checkbox" name="user_profile_7[1]" value="1"'.is_checked(1, empty($udata['user_profile_7'][1]) ? 0 : 1 , 1, 0).' />' .
					'Ich wünsche Informationen zu den Azlan Services für den Vertrieb von HP ProCurve Lösungen.</label>';
		$fe_reg[] = '</p>';
	
		$fe_reg[] = '<p>';				
		$fe_reg[] = '<label class="inline">' .
					'<input type="checkbox" name="user_profile_7[2]" value="1"'.is_checked(1, empty($udata['user_profile_7'][2]) ? 0 : 1 , 1, 0).' />' .
					'Ich habe noch Fragen zu</label> '.
					'<input type="text" name="user_profile_8" value="' . html_specialchars($udata['user_profile_8']) . '" size="15" maxlength="200" class="textfield inline" />';
		$fe_reg[] = '</p>';
		
	}
	*/
	
// include this part of the profile survey form

		$fe_reg[] = '<p>';
		$fe_reg[] = '<label class="inline">' .
					'<input type="checkbox" name="user_profile_7[3]" value="1"'.is_checked(1, empty($udata['user_profile_7'][3]) ? 0 : 1 , 1, 0).' />' .
					$BL['be_profile_text_newsletter'].'</label>';
		$fe_reg[] = '</p>';
	
	
	if($fe_action == '{FE_USER_REGISTER}') {
	
		$fe_reg[] = '<p>';	
		$fe_reg[] = '<label class="inline">' .
					'<input type="checkbox" name="user_profile_7[4]" value="1"'.is_checked(1, empty($udata['user_profile_7'][4]) ? 0 : 1 , 1, 0).' />' .
					'<strong>'.$BL['user_registration_partner_request'].'</strong></label>';
		$fe_reg[] = '</p>';
	
	}

	

		$fe_reg[] = '</fieldset>';
	
	
	//  disable part of the profile survey form
	/*
	if($fe_action == '{FE_USER_REGISTER}') {

	
		$fe_reg[] = '<fieldset class="profile_info">';
		$fe_reg[] = '<legend> Weitere Angaben </legend>';
	
		$fe_reg[] = '<p class="title">';
		$fe_reg[] = 'Wie lässt sich Ihr Geschäftsbereich am besten beschreiben?';
		$fe_reg[] = '</p>';
	
		$fe_reg[] = '<p>';
		$fe_reg[] = '<label class="inline">' .
					'<input type="radio" name="user_profile_9" value="Systemhaus"'.is_checked('Systemhaus', $udata['user_profile_9'], 1, 0).' />' .
					'Systemhaus</label>';
		$fe_reg[] = '</p>';
		
		$fe_reg[] = '<p>';
		$fe_reg[] = '<label class="inline">' .
					'<input type="radio" name="user_profile_9" value="Value Added Reseller"'.is_checked('Value Added Reseller', $udata['user_profile_9'], 1, 0).' />' .
					'Value Added Reseller</label>';
		$fe_reg[] = '</p>';
		
		$fe_reg[] = '<p>';
		$fe_reg[] = '<label class="inline">' .
					'<input type="radio" name="user_profile_9" value="Reseller"'.is_checked('Reseller', $udata['user_profile_9'], 1, 0).' />' .
					'Reseller</label>';
		$fe_reg[] = '</p>';
	
		$fe_reg[] = '<p>';
		$fe_reg[] = '<label class="inline">' .
					'<input type="radio" name="user_profile_9" value="Anderes"'.is_checked('Anderes', $udata['user_profile_9'], 1, 0).' />' .
					'Anderes</label> <input type="text" name="user_profile_10" value="' . html_specialchars($udata['user_profile_10']) . 
					'" size="15" maxlength="200" class="textfield inline" />';
		$fe_reg[] = '</p>';
		
	
		$fe_reg[] = '<p class="title">';
		$fe_reg[] = 'Wieviele Mitarbeiter beschäftigt Ihr Unternehmen?';
		$fe_reg[] = '</p>';
	
		foreach(array('weniger als 15', '15 - 49', '50 – 149', '150 – 499', '500 – 999', 'mehr als 1.000') as $value) {
		
			$fe_reg[] = '<p>';
			$fe_reg[] = '<label class="inline">' .
						'<input type="radio" name="user_profile_11" value="'.$value.'"'.is_checked($value, $udata['user_profile_11'], 1, 0).' />' . $value .'</label>';
			$fe_reg[] = '</p>';
		
		}
		
		
		$fe_reg[] = '<p class="title">';
		$fe_reg[] = 'In welchen Branchen sind Ihre Kunden hauptsächlich tätig?';
		$fe_reg[] = '</p>';
	
		$fe_reg[] = '<p>';
		foreach(array(	'Automotive', 'Banken & Versicherungen', 'Energie', 
						'ITK', 'Großhandel', 'Einzelhandel', 'Fertigung', 
						'Gesundheit', 'Medien', 'Öffentliche Einrichtungen', 
						'Transport/Logistik', 'Dienstleistungen', 'Sonstiges') as $key => $value) {
		
			$fe_reg[] = '<label class="column" style="float:left;width:200px;">' .
						'<input type="checkbox" name="user_profile_12['.$key.']" value="'.html_specialchars($value).'"' .
						is_checked(1, isset($udata['user_profile_12'][$key]) ? 1 : 0, 1, 0) .' />' .
						html_specialchars($value) .'</label>';
		
		}
		$fe_reg[] = '</p>';
	
		$fe_reg[] = '<div style="clear:both"></div><p class="title">';
		$fe_reg[] = 'Wer sind Ihre Kunden vorwiegend?';
		$fe_reg[] = '</p>';
		
		$fe_reg[] = '<p>';
		$fe_reg[] = '<label class="inline">' .
					'<input type="radio" name="user_profile_13" value="+500"'.is_checked('+500', $udata['user_profile_13'], 1, 0).' />' .
					'Gro&szlig;unternehmen (> 500 MA)</label>';
		$fe_reg[] = '</p>';
		
		$fe_reg[] = '<p>';
		$fe_reg[] = '<label class="inline">' .
					'<input type="radio" name="user_profile_13" value="-500"'.is_checked('-500', $udata['user_profile_13'], 1, 0).' />' .
					'Mittelstand (< 500 MA)</label>';
		$fe_reg[] = '</p>';
		
		$fe_reg[] = '<p>';
		$fe_reg[] = '<label class="inline">' .
					'<input type="radio" name="user_profile_13" value="-20"'.is_checked('-20', $udata['user_profile_13'], 1, 0).' />' .
					'Kleinunternehmen (< 20 MA)</label>';
		$fe_reg[] = '</p>';
	
		$fe_reg[] = '<p>';
		$fe_reg[] = '<label class="inline">' .
					'<input type="radio" name="user_profile_13" value="Andere"'.is_checked('Andere', $udata['user_profile_13'], 1, 0).' />' .
					'Andere</label> <input type="text" name="user_profile_14" value="' . html_specialchars($udata['user_profile_14']) . 
					'" size="15" maxlength="200" class="textfield inline" />';
		$fe_reg[] = '</p>';
	
	
		$fe_reg[] = '</fieldset>';

	}

	*/



// include this part of the profile survey form

	$fe_reg[] = '<p>';
	$fe_reg[] = '<input type="submit" value="'.$BL['be_cnt_formsave_profile'].'" class="button" />';
	$fe_reg[] = '</p>';




	$fe_reg[] = '</form>';

	$fe_reg = implode(LF, $fe_reg);
	
	
	if(isset($_POST['user_login']) && $fe_action == '{FE_USER_REGISTER}') {
		if($uerror['status']) {
		
			$fe_reg = '<p class="error">'.$BL['be_profile_form_errors'].'</p>' . LF . $fe_reg;
		
		} else {
		
			// initialize the geocoding...
			require_once( './maxmind/locate.inc.php'); 
			$record = Array();
			$remoteAddr = getRemoteIP();
							
			$yahooWeatherCode = "xml.weather.yahoo.com/forecastrss?p=".LogEntry($remoteAddr, $record)."&u=f";

				
			//TODO: alter following line after testing
			$profile_aktiv = 1; // autoactivate, default should be enabled after alpha testing:$sql .= "'0', ";

			$profile_data = $udata;
			unset($profile_data['user_password'], $profile_data['user_password2']);
		
			// create entry (account) in phpwcms_user table then add 
			// $udata to phpwcms_userdetail, which is the personal info table...
			// phpwcms_userdetail.detail_pid is the forign key to phpwcms_user.usr_id 

		    $sql  = 'INSERT INTO '.DB_PREPEND.'phpwcms_user (';
			$sql .= 'usr_login, usr_pass, usr_email, usr_rechte, usr_admin, usr_aktiv, ';
			$sql .= 'usr_name, usr_lang, usr_wysiwyg, usr_fe, usr_ip, usr_lat, usr_long,';
			$sql .= 'usr_zip, usr_ywc, usr_country, usr_dma, usr_area_code, usr_city, usr_region ) VALUES (';
			
			$sql .= "'" . aporeplace($udata['user_login']) . "', ";
			
			$sql .= "'" . aporeplace(md5($udata['user_password'])) . "', ";
			$sql .= "'" . aporeplace(strtolower($udata['user_email'])) . "', ";
			$sql .= "'0', ";
			$sql .= "'0', ";
			$sql .= "'".$profile_aktiv."', "; 
			$sql .= "'" . aporeplace($udata['user_name']) . "', ";
			$sql .= "'en', ";
			$sql .= "'2', ";
			$sql .= "'0', ";
			$sql .= "'".aporeplace($remoteAddr)."', ";
			$sql .= "'".aporeplace($record['Latitude'])."', ";
			$sql .= "'".aporeplace($record['Longitude'])."', ";
			$sql .= "'".aporeplace($record['Zip'])."', ";
			$sql .= "'".aporeplace($yahooWeatherCode)."', ";
			$sql .= "'".aporeplace($record['CountryCode'])."', ";
			$sql .= "'".aporeplace($record['Metro'])."', ";
			$sql .= "'".aporeplace($record['AreaCode'])."', ";
			$sql .= "'".aporeplace($record['City'])."', ";
			$sql .= "'".aporeplace($record['State'])."' ); ";
			$queryResult = _dbQuery($sql, 'INSERT');

			if(!empty($queryResult['INSERT_ID'])) {
			

				$sql  = 'INSERT INTO '.DB_PREPEND.'phpwcms_userdetail (';
				$sql .= 'detail_pid, detail_title, detail_firstname, detail_lastname, detail_company, detail_street, detail_city, detail_zip , ';
				$sql .= 'detail_fon, detail_notes, detail_aktiv, detail_newsletter, detail_varchar1, detail_email, detail_login, detail_password, ';
				$sql .= 'detail_ip, detail_lat, detail_long, detail_ywc, detail_country, detail_dma, detail_area_code, detail_region ) VALUES (';
				$sql .= "'" . $queryResult['INSERT_ID'] . "', ";
				$sql .= "'" . aporeplace($udata['user_title']) . "', ";
				$sql .= "'" . aporeplace($udata['user_firstname']) . "', ";
				$sql .= "'" . aporeplace($udata['user_name']) . "', ";
				$sql .= "'" . aporeplace($udata['user_company']) . "', ";
				$sql .= "'" . aporeplace($udata['user_street']) . "', ";
				$sql .= "'" . aporeplace($record['City']) . "', ";
				
				//$sql .= "'" . aporeplace($udata['user_city']) . "', ";

				$sql .= "'" . aporeplace($record['Zip']) . "', ";
				//$sql .= "'" . aporeplace($udata['user_zip']) . "', ";

				$sql .= "'" . aporeplace($udata['user_tel']) . "', ";
				$sql .= "'" . aporeplace(serialize($profile_data)) . "', ";
				
				$sql .= "'".$profile_aktiv."', "; 
				
				$sql .= "'" . ( empty($udata['user_profile_7'][3]) ? '' : 1 ) . "', "; //detail_newsletter
				$sql .= "'".$phpwcms['organization']."', ";							   //detail_varchar1  wtf?  seems to be a domain or group	
				$sql .= "'" . aporeplace(strtolower($udata['user_email'])) . "', ";
				$sql .= "'" . aporeplace($udata['user_login']) . "', ";
				$sql .= "'" . aporeplace(md5($udata['user_password'])) ."', ";
				$sql .= "'".aporeplace($remoteAddr)."', ";
				$sql .= "'".aporeplace($record['Latitude'])."', ";
				$sql .= "'".aporeplace($record['Longitude'])."', ";
				$sql .= "'".aporeplace($yahooWeatherCode)."', ";
				$sql .= "'".aporeplace($record['CountryCode'])."', ";
				$sql .= "'".aporeplace($record['Metro'])."', ";
				$sql .= "'".aporeplace($record['AreaCode'])."', ";
				$sql .= "'".aporeplace($record['State'])."' ); ";
					
				$queryResult = _dbQuery($sql, 'INSERT');



				if(!empty($queryResult['INSERT_ID'])) {

					$fe_reg  = '<p class="success">'.$BL['user_registration_data_success1_comment'].' '.html_specialchars($udata['user_firstname'].' '.$udata['user_name']).'! '.$BL['user_registration_data_success2_comment'].'</p>';
					$fe_reg .= '<p>'.$BL['user_registration_data_sent1_comment'].'<b>'.html_specialchars($udata['user_email']).'</b>'.$BL['user_registration_data_sent2_comment'].'</p>';
					
					$fe_text  = $BL['user_registration_hello_label'].trim($udata['user_title'] . ' ' . trim( $udata['user_firstname'].' '.$udata['user_name']) ) . LF . LF;
					$fe_text .= $BL['user_registration_data_recieved_comment'] . LF;
					$fe_text .= $BL['user_registration_data_review_comment'] . LF . LF;
					
					if(empty($udata['user_profile_7'][4])) {
						$fe_text .= $BL['user_registration_partner_backend_declined'] .LF . $BL['user_registration_data_statement_stored'] . LF;
					} else {
						$fe_text .= $BL['user_registration_partner_backend_requested'] .LF . $BL['user_registration_data_statement_submitted'] . LF;
					}
					$fe_text .= '  '.$BL['be_profile_label_username'].':    ' . $udata['user_login'] . LF;
					$fe_text .= '  '.$BL["login_userpass"].': ' . $udata['user_password'] . LF . LF;
					$fe_text .= $BL['user_password_dbfailure'] . LF . LF . LF;
					$fe_text .= $BL['user_registration_greeting'] . LF;
					$fe_text .= $phpwcms['organization'] . LF;
					
					$fe_text1  = $BL['user_new_profile_registration'].' @ '.$phpwcms['organization'] . LF;
					$fe_text1 .= '-----------------------------------------------------------' . LF . LF;
					
					$fe_text1 .= $BL['user_profile_visibility'] . LF;
					
					if(!empty($udata['user_profile_7'][4])) {
						$fe_text1 .=  $BL['user_profile_partnering'].LF;
						$fe_text1 .= '  '.$BL['be_profile_label_username'].':    ' . $udata['user_login'] . LF;
					}
					
					$fe_text1 .= LF;
					$fe_text1 .= $BL['user_data_label'] .':' . LF;
					$fe_text1 .= '================' . LF . LF;
					
					$fe_text1 .= $BL['be_profile_label_company'].':   ' . $udata['user_company'] . LF;
					$fe_text1 .= $BL['be_profile_label_title'].':  ' . $udata['user_title'] . LF;
					$fe_text1 .= $BL['be_profile_label_firstname'].': ' . $udata['user_firstname'] . LF;
					$fe_text1 .= $BL['be_profile_label_name'].':    ' . $udata['user_name'] . LF;
					$fe_text1 .= $BL['be_profile_label_street'].':  ' . $udata['user_street'] . LF;
					$fe_text1 .= $BL['be_profile_label_zip'].':     ' . $udata['user_zip'] . LF;
					$fe_text1 .= $BL['be_profile_label_city'].':     ' . $udata['user_city'] . LF;
					$fe_text1 .= $BL['be_profile_label_phone'].': ' . $udata['user_tel'] . LF;
					$fe_text1 .= $BL['be_profile_label_email'].':  ' . $udata['user_email'] . LF;
		
					$fe_text1 .= LF . '-----------------------------------------------------------' . LF;
					$fe_text1 .= 'IP: '. getRemoteIP();
					
					$fe_csv_attach  = implode(';', array_keys($fe_csv) );
					$fe_csv_attach .= LF;
					$fe_csv_attach .= implode(';', $fe_csv );
					
					$fe_csv = array();
					
					$fe_csv['filename']	= date('Y-m-d_H-i-s') . '_' . preg_replace('/[^a-zA-Z0-9\-_]/', '', $udata['user_login']).'.csv';
					$fe_csv['mime']		= 'text/csv';
					$fe_csv['data']		= $fe_csv_attach;

					//TODO: Fix after testing
					// send email to user that just registered
					sendEmail(array(
						'recipient'		=> strtolower($udata['user_email']),
						'toName'		=> trim($udata['user_firstname'].' '.$udata['user_name']),
						'subject'		=> $BL['be_new_member_registration'],
						'text'			=> $fe_text,
						'from'			=> 'someemail@somehost.com',
						'fromName'		=> 'From Name,
						'sender'		=> 'someemail@somehost.com' ));
						
					//TODO: Fix after testing
					// send email to site administrator that a new user has just registered
					sendEmail(array(
						'recipient'		=> 'someemail@somehost.com',
						'subject'		=> $BL['be_new_member_registration'],
						'text'			=> $fe_text1,
						'from'			=> strtolower($udata['user_email']),
						'fromName'		=> trim($udata['user_firstname'].' '.$udata['user_name']),
						'sender'		=> strtolower($udata['user_email']),
						'stringAttach'	=> array($fe_csv) ));
					
					
				} else {
					
					$fe_reg = '<p class="error">'.$BL['user_registration_data_failure'].'<br />'.$sql.'</p>' . LF . $fe_reg;
					 
				}
			
			}else {
					
					$fe_reg = '<p class="error">'.$BL['user_registration_data_failure'].'<br />'.$sql.'</p>' . LF . $fe_reg;
					 
			}
		}
	}
	
	if(isset($_POST['user_login']) && $fe_action == '{FE_USER_MANAGE}') {
	
		if($uerror['status']) {
		
			$fe_reg = '<p class="error">'.$BL['be_profile_form_errors'].'</p>' . LF . $fe_reg;
		
		} else {
		
			$profile_data = $udata;
			unset($profile_data['user_password'], $profile_data['user_password2']);

			//TODO: seems like this would be the spot to reinitialize the geocoding after the profile has been edited...
		    //TODO: note the management of the backend user needs the geocoding data as well...
		
			$sql  = 'UPDATE '.DB_PREPEND.'phpwcms_userdetail SET ';
			$sql .= "detail_title		= '".aporeplace($udata['user_title'])."', ";
			$sql .= "detail_firstname	= '".aporeplace($udata['user_firstname'])."', ";
			$sql .= "detail_lastname	= '".aporeplace($udata['user_name'])."', ";
			$sql .= "detail_company		= '".aporeplace($udata['user_company'])."', ";
			$sql .= "detail_street		= '".aporeplace($udata['user_street'])."', ";
			$sql .= "detail_city		= '".aporeplace($udata['user_city'])."', ";
			$sql .= "detail_zip			= '".aporeplace($udata['user_zip'])."', ";
			$sql .= "detail_fon			= '".aporeplace($udata['user_tel'])."', ";
			$sql .= "detail_notes		= '".aporeplace(serialize($profile_data))."', ";
			$sql .= "detail_newsletter	= '".( empty($udata['user_profile_7'][3]) ? '' : 1 )."', ";
			
			
			
			
			
			if($udata['user_password']) {
				$sql .= "detail_password	= '".aporeplace(md5($udata['user_password']))."', ";
			}
			$sql .= "detail_email		= '".aporeplace(strtolower($udata['user_email']))."' ";
			$sql .= 'WHERE detail_id=' . intval($_SESSION[ $_loginData['session_key'].'_userdata']['id']).' LIMIT 1';
			
			$queryResult = _dbQuery($sql, 'UPDATE');
			if(isset($queryResult['AFFECTED_ROWS'])) {
		
				$fe_reg = "<p>".$BL['be_profile_update_success']."</p>" . LF . $fe_reg;
		
			} else {
			
				$fe_reg = "<p class='error'>".$BL['be_profile_update_error']."</p>" . LF . $fe_reg;
			
			}
		
		}
	
	}

	$content['all'] = str_replace($fe_action, $fe_reg, $content['all']);

} else {

	$content['all'] = str_replace('{FE_USER_MANAGE}', '<p class="error">'.$BL['be_profile_update_deny'].'</p>', $content['all']);

}

function is_uerror($field='') {
	global $uerror;
	if(!empty($uerror[$field])) {
		$uerror['status'] = true;
		return '<p class="error">' . $uerror[$field] . '</p>';
	}
	return '';
}


?>
Now, on the tenth edit of this post I see what I still need to code, most of it doesn't apply to others so see if you can use this much (with the obvious changes needed) and perhaps share anything you find necessary; then great! If you want to bitch then well, I don't even need to say it...
rushclub
Posts: 915
Joined: Tue 17. Feb 2004, 18:52

Re: FE User and User/Group Rights-Management Development

Post by rushclub »

i have a problem. when i put fe_user.php in frontend_rende i only see a blank page in the frontend.
anyone has an idea. with the old fe_user.php everything works fine. working with clean 272.

rush
3 (!) Jahre warten reichen mir. Ich bin erst mal weg.
nebenaube
Posts: 139
Joined: Fri 23. Nov 2007, 20:39
Location: Redlands, CA
Contact:

Re: FE User and User/Group Rights-Management Development

Post by nebenaube »

rushclub wrote:i have a problem. when i put fe_user.php in frontend_rende i only see a blank page in the frontend.
anyone has an idea. with the old fe_user.php everything works fine. working with clean 272.

rush
the copy I posted last night has code to use Maxmind's geoip library/database. if you remove the calls to load it and also remove the sql parts that store it with the profile your's should work... review the code as it is not intended to be a working solution. Just an offer of collaboration and my attempt to drive progress towards the goal of getting it working.

Here, I pulled the geoip stuff out of this one... If the database insertions fail you should be able to see the sql string and make any necessary adjustments.

Code: Select all

<?php
/*************************************************************************************
   Copyright notice
   
   (c) 2002-2008 Oliver Georgi (oliver@phpwcms.de) // All rights reserved.

   This script is part of PHPWCMS. The PHPWCMS web content management system 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.
 
   The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html
   A copy is found in the textfile GPL.txt and important notices to the license
   from the author is found in LICENSE.txt distributed with these scripts.
 
   This script is distributed in the hope that it will be useful, but WITHOUT ANY
   WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
   PARTICULAR PURPOSE.  See the GNU General Public License for more details.

   This copyright notice MUST APPEAR in all copies of the script!
*************************************************************************************/

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// fe_user.php modification for generic front end user registration without an elaborate signup survey.
// note: example code for a survey (Oliver's original) is retained in comments.
//
// this file lives on the web server path domain_name/template/nc_script/frontend_render/fe_user.php
//
// the main modifications consisted of disabling non-generic components of the registration survey form
// and changes to support multiple languages.
//
// Added a Check to configure what language we're using -- There must be a built-in fuction for this but I haven't looked for it.
// Added a include to get the language file we're using
//
//TODO: switch for language...
// currently I'm doing this which supports my purposes
//   switch($language){
//      case 'de': $user_title = array('Herr', 'Frau', ''); break;
//      case 'en': $user_title = array('Mr',   'Mrs', ''); break;
//      case 'tr': $user_title = array('Herr', 'Frau', ''); break;
//        default: $user_title = array('Mr',   'Mrs', ''); break;
//   }
// when it should be incorporated into the language file.




//Check to see what language we're using
if ($phpwcms['default_lang']=='de'){
$language="de";
}else {
if ($phpwcms['default_lang']=='en'){
   $language="en";
}else{
   if ($phpwcms['default_lang']=='tr'){
    $language="tr";
   }else{   
     $language="en";
   }
}   
}

// get the language file we're using
include( PHPWCMS_ROOT."/include/inc_lang/backend/".$language."/lang.inc.php");



// first check what to do
if(_getFeUserLoginStatus() && strpos($content['all'], '{FE_USER_MANAGE}')) {

   $fe_action = '{FE_USER_MANAGE}';
   if( $_SESSION[ $_loginData['session_key'].'_userdata']['source'] == 'BACKEND' ) {
      $fe_action = false;
   }

}else{
   
   if(strpos($content['all'], '{FE_USER_REGISTER}')) {
      $fe_action = '{FE_USER_REGISTER}';
    }else{
      $fe_action = false;
   }
}

// fe user register
if($fe_action) {

   $udata = array(
                  'user_login'      => '',
                  'user_password'      => '',
                  
                  'user_company'      => '',
                  'user_title'      => '',
                  'user_name'         => '',
                  'user_firstname'   => '',
                  'user_street'      => '',
                  'user_zip'         => '',
                  'user_city'         => '',
                  'user_tel'         => '',
                  'user_email'      => '',
                  'user_profile_1'   => '',
                  'user_profile_2'   => '',
                  'user_profile_3'   => '',
                  'user_profile_4'   => '',
                  'user_profile_5'   => '',
                  'user_profile_6'   => '',
                  'user_profile_7'   => array(4=>1),
                  'user_profile_8'   => '',
                  'user_profile_9'   => '',
                  'user_profile_10'   => '',
                  'user_profile_11'   => '',
                  'user_profile_12'   => '',
                  'user_profile_13'   => '',
                  'user_profile_14'   => '',
               );      

   switch($fe_action) {
   
      case '{FE_USER_MANAGE}':   $_uri = 'index.php'.returnGlobalGET_QueryString('htmlentities', array('profile_manage'=>'edit'), array('profile_register', 'rofile_reminder') );
                           
                           // at the moment it is only possible to edit user data of "real" FRONTEND users
                           // BACKEND users should login to backend and edit their data there

                           $sql  = 'SELECT * FROM '.DB_PREPEND.'phpwcms_userdetail WHERE ';
                           $sql .= 'detail_id=' . intval($_SESSION[ $_loginData['session_key'].'_userdata']['id']).' LIMIT 1';
                           $result = _dbQuery($sql);
                           if(isset($result[0])) {
                              $udata = unserialize($result[0]['detail_notes']);
                           }
                           $udata['user_password'] = '';
                           
                           break;
                           
      case '{FE_USER_REGISTER}':   $_uri = 'index.php'.returnGlobalGET_QueryString('htmlentities', array('profile_register'=>'create'), array('profile_manage', 'profile_reminder') );
      

                           break;
   
   }

   
   $uerror = array(
   
      'status'         => false,
   
      'user_login'      => '',
      'user_password'      => '',
      'user_company'      => '',
      'user_title'      => '',
      'user_name'         => '',
      'user_firstname'   => '',
      'user_street'      => '',
      'user_zip'         => '',
      'user_city'         => '',
      'user_tel'         => '',
      'user_email'      => '',
      'user_profile_1'   => '',
      'user_profile_2'   => '',
      'user_profile_3'   => '',
      'user_profile_4'   => '',
      'user_profile_5'   => '',
      'user_profile_6'   => '',
      'user_profile_7'   => '',
      'user_profile_8'   => '',
      'user_profile_9'   => '',
      'user_profile_10'   => '',
      'user_profile_11'   => '',
      'user_profile_12'   => '',
      'user_profile_13'   => '',
      'user_profile_14'   => '',
   
   );

   //TODO: recode for better switch on language...
   switch($language){
      case 'de': $user_title = array('Herr', 'Frau', ''); break;
      case 'en': $user_title = array('Mr',   'Mrs', ''); break;
      case 'tr': $user_title = array('Herr', 'Frau', ''); break;
        default: $user_title = array('Mr',   'Mrs', ''); break;
   }

   if(isset($_POST['user_login'])) {
   
      $fe_csv = array();
      
      $udata['user_login']      = clean_slweg($_POST['user_login']);
      $udata['user_password']      = slweg($_POST['user_password']);
      $udata['user_password2']   = slweg($_POST['user_password2']);
         
      $udata['user_company']      = clean_slweg($_POST['user_company']);
      $udata['user_title']      = clean_slweg($_POST['user_title']);
      $udata['user_name']         = clean_slweg($_POST['user_name']);
      $udata['user_firstname']   = clean_slweg($_POST['user_firstname']);
      $udata['user_street']      = clean_slweg($_POST['user_street']);
      $udata['user_zip']         = clean_slweg($_POST['user_zip']);
      $udata['user_city']         = clean_slweg($_POST['user_city']);
      $udata['user_tel']         = preg_replace('/[^0-9\+\-\(\) ]/', '', clean_slweg($_POST['user_tel']) );
      $udata['user_email']      = clean_slweg($_POST['user_email']);

      $fe_csv['login']       = $udata['user_login'];
      $fe_csv['company']       = $udata['user_company'];
      $fe_csv['title']       = $udata['user_title'];
      $fe_csv['name']       = $udata['user_name'];
      $fe_csv['firstname']   = $udata['user_firstname'];
      $fe_csv['street']       = $udata['user_street'];
      $fe_csv['zip']          = $udata['user_zip'];
      $fe_csv['city']       = $udata['user_city'];
      $fe_csv['tel']          = $udata['user_tel'];
      $fe_csv['email']       = $udata['user_email'];
      
      if($fe_action == '{FE_USER_REGISTER}') {
      
         
         $udata['user_profile_1']   = isset($_POST['user_profile_1']) ? intval($_POST['user_profile_1']) : '';
         $udata['user_profile_2']   = isset($_POST['user_profile_2']) ? clean_slweg($_POST['user_profile_2']) : '';
         
         $udata['user_profile_5']   = isset($_POST['user_profile_5']) ? intval($_POST['user_profile_5']) : '';
         $udata['user_profile_6']   = clean_slweg($_POST['user_profile_6']);
         $udata['user_profile_8']   = clean_slweg($_POST['user_profile_8']);
         $udata['user_profile_9']   = isset($_POST['user_profile_9']) ? clean_slweg($_POST['user_profile_9']) : '';
         $udata['user_profile_10']   = clean_slweg($_POST['user_profile_10']);
         $udata['user_profile_11']   = isset($_POST['user_profile_11']) ? clean_slweg($_POST['user_profile_11']) : '';
         
         $udata['user_profile_13']   = isset($_POST['user_profile_13']) ? clean_slweg($_POST['user_profile_13']) : '';
         $udata['user_profile_14']   = clean_slweg($_POST['user_profile_14']);
      
      
      
         $sql  = 'SELECT COUNT(*) FROM '.DB_PREPEND."phpwcms_userdetail WHERE ";
         $sql .= "detail_login LIKE '" . aporeplace($udata['user_login'])."'";
      
         if( empty($udata['user_login']) ) {
            $uerror['user_login'] = $BL['user_login_empty'];
         } elseif( strlen($udata['user_login']) < 4 ) {
            $uerror['user_login'] = $BL['user_login_len'];
         } elseif( _dbCount( $sql )   ) {
            $uerror['user_login'] = $BL['user_login_assigned'];
         }
         
         if( empty($udata['user_password']) ) {
            $uerror['user_password'] = $BL['user_password_empty'];
         } elseif( strlen($udata['user_password']) < 4 ) {
            $uerror['user_password'] = $BL['user_password_len'];
         } elseif( $udata['user_password'] !== $udata['user_password2'] ) {
            $uerror['user_password'] = $BL['user_password_nomatch'];
         }
         
         
         if(isset($_POST['user_profile_3']) && is_array($_POST['user_profile_3'])) {
            foreach($_POST['user_profile_3'] as $key => $value) {
               $udata['user_profile_3'][$key] = clean_slweg($value);
            }
         }
         
         if(isset($_POST['user_profile_4']) && is_array($_POST['user_profile_4'])) {
            foreach($_POST['user_profile_4'] as $key => $value) {
               $udata['user_profile_4'][$key] = clean_slweg($value);
            }
         }
         
         if(isset($_POST['user_profile_7']) && is_array($_POST['user_profile_7'])) {
            foreach($_POST['user_profile_7'] as $key => $value) {
               $udata['user_profile_7'][$key] = intval($value);
            }
         }
         
         if(isset($_POST['user_profile_12']) && is_array($_POST['user_profile_12'])) {
            foreach($_POST['user_profile_12'] as $key => $value) {
               $udata['user_profile_12'][$key] = clean_slweg($value);
            }
         }
         
               
         
      } else {
      
         $udata['user_login'] = $_SESSION[ $_loginData['session_key'].'_userdata']['login'];

         if( !empty($udata['user_password']) && strlen($udata['user_password']) < 4 ) {
            $uerror['user_password'] = $BL['user_password_len'];
         } elseif( $udata['user_password'] !== $udata['user_password2'] ) {
            $uerror['user_password'] = $BL['user_password_nomatch'];
         }
         
         $udata['user_profile_7'][3] = empty($_POST['user_profile_7'][3]) ? 0 : 1;
               
      }
      
      $sql  = 'SELECT COUNT(*) FROM '.DB_PREPEND."phpwcms_userdetail WHERE ";
      $sql .= "detail_login != '" . aporeplace($udata['user_login']) . "' AND ";
      $sql .= "detail_email = '" . aporeplace(strtolower($udata['user_email']))."'";
      
      if( empty($udata['user_email']) ) {
         $uerror['user_email'] = $BL['user_email_empty'];
      } elseif( !is_valid_email($udata['user_email']) ) {
         $uerror['user_email'] = $BL['user_email_invalid'];
      } elseif( _dbCount( $sql )   ) {
         $uerror['user_email'] = $BL['user_email_registered'];
      }
      
      if( empty($udata['user_tel']) ) {
         //$uerror['user_tel'] = $BL['user_tel_empty'];
      } elseif( preg_match('/[^0-9\+\-\(\) ]/', $udata['user_tel']) ) {
         $uerror['user_tel'] = $BL['user_tel_invalid'];
      }
      
      if( empty($udata['user_name']) ) {
         $uerror['user_name'] = $BL['user_name_empty'];
      }
      
      if( empty($udata['user_firstname']) ) {
         $uerror['user_firstname'] = $BL['user_firstname_empty'];
      }
      if( empty($udata['user_company']) ) {
         $uerror['user_company'] = $BL['user_company_empty'];
      }
      if( empty($udata['user_street']) ) {
         $uerror['user_street'] = $BL['user_street_empty'];
      }
      if( empty($udata['user_zip']) ) {
         $uerror['user_zip'] = $BL['user_zip_empty'];
      }
      if( empty($udata['user_city']) ) {
         $uerror['user_city'] = $BL['user_city_empty'];
      }
   
   }
   
   $fe_reg = array();   
   
   if($fe_action == '{FE_USER_REGISTER}') {


      $fe_reg[] = $BL['be_profile_registration_text'];
      
   } else {
   
      $fe_reg[] = $BL['be_profile_form_check'] ;
   
   }

   // render the registration form...
   
   $fe_reg[] = '<form action="' .$_uri. '" method="post">';
   
   // Fieldset 1 -> login basics
   $fe_reg[] = '<fieldset>';
   $fe_reg[] = '<legend>'.$BL["login_text"].'</legend>';
   
   $fe_reg[] = is_uerror('user_login');
   $fe_reg[] = '<p>';
   $fe_reg[] = '<label class="labelpos" for="user_login">'.$BL["login_username"].'</label><br />';
   if($fe_action == '{FE_USER_REGISTER}') {
      $fe_reg[] = '<input type="text" name="user_login" id="user_login" value="' .html_specialchars($udata['user_login']). '" class="textfield" maxlength="200" size="25" />';
   } else {
      $fe_reg[] = '<strong>' .html_specialchars($udata['user_login']). '</strong>';
      $fe_reg[] = '<input type="hidden" name="user_login" value="' .html_specialchars($udata['user_login']). '" />';
   }
   $fe_reg[] = '</p>';

   $fe_reg[] = is_uerror('user_password');
   $fe_reg[] = '<p>';
   $fe_reg[] = '<label class="labelpos" for="user_password">'.$BL["login_userpass"].'</label><br />';
   $fe_reg[] = '<input type="password" name="user_password" id="user_password" class="textfield" maxlength="20" size="25" />';
   $fe_reg[] = '</p>';

   $fe_reg[] = '<p>';
   $fe_reg[] = '<label class="labelpos" for="user_password2">'.$BL["login_userpass_repeat"].'</label><br />';
   $fe_reg[] = '<input type="password" name="user_password2" id="user_password2" class="textfield" maxlength="20" size="25" />';
   $fe_reg[] = '</p>';
   $fe_reg[] = '</fieldset>';
   
   //$fe_reg[] = '<fieldset>';
   //$fe_reg[] = '<legend>'. $BL['be_profile_data_title'].' </legend>';
   //$fe_reg[] = $BL['be_profile_data_text'];
   
   //$fe_reg[] = is_uerror('user_company');
   //$fe_reg[] = '<p>';
   //$fe_reg[] = '<label class="labelpos" for="user_company">'.$BL['be_profile_label_company'].'</label><br />';
   //$fe_reg[] = '<input type="text" name="user_company" id="user_company" value="' .html_specialchars($udata['user_company']). '" class="textfield" maxlength="200" size="25" />';
   //$fe_reg[] = '</p>';
   
   //$fe_reg[] = '<p>';
   //$fe_reg[] = '<label class="labelpos">'.$BL['be_profile_label_title'].'</label>';
   
   //foreach($user_title as $key => $value) {
   //   $fe_reg['title'.$key]  = '<input type="radio" name="user_title" id="title'.$key.'" value="' ;
   //   $fe_reg['title'.$key] .= html_specialchars($value) . '"'.is_checked($value, $udata['user_title'], 1, 0).' />';
   //   if($value) {
   //      $fe_reg['title'.$key] .= '<label class="inline" for="title'.$key.'">' . html_specialchars($value) . '</label><br />';
   //   } else {
   //      $fe_reg['title'.$key] .= '<label class="inline" for="title'.$key.'">Other</label><br />';
   //   }
   //}
   //$fe_reg[] = '</p>';

   //$fe_reg[] = is_uerror('user_firstname');
   //$fe_reg[] = '<p>';
   //$fe_reg[] = '<label class="labelpos" for="user_firstname">'.$BL['be_profile_label_firstname'].'</label><br />';
   //$fe_reg[] = '<input type="text" name="user_firstname" id="user_firstname" value="' .html_specialchars($udata['user_firstname']). '" class="textfield" maxlength="200" size="25" />';
   //$fe_reg[] = '</p>';

   //$fe_reg[] = is_uerror('user_name');
   //$fe_reg[] = '<p>';
   //$fe_reg[] = '<label class="labelpos" for="user_name">'.$BL['be_profile_label_name'].'</label><br />';
   //$fe_reg[] = '<input type="text" name="user_name" id="user_name" value="' .html_specialchars($udata['user_name']). '" class="textfield" maxlength="200" size="25" />';
   //$fe_reg[] = '</p>';
   
   //$fe_reg[] = is_uerror('user_street');
   //$fe_reg[] = '<p>';
   //$fe_reg[] = '<label class="labelpos" for="user_street">'.$BL['be_profile_label_street'].'</label><br />';
   //$fe_reg[] = '<input type="text" name="user_street" id="user_street" value="' .html_specialchars($udata['user_street']). '" class="textfield" maxlength="200" size="25" />';
   //$fe_reg[] = '</p>';
   
   
   //$fe_reg[] = is_uerror('user_city');
   //$fe_reg[] = '<p>';
   //$fe_reg[] = '<label class="labelpos">'.$BL['be_profile_label_city'].'</label><br />';
   //$fe_reg[] = '<input type="text" name="user_city" id="user_city" value="' .html_specialchars($udata['user_city']). '" class="textfield_city" maxlength="200" size="25" />';
   //$fe_reg[] = '</p>';

   //$fe_reg[] = is_uerror('user_zip');
   //$fe_reg[] = '<p>';
   //$fe_reg[] = '<label class="labelpos">'.$BL['be_profile_label_zip'].'</label><br />';
   //$fe_reg[] = '<input type="text" name="user_zip" id="user_zip" value="' .html_specialchars($udata['user_zip']). '" class="textfield_zip" maxlength="5" size="5" />';
   //$fe_reg[] = '</p>';

   //$fe_reg[] = '</fieldset>';
   
   $fe_reg[] = '<fieldset>';
   $fe_reg[] = '<legend> '.$BL['be_profile_data_contact'].'</legend>';

   //$fe_reg[] = is_uerror('user_tel');
   //$fe_reg[] = '<p>';
   //$fe_reg[] = '<label class="labelpos" for="user_tel">'.$BL['be_profile_label_phone'].'</label><br />';
   //$fe_reg[] = '<input type="text" name="user_tel" id="user_tel" value="' .html_specialchars($udata['user_tel']). '" class="textfield" maxlength="200" size="25" />';
   //$fe_reg[] = '</p>';   
   
   $fe_reg[] = is_uerror('user_email');
   $fe_reg[] = '<p>';
   $fe_reg[] = '<label class="labelpos" for="user_email">'.$BL['be_profile_label_email'].'</label><br />';
   $fe_reg[] = '<input type="text" name="user_email" id="user_email" value="' .html_specialchars($udata['user_email']). '" class="textfield" maxlength="200" size="25" />';
   $fe_reg[] = '</p>';   
   $fe_reg[] = '</fieldset>';


   //  disable part of the profile survey form
   /*
   if($fe_action == '{FE_USER_REGISTER}') {


      $fe_reg[] = '<fieldset class="profile">';
      $fe_reg[] = '<legend> Infos zu HP ProCurve </legend>';

      //$fe_reg[] = is_uerror('user_profile_1');
      $fe_reg[] = '';
      $fe_reg[] = '<p class="title">Vertreiben Sie bereits HP ProCurve L&ouml;sungen?</p>';
      $fe_reg[] = '<label class="inline">' .
               '<input type="radio" name="user_profile_1" value="1"'.is_checked(1, $udata['user_profile_1'], 1, 0).' />' .
               'Ja</label>';
      $fe_reg[] = '<label class="inline">' .
               '<input type="radio" name="user_profile_1" value="0"'.is_checked(0, $udata['user_profile_1'], 1, 0).' />' .
               'Nein</label>';
      $fe_reg[] = '';
      
      //$fe_reg[] = is_uerror('user_profile_2');
      $fe_reg[] = '<p>';
      $fe_reg[] = '<p class="title">Wenn Ja, welche?</p>';
      $fe_reg[] = '<label class="inline">' .
               '<input type="radio" name="user_profile_2" value="SMB"'.is_checked('SMB', $udata['user_profile_2'], 1, 0).' />' .
               'SMB</label>';
      $fe_reg[] = '<label class="inline">' .
               '<input type="radio" name="user_profile_2" value="Enterprise"'.is_checked('Enterprise', $udata['user_profile_2'], 1, 0).' />' .
               'Enterprise</label>';
      $fe_reg[] = '<label class="inline">' .
               '<input type="radio" name="user_profile_2" value="Beides"'.is_checked('Beides', $udata['user_profile_2'], 1, 0).' />' .
               'Beides</label>';
      $fe_reg[] = '</p>';
      
      //$fe_reg[] = is_uerror('user_profile_3');
      $fe_reg[] = '<p>';
      $fe_reg[] = '<p class="title">Wenn Nein, Welche Networking L&ouml;sungen vertreiben Sie?</p>';
      $fe_reg[] = '<label class="inline">' .
               '<input type="checkbox" name="user_profile_3[cisco]" value="Cisco"'.is_checked(1, isset($udata['user_profile_3']['cisco']) ? 1 : 0 , 1, 0).' />' .
               'Cisco</label>';
      $fe_reg[] = '<label class="inline">' .
               '<input type="checkbox" name="user_profile_3[nortel]" value="Nortel"'.is_checked(1, isset($udata['user_profile_3']['nortel']) ? 1 : 0 , 1, 0).' />' .
               'Nortel</label>';
      $fe_reg[] = '<label class="inline">' .
               '<input type="checkbox" name="user_profile_3[keine]" value="Keine"'.is_checked(1, isset($udata['user_profile_3']['keine']) ? 1 : 0 , 1, 0).' />' .
               'Keine</label>';
      $fe_reg[] = '<label class="inline">' .
               '<input type="checkbox" name="user_profile_3[andere]" value="Andere"'.is_checked(1, isset($udata['user_profile_3']['andere']) ? 1 : 0 , 1, 0).' />' .
               'Andere</label> <input type="text" name="user_profile_3[andere_text]" value="' .
               (isset($udata['user_profile_3']['andere_text']) ? html_specialchars($udata['user_profile_3']['andere_text']) : '') .
               '" size="15" maxlength="100" class="textfield inline" />';
   
      $fe_reg[] = '</p>';
      
      
      
      $fe_reg[] = '<p>';
      $fe_reg[] = '<p class="title">Vertreiben Sie andere Technologien von HP?</p>';
      $fe_reg[] = 'Ja &#8211; <label class="inline">' .
               '<input type="checkbox" name="user_profile_4[server]" value="Server"'.is_checked(1, isset($udata['user_profile_4']['server']) ? 1 : 0 , 1, 0).' />' .
               'Server</label>';
      $fe_reg[] = '<label class="inline">' .
               '<input type="checkbox" name="user_profile_4[storage]" value="Storage"'.is_checked(1, isset($udata['user_profile_4']['storage']) ? 1 : 0 , 1, 0).' />' .
               'Storage</label>';
      $fe_reg[] = '<label class="inline">' .
               '<input type="checkbox" name="user_profile_4[software]" value="Software"'.is_checked(1, isset($udata['user_profile_4']['software']) ? 1 : 0 , 1, 0).' />' .
               'Software</label>';
      $fe_reg[] = '<label class="inline">' .
               '<input type="checkbox" name="user_profile_4[andere]" value="Andere"'.is_checked(1, isset($udata['user_profile_4']['andere']) ? 1 : 0 , 1, 0).' />' .
               'Andere</label> <input type="text" name="user_profile_4[andere_text]" value="' .
               (isset($udata['user_profile_4']['andere_text']) ? html_specialchars($udata['user_profile_4']['andere_text']) : '') .
               '" size="15" maxlength="100" class="textfield inline" />';
   
      $fe_reg[] = '</p>';
      
      $fe_reg[] = '</fieldset>';
   
   
      $fe_reg[] = '<fieldset class="profile">';
      $fe_reg[] = '<legend> Infos zum Partnerstatus </legend>';
   
      $fe_reg[] = '';
      $fe_reg[] = '<p class="title">Sind Sie bereits HP Vertriebspartner?</p>';
      $fe_reg[] = '<label class="inline">' .
               '<input type="radio" name="user_profile_5" value="1"'.is_checked(1, $udata['user_profile_5'], 1, 0).' />' .
               'Ja</label>';
      $fe_reg[] = '<label class="inline">' .
               '<input type="radio" name="user_profile_5" value="0"'.is_checked(0, $udata['user_profile_5'], 1, 0).' />' .
               'Nein</label>';
      $fe_reg[] = '';
      
      $fe_reg[] = '<p>';
      $fe_reg[] = 'Wenn Ja, welcher Status';
      $fe_reg[] = '<input type="text" name="user_profile_6" value="' . html_specialchars($udata['user_profile_6']) . '" size="15" maxlength="150" class="textfield inline" />';
      $fe_reg[] = '</p>';
      
      $fe_reg[] = '</fieldset>';
   
   }
*/


// include this part of the profile survey form
   
      $fe_reg[] = '<fieldset class="profile_info">';
      $fe_reg[] = '<legend>'.$BL['be_newsletter_title'].'</legend>';
   


   //  disable part of the profile survey form
   /*
   if($fe_action == '{FE_USER_REGISTER}') {
      
      $fe_reg[] = '<p>';
      $fe_reg[] = '<label class="inline">' .
               '<input type="checkbox" name="user_profile_7[0]" value="1"'.is_checked(1, empty($udata['user_profile_7'][0]) ? 0 : 1 , 1, 0).' />' .
               'Ich wünsche Informationen zu den HP ProCurve Lösungen.</label>';
      $fe_reg[] = '</p>';
   
      $fe_reg[] = '<p>';            
      $fe_reg[] = '<label class="inline">' .
               '<input type="checkbox" name="user_profile_7[1]" value="1"'.is_checked(1, empty($udata['user_profile_7'][1]) ? 0 : 1 , 1, 0).' />' .
               'Ich wünsche Informationen zu den Azlan Services für den Vertrieb von HP ProCurve Lösungen.</label>';
      $fe_reg[] = '</p>';
   
      $fe_reg[] = '<p>';            
      $fe_reg[] = '<label class="inline">' .
               '<input type="checkbox" name="user_profile_7[2]" value="1"'.is_checked(1, empty($udata['user_profile_7'][2]) ? 0 : 1 , 1, 0).' />' .
               'Ich habe noch Fragen zu</label> '.
               '<input type="text" name="user_profile_8" value="' . html_specialchars($udata['user_profile_8']) . '" size="15" maxlength="200" class="textfield inline" />';
      $fe_reg[] = '</p>';
      
   }
   */
   
// include this part of the profile survey form

      $fe_reg[] = '<p>';
      $fe_reg[] = '<label class="inline">' .
               '<input type="checkbox" name="user_profile_7[3]" value="1"'.is_checked(1, empty($udata['user_profile_7'][3]) ? 0 : 1 , 1, 0).' />' .
               $BL['be_profile_text_newsletter'].'</label>';
      $fe_reg[] = '</p>';
   
   
   if($fe_action == '{FE_USER_REGISTER}') {
   
      $fe_reg[] = '<p>';   
      $fe_reg[] = '<label class="inline">' .
               '<input type="checkbox" name="user_profile_7[4]" value="1"'.is_checked(1, empty($udata['user_profile_7'][4]) ? 0 : 1 , 1, 0).' />' .
               '<strong>'.$BL['user_registration_partner_request'].'</strong></label>';
      $fe_reg[] = '</p>';
   
   }

   

      $fe_reg[] = '</fieldset>';
   
   
   //  disable part of the profile survey form
   /*
   if($fe_action == '{FE_USER_REGISTER}') {

   
      $fe_reg[] = '<fieldset class="profile_info">';
      $fe_reg[] = '<legend> Weitere Angaben </legend>';
   
      $fe_reg[] = '<p class="title">';
      $fe_reg[] = 'Wie lässt sich Ihr Geschäftsbereich am besten beschreiben?';
      $fe_reg[] = '</p>';
   
      $fe_reg[] = '<p>';
      $fe_reg[] = '<label class="inline">' .
               '<input type="radio" name="user_profile_9" value="Systemhaus"'.is_checked('Systemhaus', $udata['user_profile_9'], 1, 0).' />' .
               'Systemhaus</label>';
      $fe_reg[] = '</p>';
      
      $fe_reg[] = '<p>';
      $fe_reg[] = '<label class="inline">' .
               '<input type="radio" name="user_profile_9" value="Value Added Reseller"'.is_checked('Value Added Reseller', $udata['user_profile_9'], 1, 0).' />' .
               'Value Added Reseller</label>';
      $fe_reg[] = '</p>';
      
      $fe_reg[] = '<p>';
      $fe_reg[] = '<label class="inline">' .
               '<input type="radio" name="user_profile_9" value="Reseller"'.is_checked('Reseller', $udata['user_profile_9'], 1, 0).' />' .
               'Reseller</label>';
      $fe_reg[] = '</p>';
   
      $fe_reg[] = '<p>';
      $fe_reg[] = '<label class="inline">' .
               '<input type="radio" name="user_profile_9" value="Anderes"'.is_checked('Anderes', $udata['user_profile_9'], 1, 0).' />' .
               'Anderes</label> <input type="text" name="user_profile_10" value="' . html_specialchars($udata['user_profile_10']) .
               '" size="15" maxlength="200" class="textfield inline" />';
      $fe_reg[] = '</p>';
      
   
      $fe_reg[] = '<p class="title">';
      $fe_reg[] = 'Wieviele Mitarbeiter beschäftigt Ihr Unternehmen?';
      $fe_reg[] = '</p>';
   
      foreach(array('weniger als 15', '15 - 49', '50 – 149', '150 – 499', '500 – 999', 'mehr als 1.000') as $value) {
      
         $fe_reg[] = '<p>';
         $fe_reg[] = '<label class="inline">' .
                  '<input type="radio" name="user_profile_11" value="'.$value.'"'.is_checked($value, $udata['user_profile_11'], 1, 0).' />' . $value .'</label>';
         $fe_reg[] = '</p>';
      
      }
      
      
      $fe_reg[] = '<p class="title">';
      $fe_reg[] = 'In welchen Branchen sind Ihre Kunden hauptsächlich tätig?';
      $fe_reg[] = '</p>';
   
      $fe_reg[] = '<p>';
      foreach(array(   'Automotive', 'Banken & Versicherungen', 'Energie',
                  'ITK', 'Großhandel', 'Einzelhandel', 'Fertigung',
                  'Gesundheit', 'Medien', 'Öffentliche Einrichtungen',
                  'Transport/Logistik', 'Dienstleistungen', 'Sonstiges') as $key => $value) {
      
         $fe_reg[] = '<label class="column" style="float:left;width:200px;">' .
                  '<input type="checkbox" name="user_profile_12['.$key.']" value="'.html_specialchars($value).'"' .
                  is_checked(1, isset($udata['user_profile_12'][$key]) ? 1 : 0, 1, 0) .' />' .
                  html_specialchars($value) .'</label>';
      
      }
      $fe_reg[] = '</p>';
   
      $fe_reg[] = '<div style="clear:both"></div><p class="title">';
      $fe_reg[] = 'Wer sind Ihre Kunden vorwiegend?';
      $fe_reg[] = '</p>';
      
      $fe_reg[] = '<p>';
      $fe_reg[] = '<label class="inline">' .
               '<input type="radio" name="user_profile_13" value="+500"'.is_checked('+500', $udata['user_profile_13'], 1, 0).' />' .
               'Gro&szlig;unternehmen (> 500 MA)</label>';
      $fe_reg[] = '</p>';
      
      $fe_reg[] = '<p>';
      $fe_reg[] = '<label class="inline">' .
               '<input type="radio" name="user_profile_13" value="-500"'.is_checked('-500', $udata['user_profile_13'], 1, 0).' />' .
               'Mittelstand (< 500 MA)</label>';
      $fe_reg[] = '</p>';
      
      $fe_reg[] = '<p>';
      $fe_reg[] = '<label class="inline">' .
               '<input type="radio" name="user_profile_13" value="-20"'.is_checked('-20', $udata['user_profile_13'], 1, 0).' />' .
               'Kleinunternehmen (< 20 MA)</label>';
      $fe_reg[] = '</p>';
   
      $fe_reg[] = '<p>';
      $fe_reg[] = '<label class="inline">' .
               '<input type="radio" name="user_profile_13" value="Andere"'.is_checked('Andere', $udata['user_profile_13'], 1, 0).' />' .
               'Andere</label> <input type="text" name="user_profile_14" value="' . html_specialchars($udata['user_profile_14']) .
               '" size="15" maxlength="200" class="textfield inline" />';
      $fe_reg[] = '</p>';
   
   
      $fe_reg[] = '</fieldset>';

   }

   */



// include this part of the profile survey form

   $fe_reg[] = '<p>';
   $fe_reg[] = '<input type="submit" value="'.$BL['be_cnt_formsave_profile'].'" class="button" />';
   $fe_reg[] = '</p>';




   $fe_reg[] = '</form>';

   $fe_reg = implode(LF, $fe_reg);
   
   
   if(isset($_POST['user_login']) && $fe_action == '{FE_USER_REGISTER}') {
      if($uerror['status']) {
      
         $fe_reg = '<p class="error">'.$BL['be_profile_form_errors'].'</p>' . LF . $fe_reg;
      
      } else {
      
         // initialize the geocoding...
         require_once( './maxmind/locate.inc.php');
         $record = Array();
         $remoteAddr = getRemoteIP();
                     
         $yahooWeatherCode = "xml.weather.yahoo.com/forecastrss?p=".LogEntry($remoteAddr, $record)."&u=f";

            
         //TODO: alter following line after testing
         $profile_aktiv = 1; // autoactivate, default should be enabled after alpha testing:$sql .= "'0', ";

         $profile_data = $udata;
         unset($profile_data['user_password'], $profile_data['user_password2']);
      
         // create entry (account) in phpwcms_user table then add
         // $udata to phpwcms_userdetail, which is the personal info table...
         // phpwcms_userdetail.detail_pid is the forign key to phpwcms_user.usr_id

          $sql  = 'INSERT INTO '.DB_PREPEND.'phpwcms_user (';
         $sql .= 'usr_login, usr_pass, usr_email, usr_rechte, usr_admin, usr_aktiv, ';
         $sql .= 'usr_name, usr_lang, usr_wysiwyg, usr_fe ) VALUES (';
         
         $sql .= "'" . aporeplace($udata['user_login']) . "', ";
         $sql .= "'" . aporeplace(md5($udata['user_password'])) . "', ";
         $sql .= "'" . aporeplace(strtolower($udata['user_email'])) . "', ";
         $sql .= "'0', ";
         $sql .= "'0', ";
         $sql .= "'".$profile_aktiv."', ";
         $sql .= "'" . aporeplace($udata['user_name']) . "', ";
         $sql .= "'en', ";
         $sql .= "'2', ";
         $sql .= "'0' ); ";
         $queryResult = _dbQuery($sql, 'INSERT');

         if(!empty($queryResult['INSERT_ID'])) {
         

            $sql  = 'INSERT INTO '.DB_PREPEND.'phpwcms_userdetail (';
            $sql .= 'detail_pid, detail_title, detail_firstname, detail_lastname, detail_company, detail_street, detail_city, detail_zip , ';
            $sql .= 'detail_fon, detail_notes, detail_aktiv, detail_newsletter, detail_varchar1, detail_email, detail_login, detail_password  ) VALUES (';
            $sql .= "'" . $queryResult['INSERT_ID'] . "', ";
            $sql .= "'" . aporeplace($udata['user_title']) . "', ";
            $sql .= "'" . aporeplace($udata['user_firstname']) . "', ";
            $sql .= "'" . aporeplace($udata['user_name']) . "', ";
            $sql .= "'" . aporeplace($udata['user_company']) . "', ";
            $sql .= "'" . aporeplace($udata['user_street']) . "', ";
            $sql .= "'" . aporeplace($record['City']) . "', ";
            
            //$sql .= "'" . aporeplace($udata['user_city']) . "', ";

            $sql .= "'" . aporeplace($record['Zip']) . "', ";
            //$sql .= "'" . aporeplace($udata['user_zip']) . "', ";

            $sql .= "'" . aporeplace($udata['user_tel']) . "', ";
            $sql .= "'" . aporeplace(serialize($profile_data)) . "', ";
            
            $sql .= "'".$profile_aktiv."', ";
            
            $sql .= "'" . ( empty($udata['user_profile_7'][3]) ? '' : 1 ) . "', "; //detail_newsletter
            $sql .= "'".$phpwcms['organization']."', ";                        //detail_varchar1  wtf?  seems to be a domain or group   
            $sql .= "'" . aporeplace(strtolower($udata['user_email'])) . "', ";
            $sql .= "'" . aporeplace($udata['user_login']) . "', ";
            $sql .= "'" . aporeplace(md5($udata['user_password'])) ."' ); ";
               
            $queryResult = _dbQuery($sql, 'INSERT');



            if(!empty($queryResult['INSERT_ID'])) {

               $fe_reg  = '<p class="success">'.$BL['user_registration_data_success1_comment'].' '.html_specialchars($udata['user_firstname'].' '.$udata['user_name']).'! '.$BL['user_registration_data_success2_comment'].'</p>';
               $fe_reg .= '<p>'.$BL['user_registration_data_sent1_comment'].'<b>'.html_specialchars($udata['user_email']).'</b>'.$BL['user_registration_data_sent2_comment'].'</p>';
               
               $fe_text  = $BL['user_registration_hello_label'].trim($udata['user_title'] . ' ' . trim( $udata['user_firstname'].' '.$udata['user_name']) ) . LF . LF;
               $fe_text .= $BL['user_registration_data_recieved_comment'] . LF;
               $fe_text .= $BL['user_registration_data_review_comment'] . LF . LF;
               
               if(empty($udata['user_profile_7'][4])) {
                  $fe_text .= $BL['user_registration_partner_backend_declined'] .LF . $BL['user_registration_data_statement_stored'] . LF;
               } else {
                  $fe_text .= $BL['user_registration_partner_backend_requested'] .LF . $BL['user_registration_data_statement_submitted'] . LF;
               }
               $fe_text .= '  '.$BL['be_profile_label_username'].':    ' . $udata['user_login'] . LF;
               $fe_text .= '  '.$BL["login_userpass"].': ' . $udata['user_password'] . LF . LF;
               $fe_text .= $BL['user_password_dbfailure'] . LF . LF . LF;
               $fe_text .= $BL['user_registration_greeting'] . LF;
               $fe_text .= $phpwcms['organization'] . LF;
               
               $fe_text1  = $BL['user_new_profile_registration'].' @ '.$phpwcms['organization'] . LF;
               $fe_text1 .= '-----------------------------------------------------------' . LF . LF;
               
               $fe_text1 .= $BL['user_profile_visibility'] . LF;
               
               if(!empty($udata['user_profile_7'][4])) {
                  $fe_text1 .=  $BL['user_profile_partnering'].LF;
                  $fe_text1 .= '  '.$BL['be_profile_label_username'].':    ' . $udata['user_login'] . LF;
               }
               
               $fe_text1 .= LF;
               $fe_text1 .= $BL['user_data_label'] .':' . LF;
               $fe_text1 .= '================' . LF . LF;
               
               $fe_text1 .= $BL['be_profile_label_company'].':   ' . $udata['user_company'] . LF;
               $fe_text1 .= $BL['be_profile_label_title'].':  ' . $udata['user_title'] . LF;
               $fe_text1 .= $BL['be_profile_label_firstname'].': ' . $udata['user_firstname'] . LF;
               $fe_text1 .= $BL['be_profile_label_name'].':    ' . $udata['user_name'] . LF;
               $fe_text1 .= $BL['be_profile_label_street'].':  ' . $udata['user_street'] . LF;
               $fe_text1 .= $BL['be_profile_label_zip'].':     ' . $udata['user_zip'] . LF;
               $fe_text1 .= $BL['be_profile_label_city'].':     ' . $udata['user_city'] . LF;
               $fe_text1 .= $BL['be_profile_label_phone'].': ' . $udata['user_tel'] . LF;
               $fe_text1 .= $BL['be_profile_label_email'].':  ' . $udata['user_email'] . LF;
      
               $fe_text1 .= LF . '-----------------------------------------------------------' . LF;
               $fe_text1 .= 'IP: '. getRemoteIP();
               
               $fe_csv_attach  = implode(';', array_keys($fe_csv) );
               $fe_csv_attach .= LF;
               $fe_csv_attach .= implode(';', $fe_csv );
               
               $fe_csv = array();
               
               $fe_csv['filename']   = date('Y-m-d_H-i-s') . '_' . preg_replace('/[^a-zA-Z0-9\-_]/', '', $udata['user_login']).'.csv';
               $fe_csv['mime']      = 'text/csv';
               $fe_csv['data']      = $fe_csv_attach;

               //TODO: Fix after testing
               // send email to user that just registered
               sendEmail(array(
                  'recipient'      => strtolower($udata['user_email']),
                  'toName'      => trim($udata['user_firstname'].' '.$udata['user_name']),
                  'subject'      => $BL['be_new_member_registration'],
                  'text'         => $fe_text,
                  'from'         => 'someemail@somehost.com',
                  'fromName'      => 'From Name,
                  'sender'      => 'someemail@somehost.com' ));
                  
               //TODO: Fix after testing
               // send email to site administrator that a new user has just registered
               sendEmail(array(
                  'recipient'      => 'someemail@somehost.com',
                  'subject'      => $BL['be_new_member_registration'],
                  'text'         => $fe_text1,
                  'from'         => strtolower($udata['user_email']),
                  'fromName'      => trim($udata['user_firstname'].' '.$udata['user_name']),
                  'sender'      => strtolower($udata['user_email']),
                  'stringAttach'   => array($fe_csv) ));
               
               
            } else {
			
				
               // swap out these lines to suppress display of sql string on database insertion error
               $fe_reg = '<p class="error">'.$BL['user_registration_data_failure'].'<br />'.$sql.'</p>' . LF . $fe_reg;
               //$fe_reg = '<p class="error">'.$BL['user_registration_data_failure'].'</p>' . LF . $fe_reg;
               
            }
         
         }else {
               
               // swap out these lines to suppress display of sql string on database insertion error
               $fe_reg = '<p class="error">'.$BL['user_registration_data_failure'].'<br />'.$sql.'</p>' . LF . $fe_reg;
               //$fe_reg = '<p class="error">'.$BL['user_registration_data_failure'].'</p>' . LF . $fe_reg;
               
         }
      }
   }
   
   if(isset($_POST['user_login']) && $fe_action == '{FE_USER_MANAGE}') {
   
      if($uerror['status']) {
      
         $fe_reg = '<p class="error">'.$BL['be_profile_form_errors'].'</p>' . LF . $fe_reg;
      
      } else {
      
         $profile_data = $udata;
         unset($profile_data['user_password'], $profile_data['user_password2']);

         
         $sql  = 'UPDATE '.DB_PREPEND.'phpwcms_userdetail SET ';
         $sql .= "detail_title      = '".aporeplace($udata['user_title'])."', ";
         $sql .= "detail_firstname   = '".aporeplace($udata['user_firstname'])."', ";
         $sql .= "detail_lastname   = '".aporeplace($udata['user_name'])."', ";
         $sql .= "detail_company      = '".aporeplace($udata['user_company'])."', ";
         $sql .= "detail_street      = '".aporeplace($udata['user_street'])."', ";
         $sql .= "detail_city      = '".aporeplace($udata['user_city'])."', ";
         $sql .= "detail_zip         = '".aporeplace($udata['user_zip'])."', ";
         $sql .= "detail_fon         = '".aporeplace($udata['user_tel'])."', ";
         $sql .= "detail_notes      = '".aporeplace(serialize($profile_data))."', ";
         $sql .= "detail_newsletter   = '".( empty($udata['user_profile_7'][3]) ? '' : 1 )."', ";
         
         
         
         
         
         if($udata['user_password']) {
            $sql .= "detail_password   = '".aporeplace(md5($udata['user_password']))."', ";
         }
         $sql .= "detail_email      = '".aporeplace(strtolower($udata['user_email']))."' ";
         $sql .= 'WHERE detail_id=' . intval($_SESSION[ $_loginData['session_key'].'_userdata']['id']).' LIMIT 1';
         
         $queryResult = _dbQuery($sql, 'UPDATE');
         if(isset($queryResult['AFFECTED_ROWS'])) {
      
            $fe_reg = "<p>".$BL['be_profile_update_success']."</p>" . LF . $fe_reg;
      
         } else {
         
            $fe_reg = "<p class='error'>".$BL['be_profile_update_error']."</p>" . LF . $fe_reg;
         
         }
      
      }
   
   }

   $content['all'] = str_replace($fe_action, $fe_reg, $content['all']);

} else {

   $content['all'] = str_replace('{FE_USER_MANAGE}', '<p class="error">'.$BL['be_profile_update_deny'].'</p>', $content['all']);

}

function is_uerror($field='') {
   global $uerror;
   if(!empty($uerror[$field])) {
      $uerror['status'] = true;
      return '<p class="error">' . $uerror[$field] . '</p>';
   }
   return '';
}


?>

here's the log of other changes I made as well:

Code: Select all

//Changes required:

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// fe_user.php modification for generic front end user registration without an elaborate signup survey.
// note: example code for a survey (Oliver's original) is retained in comments.
//
// this file lives on the web server path /htdocs/domain_name/template/nc_script/frontend_render/fe_user.php
//
// the main modifications consisted of disabling non-generic components of the registration survey form
// and changes to support multiple languages.



//
// Added a Check to configure what language we're using -- There must be a built-in fuction for this but I haven't looked for it.
// Added a include to get the language file we're using
// Added section to create account entry in phpwcms_user and then also created subordinate entry in phpwcms_userdetail linking 
// the two records by setting phpwcms_userdetail.pid to value of phpwcms_user.usr_id;
//
//TODO: switch for language...
// currently I'm doing this which supports my purposes
//	switch($language){
//		case 'de': $user_title = array('Herr', 'Frau', ''); break;
//		case 'en': $user_title = array('Mr',   'Mrs', ''); break;
//		case 'tr': $user_title = array('Herr', 'Frau', ''); break;
//		  default: $user_title = array('Mr',   'Mrs', ''); break;
//	}
// when it should be incorporated into the language file.


// the following where added to the language files located on the web server path /htdocs/domain_name/include/inc_lang/backend/{your language}/lang.inc.php
// where in my case {your language} was english (en).
//
// I suppose there should really be a language file for the front end's use,... but I'm lazy and I leveraged some of the backend variable (labels) related to the user's profile in my changes to fe_user.php.
/*

$BL["login_userpass_repeat"]            		= 'password repeat';
$BL['be_profile_registration_text']     		= 'Register your membership today!';
$BL['be_profile_update_deny']				= 'Backend users must <a href="login.php">log into the backend</a> to modify their profile...';
$BL['user_login_empty']					= 'Login must be filled out';
$BL['user_login_len']					= 'Login must be at least 4 characters long';
$BL['user_login_assigned']				= 'This Login is already assigned';
$BL['user_password_empty']				= 'Password must be filled out';
$BL['user_password_nomatch']				= 'Passwords do not match...';
$BL['user_password_len']				= 'Password must be at least 4 characters long';
$BL['user_email_empty']					= 'Email must filled out';
$BL['user_email_invalid']				= 'Email must be valid';
$BL['user_email_registered']				= 'Email already registered';
$BL['user_tel_empty']					= 'Telephone must be filled out';
$BL['user_tel_invalid']					= 'Telephone number may contain only numbers, blank, clips, + or - characters';
$BL['user_name_empty']					= 'Name must be filled out';
$BL['user_firstname_empty']				= 'First Name must be filled out';
$BL['user_company_empty']				= 'Company must be filled out';
$BL['user_street_empty']				= 'Street must be filled out';
$BL['user_zip_empty']					= 'Postal code must be filled out';
$BL['user_city_empty']					= 'City must be filled out';

$BL['user_data_label'] 					= 'User data';
$BL['user_profile_visibility']          		= 'User is visible in the administration area of the site.';
$BL['user_profile_partnering']          		= 'The user declines the newsletter registration!';  //? newsletter? assume for testing
$BL['user_new_profile_registration']    		= 'New user registration.';
$BL['user_password_dbfailure']				= 'Their password was not put down reproduizierbar coded in our system.';
$BL['user_registration_greeting']			= 'Welcome';
$BL['user_registration_data_statement_stored'] 		= 'However, we stored the following registration data on your behalf:';
$BL['user_registration_data_statement_submitted']	= 'The following registration data submitted on your behalf:';
$BL['user_registration_data_review_comment'] 		= 'We will examine your registration request and respond regarding the status of your account within the next 24 hours...';
$BL['user_registration_data_recieved_comment']		= 'We received their registration.';
$BL['user_registration_data_success1_comment']		= 'Vielen Dank ';
$BL['user_registration_data_success2_comment']		= 'Your verification message was processed and their account was activated!';
$BL['user_registration_data_failure'] 			= 'An error occured while processing your submission, please try submitting the form again or notify the webmaster.';

$BL['user_registration_data_sent1_comment']		= 'A account verification message was sent to your E-Mail at:  ';
$BL['user_registration_data_sent2_comment']		= '.';
$BL['user_registration_partner_backend_requested'] 	= 'They would like to collaborate with us on content development or site management.';
$BL['user_registration_partner_backend_declined'] 	= 'They declined to collaborate with us on content development or site management.';
$BL['user_registration_hello_label'] 			= 'Hello ';
$BL['user_registration_partner_request']		= 'I like a login to collaborate with this web site\'s content development and management.';




// the follow was added to /htdocs/domain_name/config/phpwcms/conf.inc.php
$phpwcms['organization']='Your Company/Organization';  

// the following was added to /htdocs/domain_name/template/inc_css/frontend.css

.error {
    color: red;
    border:1px solid red;

}




*/

rushclub
Posts: 915
Joined: Tue 17. Feb 2004, 18:52

Re: FE User and User/Group Rights-Management Development

Post by rushclub »

thanks for your answer ;)
will try that.

cheers
rush
3 (!) Jahre warten reichen mir. Ich bin erst mal weg.
nebenaube
Posts: 139
Joined: Fri 23. Nov 2007, 20:39
Location: Redlands, CA
Contact:

Re: FE User and User/Group Rights-Management Development

Post by nebenaube »

I'm quite familiar with how users and groups work in windows and in Unix. Was the goal in phpwcms to have admin created and administered groups that back-end users could be assigned to or was the design intent more along the lines of allowing front-end users to create and/or join active groups (such as in a social networking scenario)?

If the latter is the case:
Then I suppose that there would be a everybody group (a given and by default all user belong to it) and every front-end user that registered would by default also create two user groups, i.e. one for friends and one for foes. If that is the case then there should be a group members table that is foreign-keyed to the user groups table and the user groups table should have a foreign key back to the users table.

Also it seems that group permissions would only really apply to articles and content parts while article_cats don't seem to need that level of control. Someone can correct me if I'm wrong.

So with the session knowing which usr_id is logged in and which usr_id the article/content_part belongs to; we'd need to check if the the article/content_part was visible and non-public and then check if the user belongs to a friendly group before rendering that article/content_part.

Admin/backend users would still need to be able to create/delete groups and assign/remove members.
Deactivating a user would also mean deactivating their friend and foe groups.

All users would need a way to:
Manage their groups, i.e. add or remove members.
Create/Remove (vs. disable) additional (public) groups.
Join or quit public groups.

What do you think?
Last edited by nebenaube on Thu 13. Nov 2008, 18:04, edited 1 time in total.
Post Reply