<?php
	echo "Login Page";
	if(isset($_POST['kime']) && isset($_POST['sifra'])
		&& isset($_POST['dugme'])){
		
		require_once('config.inc.php');
		require_once('Konekcija.php');
		$konektor = new Konekcija(DB_HOST, DB_USER, DB_PASS, DB_NAME);
		require_once('Korisnik.php');
		$korisnik = new Korisnik($konektor);
		
		$fleg = 
		  $korisnik->logovanje($_POST['kime'], $_POST['sifra']);
		if($fleg){
			session_start();
			$_SESSION['username'] = $_POST['kime'];
			$_SESSION['osoba'] = $korisnik->getIme()." ".
									$korisnik->getPrezime();
			header("Location: dobrodosli.php");
		} else {
			echo "Neuspesno logovanje";
		}
		
	}
	
	

?>

<form name="mojaForma" method="POST" 
		action="<?php echo $_SERVER['PHP_SELF'];?>">
	Kor. ime: <input type="text" name="kime" size="10"/>
	<br/>
	Lozinka: <input type="password" name="sifra"/> 
	<br/>
	<input type="submit" name="dugme" value="POTVRDI"/>
</form>