<?php
if($_POST['gonder']) {


$_SESSION["sessionad"];


$ad          = $_POST['ad'];
$sifre        = $_POST['sifre'];

$query  = "SELECT * FROM kullanici WHERE kullanici_ad = '$ad' AND kullanici_sifre = '$sifre'";
$mysqli    = mysqli_query($db, $query);
$result = mysqli_fetch_array($mysqli);

if(($result['kullanici_ad'] == $ad) AND ($result['kullanici_sifre'] == $sifre)) {

$_SESSION['ad']       = $result;
$_SESSION['sifre']   = $result;


if(!empty($_POST['hatirla'])) {
$cookie = trim(strip_tags($_POST['hatirla']));
$cookiename     = "cerezad";
$cookievalue  = "cerezsifre";
setcookie($cookiename, $cookievalue, time() + (86400), "/"); // 86400 = 1 day
} else {

}


} else {

echo "<center><h1> Giriş Yapılamadı";
header("Refresh:1; url=girisformu.php");


$_SESSION["sessionad"] += 1;

if ($_SESSION["sessionad"] > 2) { ?>

<div class='uyari'>
<?php
echo ("Fazla giriş");

header("Refresh:1; url=index.php");
?>
</div>
<?php            
}
?>
<?php            

}
}

?>