fonksiyon.php
<?php
ob_start();
session_start();
include('veritabani.php');
date_default_timezone_set( 'Europe/Istanbul' );
if ( isset( $_POST[ 'login' ] ) )
{
$kullanici_adi = htmlspecialchars( trim( $_POST[ 'kullanici_adi' ] ) );
$kullanici_pass = htmlspecialchars( trim( md5( $_POST[ 'sifre' ] ) ) );
if ( $kullanici_adi && $kullanici_pass )
{
$kullanicisor = $db->prepare( "SELECT * from yonetim where kullanici_adi=:kullanici_adi and sifre=:sifre" );
$kullanicisor->execute(
array(
'kullanici_adi' => $kullanici_adi,
'sifre' => $kullanici_pass
)
);
$say = $kullanicisor->rowCount();
if ( $say > 0 )
{
$_SESSION[ 'kullanici_adi' ] = $kullanici_adi;
header( 'Location:./anasayfa.php' );
}
else
{
header( 'Location:./index.php?status=no' );
}
}
}her sayfada mevcut olan header.php
<?php
ob_start();
session_start();
date_default_timezone_set('Europe/Istanbul');
include 'veritabani.php';
if (isset($_SESSION['login'])) {
} else { header("Location:index.php");}
$user=$db->prepare("SELECT * from yonetim where id=?");
$user->execute(array(0));
$userprint=$user->fetch(PDO::FETCH_ASSOC);
?>cikis.php
<?php
session_start();
session_destroy();
echo '
<div id="progressbar">
<span id="loading"></span>
<div id="load">Çıkış Yapılıyor...</div>
</div>';
header("Refresh: 2; url=index.php");
?>veritabanımda yonetim tablosu var sütunları id,kullanici_adi,sifre