<?php
class Korisnik{
	private $username;
	private $ime;
	private $prezime;
	private $konekcija;
	
	public function __construct($kon){
		$this->konekcija = $kon;
	}
	
	public function setUsername($user){
		$this->username = $user;
	}
	public function setIme($ime){
		$this->ime = $ime;
	}
	public function setPrezime($prezime){
		$this->prezime = $prezime;
	}
	public function getIme(){
		return $this->ime;
	}
	public function getPrezime(){
		return $this->prezime;
	}
	
	public function logovanje($user, $pass){
		$upit = "SELECT * FROM korisnik WHERE username='".
				$user."' AND password='".$pass."'";
		$rezultat = $this->konekcija->dohvatiRed($upit);
		if($rezultat != NULL){
			$this->username = $user;
			$this->ime = $rezultat['ime'];
			$this->prezime = $rezultat['prezime'];
			return true;
		} else {
			return false;
		}
	}
}

?>