Location: PHPKode > projects > PHP OpenTailorShop > phpopentailorshop/webkasse/lieferantenliste.php
<?
session_start();
require("database.php");

// put full path to Smarty.class.php
require('/usr/local/lib/php/Smarty/Smarty.class.php');
$smarty = new Smarty();
$smarty->template_dir = '/home/elena/kasse/html/smarty/templates';
$smarty->compile_dir = '/home/elena/kasse/html/smarty/templates_c';
$smarty->cache_dir = '/home/elena/kasse/html/smarty/cache';
$smarty->config_dir = '/home/elena/kasse/html/smarty/configs';


function logged_in() 
{
	$ip=$_SERVER['REMOTE_ADDR'];
	$session = session_id();
	if ( $_SESSION['key'] == '' ) return FALSE ;
	$sql = "SELECT `username` FROM `account` WHERE `last_ip` = '".$ip."' AND `sessionkey`='".$_SESSION['key']."' LIMIT 1";
	$result = mysql_query($sql) or die( mysql_error() );
	if (mysql_num_rows($result) > 0)
	{
		if ( $row = mysql_fetch_array($result) )
		{
			return TRUE;
		}
		else return FALSE;
	}
	else return FALSE;	
}

if( logged_in() )       $bLogin = 1;
else                    $bLogin = 0;

$smarty->assign( "UserLogin", $bLogin );

$ip=$_SERVER['REMOTE_ADDR'];
$gmlevel = 0 ;
$sql = "SELECT `gmlevel` FROM `account` WHERE `last_ip` = '".$ip."' AND `sessionkey`='".$_SESSION['key']."' LIMIT 1";
$result = mysql_query($sql) or die( mysql_error() );
if (mysql_num_rows($result) > 0)
{
	if ( $row = mysql_fetch_array($result) )
	{
		$gmlevel = $row['gmlevel'];
	}
}

$smarty->assign( "GMLevel", $gmlevel );

        $sql = "SELECT * FROM `lieferanten` order by `LieferantenNr` asc";
        $result = mysql_query($sql) or die( mysql_error() );
        $lieferanten = array();
        if (mysql_num_rows($result) > 0)
        {
        	while ( $row = mysql_fetch_array($result) )
        	{
                        $lieferanten[$row['LieferantenNr']] = $row ;
        	}
        }

$smarty->assign("lieferanten", $lieferanten );
$smarty->assign("AKTION", $action);
$smarty->display('lieferantenliste.tpl');
?>
Return current item: PHP OpenTailorShop