<?php
include("../db/veritabani.php");
include("../db/alt.php");
if(isset($_POST['giris']))
{
	 $sifre = p('sifre');
	 $kullanici = p('kullanici');
	 
	 $giriskontrol = mysql_query("SELECT * FROM admin WHERE kullanici ='$kullanici' AND sifre ='$sifre'"); 			 	 $durum = mysql_fetch_array($giriskontrol);
	 if($durum)
	 {
		 $son_giris = date("d.m.Y");
		 $yonetici_id_sabit = $durum["id"];
		 
		 $yonetici_guncelle	=	mysql_query("UPDATE admin SET 
		 									son_giris	=	'$son_giris'
											WHERE yonetici_id	=	'$yonetici_id'");
		 
		 $_SESSION['ad_soyad']    = $durum['ad_soyad'];
		 $_SESSION['kullanici']   = $durum['kullanici'];
		 $_SESSION['sifre']       = $durum['sifre'];
		 $_SESSION['id']          = $yonetici_id_sabit ;	
		 
		$bilgi = '  
                     <p>
                    <font color="green">Giriş Başarılı!</font>	</p>
                 
		 ' ;
		
		 echo '<meta http-equiv="refresh" content="1; url=home.php">';
		 
	 }
	 else
	 {
		 $bilgi = '
                    	
                    	  <p><font color="red">HATA! Kullanıcı adı veya şifreniz yanlış.</font></p>
                  
		' ;					
	 }
}

?>
<!DOCTYPE html>
<html lang="tr">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="TUKA">
    <meta name="author" content="TUKA">
    <meta name="keyword" content="TUKA">
    <link rel="shortcut icon" href="img/favicon.png">

    <title>Yönetim Paneli</title>

    <!-- Bootstrap core CSS -->
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/bootstrap-reset.css" rel="stylesheet">
    <!--external css-->
    <link href="assets/font-awesome/css/font-awesome.css" rel="stylesheet" />
    <!-- Custom styles for this template -->
    <link href="css/style.css" rel="stylesheet">
    <link href="css/style-responsive.css" rel="stylesheet" />

    <!-- HTML5 shim and Respond.js IE8 support of HTML5 tooltipss and media queries -->
    <!--[if lt IE 9]>
    <script src="js/html5shiv.js"></script>
    <script src="js/respond.min.js"></script>
    <![endif]-->
</head>

  <body class="login-body">

    <div class="container">

      <form class="form-signin" name="form1" method="post" id="form1">
        <h2 class="form-signin-heading">Yönetim Paneli</h2>
        <div class="login-wrap">
            <input type="text" class="form-control" name="kullanici" placeholder="Kullanıcı Adınız" autofocus>
            <input type="password" class="form-control" name="sifre" placeholder="Şifreniz">
          
            <button class="btn btn-lg btn-login btn-block" name="giris" type="submit">Giriş Yap</button>
          
        
         		<?php echo $bilgi;?>

        </div>

          <!-- Modal -->


      </form>

    </div>



    <!-- js placed at the end of the document so the pages load faster -->
    <script src="js/jquery.js"></script>
    <script src="js/bootstrap.min.js"></script>


  </body>
</html>
