Location: PHPKode > projects > phpCAMALEO > UserPnl.php
<?PHP
/***************************************************************************
 *	UserPnl.php
 *
 *	begin		: December 2005
 *	version		: 20 October 2006
 *	copyright	: (C) 2005,2006 grandolini.com
 *
 *	User preferences panel
 *
 ***************************************************************************/
include('Session.php');
include($_SESSION[common].'fun2inc/reload.inc');
include($_SESSION[common].'fun2inc/form_validation.inc');
#
if($USER_ID!='')
{
	include($_SERVER[DOCUMENT_ROOT].$_SESSION[misc][folder].'inc/user_fields.inc');
	if(!isset($_POST[submit]))
	{
		include($_SERVER[DOCUMENT_ROOT].$_SESSION[misc][folder].'inc/user_loaddata.inc');
		$_USR=user_loaddata($USER_ID);
		if($_USR[RRN]==0) { $feedback_str=BuildErrorString($error_msg[1024]); }
		else
		{
			$_POST[RRN]			=$_USR[RRN];
			$_POST[email]		=$_USR[email];
			$_POST[fname]		=$_USR[fname];
			$_POST[reg_date]	=$_USR[reg_date];
			$_POST[last_log_date]=$_USR[last_log_date];
			$_POST[last_log_ip]	=$_USR[last_log_ip];
			$_POST[visits]		=$_USR[visits];
			$_POST[privil]		=$_USR[privil];
			$val_bday_yy=substr($_USR[bday],0,4); $_POST[birth_yy]=array('0'=>$val_bday_yy,);
			$val_bday_mm=substr($_USR[bday],5,2); $_POST[birth_mm]=array('0'=>$val_bday_mm,);
			$val_bday_dd=substr($_USR[bday],8,2); $_POST[birth_dd]=array('0'=>$val_bday_dd,);
			$_POST[r_confemail]	=$_USR[conf_email];
			$_POST[team]		=$_USR[team];
			$_POST[user_tbl_mr]	=$_USR[tbl_max_rows];
			$_POST[user_team_desc]=$_USR[user_team_desc];
		}
	}
	#
	#	Get screen data
	#
	$UserRRN=$_POST[RRN];
	$email=$_POST[email];
	$fname=str_replace("\'","'",$_POST[fname]);
	$reg_data=$_POST[reg_date];
	$last_log_date=$_POST[last_log_date];
	$last_log_ip=$_POST[last_log_ip];
	$visits=$_POST[visits];
	$privil=$_POST[privil];
	$val_bday_dd=$_POST[birth_dd][0];
	$val_bday_mm=$_POST[birth_mm][0];
	$val_bday_yy=$_POST[birth_yy][0];	$_POST[bday]=$val_bday_yy.'-'.$val_bday_mm.'-'.$val_bday_dd;
	$conf_email=$_POST[r_confemail];
	$teamID=$_POST[team];
	$tblmr=$_POST[user_tbl_mr];
	$team=$_POST[user_team_desc];
	#
	#----------------------------
	if($_POST[submit]==B_SAVE)
	#----------------------------
	{
		$feedback=checks();
		if($feedback=='OKIDOKI')
		{
			include($_SERVER[DOCUMENT_ROOT].$_SESSION[misc][folder].'inc/user_amenddata.inc');
			user_amenddata($USER_ID);
			$pop='<script type="text/javascript">pop(\''.BuildConfirmString(2000).'\',\''.$_SERVER[PHP_SELF].'\');</script>';
		}
		else { list($feedback_str,$err_i)=explode('#@#',$feedback); }
	}
	$PageNr='userpnl';
	$_SESSION[PageNr]=strtolower($PageNr);
	$_SESSION[PageFile]=basename($_SERVER[PHP_SELF]);
	$_SESSION[ReturnPage]=basename($_SERVER[PHP_SELF]);
	include($_SESSION[skinf].'Layout.php');
}
else
{
	$_SESSION[rediraccess]=$_GET[rediraccess];
	reload('Access.php');
}
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function checks()
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{
	include($_SESSION[common].'db/Globals.inc');
	#
	if(!$_POST[fname] && !$_POST[email]) { $feedback=BuildErrorString($error_msg[1008]); return($feedback.'#@#1'); }
	$feedback=validate_email($_POST[email]);		if($feedback!='valid') { return($feedback.'#@#2'); }
	$feedback=validate_date($_POST[bday],'ymd');	if($feedback!='valid') { return($feedback.'#@#3'); }
	#
	return('OKIDOKI');
}
?>
Return current item: phpCAMALEO