Example #1
0
	$lg = $languages[0];														/*select first language as default language*/
	$smarty->assign('lg_url', '');												/*Set template lg url */
}
$smarty->assign('current_url',$_SERVER['REQUEST_URI']);
$smarty->assign('lg', $lg);														/*Set template lg var*/

/*LOGIN SYSTEM*/
if (isset($_POST['login_user']) && isset($_POST['login_pass'])) {				/*If there is any attempt of login verifies login*/
	$logged = login(cleanQuery($_POST['login_user']),cleanQuery($_POST['login_pass']));	/*Do the login, updating user table*/
	if ($logged==1) $_SESSION['logged']=1;										/*If logged set session as logged*/
	$smarty->assign('login_try', 1); 											/*To be used by template system to check if there is any login atempt*/
}

if (isset($_SESSION['logged']))													/*If logged verify login ip and session*/
if ($_SESSION['logged']==1) {
	$user = verifica_login();													/*And get current user to var*/
	if ($user) $current_user = $user;
	else $_SESSION['logged']=0;													/*Else logoff automatic*/
}

if ($current_user) $is_admin = is_admin($current_user);							/*Set $is_admin if user is administrator*/

$smarty->assign('current_user', $current_user);									/*Set template var of username*/
$smarty->assign('is_admin', $is_admin);											/*Set template var of is_admin*/

$smarty->assign("sess",session_id());
$smarty->assign("sess_name",ini_get('session.name'));

$lgg['linguas'] = $languages;					/*Assigns languages to lgg to put on template var*/
$lgg['linguas_desc'] = $languages_desc;
$smarty->assign($lgg);
Example #2
0
<?php

include 'biblioteca.php';
$login = $_POST["login"];
$senha = $_POST["senha"];
verifica_login($login, $senha);