Location: PHPKode > projects > php movie db > index.php
<?
	include 'libreria.inc.php';
	$db=connetti();
	
	
	if (isset($entra)and($page=='login'))
	{
		$dim=strlen($password);	
		$testo="select * from utenti where username='$username'";
		
		$res=mysql_query($testo, $db);
		$num=mysql_num_rows($res);
		$ok=0;
		if ($num==1)
		{
			$passwd=mysql_result($res, 0, 'password');
			if ($passwd==$password)
			{
				$ok=1;
				$id_utente=mysql_result($res, 0, 'id_utente');
												
				setcookie ("mov_id_ut", $id_utente);
				$ict_id_ut=$id_utente;
				session_id($id_utente);
				session_name("$username");
				$page=DEFAULT_PAGE;
				$mov_id_ut=$id_utente;		
			}
		}		
		
	}
	


echo "<html>";
echo "<head>";
echo "<title>Elenco Film</title>";
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">";
	echo "<link href=\"stili/stile.css\" rel=\"stylesheet\" type=\"text/css\">";
//<link href="stili/calendar.css" rel="stylesheet" type="text/css">

	//echo "<script src='script\calendar.js'></script>";
	echo "<script src='script\validate.js'></script>";
	echo "</head>";

	echo "<body >";

	if (!isset($mov_id_ut))
		$mov_id_ut=0;	
	titolo();
	echo "<table width='800' align='center'>";
	echo "<tr valign='top'><td width='150'>";
	if ($mov_id_ut==0)
		menu($db,4,$mov_id_ut,$PHP_SELF,1);
		
	$livello=controlla_privilegi($db,$mov_id_ut,2);
	if ($livello!=-1)
		menu($db,2,$mov_id_ut,$PHP_SELF,$livello);
		
	$livello=controlla_privilegi($db,$mov_id_ut,1);
	if ($livello!=-1)
		menu($db,1,$mov_id_ut,$PHP_SELF,$livello);
		
	$livello=controlla_privilegi($db,$mov_id_ut,3);
	if ($livello!=-1)
		menu($db,3,$mov_id_ut,$PHP_SELF,$livello);
		
	echo "</td><td align='right'>";
	if (!isset($page))
		$page='default';
	else {
		$page=str_replace("\\\\","\\",$page);
		include $page;
	}
	echo "</td></tr></table>";
	mysql_close($db);

?>
</body>
</html>
Return current item: php movie db