Location: PHPKode > projects > phpCAMALEO > Access.php
<?php
/***************************************************************************
 *	Access.php
 *
 *	begin		: March 2005
 *	version		: 10 October 2006
 *	copyright	: (C) 2005,2006 grandolini.net
 *
 *	Access to the reserved area
 *
 ***************************************************************************/
$isForm=true;
include('Session.php');
include($_SESSION[common].'fun2inc/emailer.inc');
include($_SESSION[common].'fun2inc/form_validation.inc');
include($_SESSION[common].'fun2inc/form_errors.inc');
include($_SESSION[common].'fun2inc/get_port.inc');
include($_SERVER[DOCUMENT_ROOT].$_SESSION[misc][folder].'inc/user_access.inc');

global $submit,$user_ID,$passw_form,$email;

if(!isset($_SESSION[image_name])) { include($_SESSION[common].'fun2inc/BldImage.php'); $_SESSION[image_name]=$image_name; $_SESSION[image_string]=$random_string; } else { $image_name=$_SESSION[image_name]; $image_string=$_SESSION[image_string]; }

#---------------------------------------------------------------------

if(isset($_POST[submit]) && $_POST[submit]==B_ENTER)
{
	$today=date('r',time());
	$confirm_text=$_POST[confirm_text];
	$passw_form=$_POST[password1];
	$user_ID=trim($_POST[User_ID]); if(strtoupper($user_ID)=='DEMO') { $user_ID=strtoupper($user_ID); $passw_form=strtoupper($_POST[password1]); }
	$feedback=user_access($user_ID,$passw_form);
	if($feedback=='OKIDOKI')
	{
		include_once($_SERVER[DOCUMENT_ROOT].$_SESSION[misc][folder].'skins/phpCAMALEO/def/'.$_SESSION[sitelanguage].'/access_defs.php');
		#
		#	Remove the unlogged user from stat
		#
		$sth=db_query("DELETE FROM g_stat_online WHERE stat_online_user='$_SESSION[id]'");
		#
		#	Send login confirmation email
		#
		if($_SESSION[conf_email]==1)
		{
			$mail_object=$_SERVER[HTTP_HOST].': '.F_ACCESS_ENOTE1;
			$mail_body	=F_ACCESS_ENOTE2."\n\n";
			$mail_body .=F_ACCESS_ENOTE3.$today."\n";
			$mail_body .=F_ACCESS_ENOTE4.$user_ID."\n";
			$mail_body .=F_ACCESS_ENOTE5.$_SERVER[REMOTE_ADDR].':'.$_SERVER[REMOTE_PORT]."\n";
			$unsubscribe = "_____________________________________________________________________________________________\n";
			$unsubscribe .= F_ACCESS_ENOTE6."\nhttp://".$_SERVER[HTTP_HOST]; if($_SESSION[misc][folder]) { $unsubscribe .= '/'.$_SESSION[misc][folder]; }
			$unsubscribe .= '/UserPnl.php?rediraccess=UserPnl.php,'."\n".F_ACCESS_ENOTE7."\n";
			$unsubscribe .= "_____________________________________________________________________________________________\n";
			$result=emailer($_SESSION[user_email], $mail_object, $mail_body.$unsubscribe, $_SESSION[misc][E_ROBOT]);
			if($result!='*OK*') { echo $result; die; }
		}
		if($_GET[rediraccess]!='') { $tmp=str_replace(',','?',$_GET[rediraccess]); header('Location: '.$tmp); die; }
		if($_SESSION[rediraccess]) { $tmp=str_replace(',','?',$_SESSION[rediraccess]); header('Location: '.$tmp); die; }
		else
		{
			switch($user_ID)
			{
				case 'DEMO':header('Location: LoadPage.php?page=welcomed');	break;
				default:	header('Location: LoadPage.php?page=welcomer');
			}
		}
		die;
		#-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
	}
	else { list($feedback_str,$err_i)=explode('@',$feedback); }
}
$PageNr='access';
$_SESSION[PageNr]=strtolower($PageNr);
$_SESSION[PageFile]=basename($_SERVER[PHP_SELF]);
$_SESSION[ReturnPage]='WelcomeR';
include($_SESSION[skinf].'Layout.php');
?>
Return current item: phpCAMALEO