Re: FE User and User/Group Rights-Management Development
Posted: Tue 11. Nov 2008, 15:36
english bitte... or is this just the beginning of the Jensensen treatment? I wasn't coding for the general solution just towards it.
The phpwcms support forum will help to find answers to your questions. The small but strong community is here since more than 10 years.
https://forum.phpwcms.org/
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!
It seems offensive. You know, it's not like I have access to any design documents...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!
something like heurekaHimmelArschNZwirn
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
If truth's main objective is offensiveness - yes, then you are rightnebenaube wrote:It seems offensive
Code: Select all
//TODO: Fix after testing
$TestEmailAddress = "yours@whereever.whatever";
// send email to user that just registered
nebenaube wrote:...doesn't work straight out of the box yet..
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ö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ö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 – <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ß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 '';
}
?>
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.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
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ö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ö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 – <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ß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 '';
}
?>
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;
}
*/