<?php
error_reporting(0);
session_start(); ## -> Oturum Başlatıldı
require_once ('../vi_connect.php'); ##-> Mysql Bağlantısı
require_once ('../vi_global.php'); ##-> Global Değerler

$seviye = g("seviye");
if($seviye == "kurulum"){
unlink('../kurulum.php');
unlink('../veritabani.sql');
}
if($_SESSION['oturum_kontrol'] != "ok"){ ##-> Oturum Kontrolü

?>

<!doctype html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="ATUTCOSoft Admin - Gelişmiş İçerik Yönetimi">
    <meta name="author" content="DijitalVi">

    <title>KOSARMY Yönetim Paneli | Gelişmiş İçerik Yönetimi</title>
    <link href="moduller/login/css/bootstrap.min.css" rel="stylesheet">
    <link href="moduller/login/css/common.css" rel="stylesheet">
	<link href="https://fonts.googleapis.com/css?family=Rubik:400,600,700&amp;display=swap" rel="stylesheet">
	<link href="moduller/login/css/theme-05.css" rel="stylesheet">
	<link rel="stylesheet" href="moduller/login/css/font-awesome-4.7.0/css/font-awesome.min.css">
	</head>

	<body>
    <div class="forny-container">
        
	<div class="forny-inner">
    <div class="forny-two-pane">
    <div>
    <div class="forny-form">
    <div>
    <h4>KOSARMY Yönetim Paneli</h4>
    <p class="mb-10">Lütfen erişim bilgilerinizi giriniz.</p>
    </div>
	
	<?php 
 ##-> Login Control
 
$islem = g('islem');
switch($islem){
case "giriskontrol":

$girilen_kullaniciadi = p('kullanici_adi');
$girilen_kullanicisifre = p('kullanici_sifre');
$panel_dili = p('panel_dili');
$sifre_son = md5($girilen_kullanicisifre);

##-> Panel Dili
$_SESSION['p_dil']   = "tr";
$_SESSION['p_dil']   = "en";
if($panel_dili == "tr"){ $_SESSION['p_dil']   = "tr";}
if($panel_dili == "us"){ $_SESSION['p_dil']   = "us";}
##-> Panel Dili Bitiş

$sorgu=mysql_query("SELECT * FROM kullanicilar WHERE kullanici_adi='$girilen_kullaniciadi'"); 
$getir=mysql_fetch_array($sorgu); 

$gelen_kullaniciadi = $getir['kullanici_adi'];
$gelen_kullanicisifre = $getir['kullanici_sifre'];
$gelen_kullanici_id = $getir['id'];

if($gelen_kullanicisifre == "$sifre_son"){
##-> Giriş Tamam
$_SESSION['oturum_kontrol']   = "ok"; ##-> Oturum doğrulandığı için oturuma ok değeri veriyoruz.
$_SESSION['kullanici_id'] = "$gelen_kullanici_id"; ##-> Panele hangi kullanıcı olduğunu gönderiyoruz.


function getRealIpAddr()  
{if(!empty($_SERVER['HTTP_CLIENT_IP']))  
{$ip=$_SERVER['HTTP_CLIENT_IP'];}  
elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) 
{$ip=$_SERVER['HTTP_X_FORWARDED_FOR']; }  
else{$ip=$_SERVER['REMOTE_ADDR'];}  return $ip;}  
$giris_kullanici = $gelen_kullaniciadi;
$giris_tarih = date('d.m.y');
$giris_saat = date('H:i');
$giris_ip = getRealIpAddr();
$ekle_giris = mysql_query("INSERT INTO giris_kayit (giris_kullanici,giris_tarih,giris_saat,giris_ip)VALUES('$giris_kullanici','$giris_tarih','$giris_saat','$giris_ip')");



	
	
	
echo '<meta http-equiv="refresh" content="0;URL=panel.php">'; ##-> Gönder dashboard.php
}
else{
##-> Giriş Hatalı
echo '<meta http-equiv="refresh" content="0;URL=index.php?durum=hatali">'; ##-> Gönder index.php
}
}

?>   
			  <?php
			  $durum = g('durum');
			  if($durum == "hatali"){
			  ?>
			  <div class="alert alert-danger" role="alert">
			  Lütfen Tekrar Deneyiniz
			  </div>
			  <br>
			  <?php } ?> 
			  
    <form action="index.php?islem=giriskontrol" method="post">
                    
    <div class="form-group">
        
    <div class="input-group">
    <div class="input-group-prepend">
    <span class="input-group-text">
    <i class="fa fa-user"></i>
    </span>
    </div>
            
    <input required  class="form-control" name="kullanici_adi" type="text" placeholder="Kullanıcı Adı" >
    </div>
    </div>

                    
    <div class="form-group password-field">
        
    <div class="input-group">
    <div class="input-group-prepend">
    <span class="input-group-text">
    <i class="fa fa-lock"></i>
    </span>
    </div>
            
    <input required  class="form-control" name="kullanici_sifre" type="password" placeholder="Şifre" >

    <div class="input-group-append cursor-pointer">
    <span class="input-group-text">
    <svg xmlns="http://www.w3.org/2000/svg" width="24" height="16" viewBox="0 0 24 16">
    <g transform="translate(0 0)">
    <g transform="translate(0 0)">
    <path d="M23.609,117.568a15.656,15.656,0,0,0-5.045-4.859,12.823,12.823,0,0,0-6.38-1.811c-.062,0-.309,0-.371,0a12.823,12.823,0,0,0-6.38,1.811,15.656,15.656,0,0,0-5.045,4.859,2.464,2.464,0,0,0,0,2.658,15.656,15.656,0,0,0,5.045,4.859,12.822,12.822,0,0,0,6.38,1.811c.062,0,.309,0,.371,0a12.823,12.823,0,0,0,6.38-1.811,15.656,15.656,0,0,0,5.045-4.859A2.464,2.464,0,0,0,23.609,117.568Zm-17.74,6.489a14.622,14.622,0,0,1-4.712-4.538,1.155,1.155,0,0,1,0-1.245,14.621,14.621,0,0,1,4.712-4.538,12.747,12.747,0,0,1,1.586-.79,8.964,8.964,0,0,0,0,11.9A12.748,12.748,0,0,1,5.869,124.057ZM12,125.75c-3.213,0-5.827-3.074-5.827-6.853s2.614-6.853,5.827-6.853,5.827,3.074,5.827,6.853S15.211,125.75,12,125.75Zm10.841-6.23a14.621,14.621,0,0,1-4.712,4.538,12.737,12.737,0,0,1-1.585.788,8.964,8.964,0,0,0,0-11.9,12.74,12.74,0,0,1,1.587.791,14.622,14.622,0,0,1,4.712,4.538A1.155,1.155,0,0,1,22.839,119.52Z" transform="translate(0.002 -110.897)"/>
    </g>
    <g transform="translate(9.565 5.565)">
    <path d="M205.24,202.8a2.435,2.435,0,1,0,2.435,2.435A2.438,2.438,0,0,0,205.24,202.8Zm0,3.917a1.482,1.482,0,1,1,1.482-1.482A1.483,1.483,0,0,1,205.24,206.721Z" transform="translate(-202.805 -202.804)"/>
    </g>
    </g>
	</svg>
    </span>
	</div>
    </div>
    </div>
	
	
	


	<div class="row mt-6 mb-6">
    <div class="col-6 d-flex align-items-center">
                            
    <div class="custom-control custom-checkbox">
    <input type="checkbox" class="custom-control-input" id="cb1">
    <label class="custom-control-label" for="cb1">Beni hatırla
    </label>
    </div>
	</div>
                        
	<div class="col-6 text-right">
    <a href="05_reset.html"></a>
    </div>
    </div>

    <div>
    <button class="btn btn-danger btn-block" style="background:red;border:0px solid black;">Giriş Yap</button>
    </div>

    <div class="mt-10">
    Sorunmu yaşıyorsunuz ?  <a href="mailto:yusuf.ergisi@atutco.com.tr"> Webmaster'a danışın</a>
    </div>
    </form>
    </div>
    </div>
    <div class="right-pane" style="background-image: url('images/loginarka.webp');">
    <div class="text-center" style="width: 300px">
   
    <div class="mt-10">
    <h4 class="mb-4">Hoşgeldin KOSARMY</h4>
    <p>
    Sizi görmek güzel !, giriş yaparak sitenizi kolaylıkla yönetebilirsiniz.
    </p>
    </div>
    </div>
    </div>
    </div>
	</div>

    </div>

    <script src="moduller/login/js/jquery.min.js"></script>
    <script src="moduller/login/js/bootstrap.min.js"></script>
    <script src="moduller/login/js/main.js"></script>
    <script src="moduller/login/js/demo.js"></script>
    
	</body>


	</html>
<?php  }else { echo '<meta http-equiv="refresh" content="0;URL=panel.php">'; } ##Oturum Kontrolü ?>