<?php
session_start();	
?>
<?php
include_once 'ayarlar.php';
$mysql_baglanti= new yonetici(); 
$mysql_baglanti->mysql_baglan();
error_reporting(E_ALL ^ E_NOTICE);
ini_set('error_reporting', E_ALL ^ E_NOTICE); 
?>

<? 
if (isset($_GET['f'])&&($_GET['f']=='logout')){
	 session_unset(); 
	 session_destroy();?>
<? 
}?>
<? 
if (isset($_SESSION['adminuser'])){
?>
	<script type="text/javascript" language="JavaScript">window.location.href="index.php"</script>
<? } ?>
<?
if (isset($_POST['form_submit'])&&($_POST['form_submit']=='submit')) // name of submit button
{
	$adminuser=$_POST['adminuser'];
	$adminpass=$_POST['adminpass'];
	$query = mysql_query("Select * from admin where adminuser='".$adminuser."' and adminpass='".$adminpass."'");
?>
<?
	if(mysql_num_rows($query)>0){?>
    <? $_SESSION['adminuser']=$_POST['adminuser'];?>
       	<script type="text/javascript" language="JavaScript">window.location.href="index.php"</script>
    <? } else {?>
    	<script type="text/javascript" language="JavaScript">window.location.href="login.php?error=user_not_found"</script>
	<? }?>

<?
}
?> 

<!DOCTYPE html>
<html lang="en">
    
<head>
        <title><?=$site_name?></title><meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<link rel="stylesheet" href="css/bootstrap.min.css" />
		<link rel="stylesheet" href="css/bootstrap-responsive.min.css" />
        <link rel="stylesheet" href="css/matrix-login.css" />
        <link href="font-awesome/css/font-awesome.css" rel="stylesheet" />
		<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,700,800' rel='stylesheet' type='text/css'>

    </head>
    <body>
        <div id="loginbox">            
            <form id="loginform" class="form-vertical" action="login.php" method="post">
				 <div class="control-group normal_text"> <h3><img src="img/logo.png" alt="Logo" /></h3></div>
                <div class="control-group">
                    <div class="controls">
                        <div class="main_input_box">
                            <span class="add-on bg_lg"><i class="icon-user"></i></span><input type="text" placeholder="Kullanıcı Adı" name="adminuser" id="adminuser" />
                        </div>
                    </div>
                </div>
                <div class="control-group">
                    <div class="controls">
                        <div class="main_input_box">
                            <span class="add-on bg_ly"><i class="icon-lock"></i></span><input type="password" placeholder="Şifre" name="adminpass" id="adminpass" />
                        </div>
                    </div>
                </div>
                <div class="form-actions">
                	<input type="hidden" value="submit" name="form_submit" />
                    <span class="pull-right"><input type="submit" href="login.php" class="btn btn-success" value="Giriş Yap" /></span>
                </div>
            </form>
            
        </div>
        
        <script src="js/jquery.min.js"></script>  
        <script src="js/matrix.login.js"></script> 
    </body>

</html>
