<?php echo !defined("GUVENLIK") ? die("Vaoww! Bu ne cesaret?") : null;?>
<?php
$headerayar=$db->prepare("SELECT * from header_ayar where id='1'");
$headerayar->execute();
$head = $headerayar->fetch(PDO::FETCH_ASSOC);
$headerlimit = $head['header_limit'];
?>
<?php
$sosyalcon=$db->prepare("SELECT * from sosyal order by sira asc");
$sosyalcon->execute();
$sosyalmobile=$db->prepare("SELECT * from sosyal order by sira asc");
$sosyalmobile->execute();
?>
<?php
$headermainmenu=$db->prepare("SELECT * from header_menu where ust_id='0' and durum='1' and dil='$_SESSION[dil]' order by sira asc limit $headerlimit");
$headermainmenu->execute();
?>
<?php
$telmetin = $ayar[site_tel];
$telsonuc = str_replace(' ', '', $telmetin);

$gsmmetin = $ayar[site_gsm];
$gsmsonuc = str_replace(' ', '', $gsmmetin);


$whtmetin = $ayar[site_whatsapp];
$whtsonuc1 = str_replace('90', '+90 ', $whtmetin);
$whtsonuc2 = str_replace(' ', '', $whtmetin);

$fixedmenu = $db->prepare("select * from sabit_header where id=:id ");
$fixedmenu->execute(array(
    'id' => '1',
));
$fx = $fixedmenu->fetch(PDO::FETCH_ASSOC);
?>
<?php $hashOlusturrandom = rand(0,(int) 9999999999999);?>
<header>
    <style>
        .header-ust-bar-main{padding: <?php echo $head[padding] ?>px 0 <?php echo $head[padding] ?>px 0; background-color: #<?php echo $head[back_color] ?> ; width: <?php if($head[topheader_width]==1){?> 90%; <?php }else {?> 100% <?php }?>; border-bottom: 1px solid #<?php echo $head[border_color] ?>;}
        .header-ust-bar-right-table-ic-box {color:#<?php echo $head[text_color] ?>}
        .header-ust-bar-right-table-ic-box i{color:#<?php echo $head[icon_color] ?>}
        .header-ust-bar-left-table-ic a{color:#<?php echo $head[icon_color] ?>}
        .top-level-menu > li:hover {background:#<?php echo $head[menu_hover_color] ?>}
        .mega-level-menu{border-top:2px solid #<?php echo $head[menu_hover_color] ?>;}
        .mega-level-menu:after{border-bottom-color:#<?php echo $head[menu_hover_color] ?>;}
        .second-level-menu{border-top:2px solid #<?php echo $head[menu_hover_color] ?>;}
        .second-level-menu:after {border-bottom-color:#<?php echo $head[menu_hover_color] ?>;}
        .third-level-menu{border-top:2px solid #<?php echo $head[menu_hover_color] ?>;}
        .top-level-menu > li span{color:#<?php echo $head[menu_text_color] ?>}
        .top-level-menu > li:hover span{color:#<?php echo $head[menu_text_hover_color] ?>}
        .kargo-limit-header{width: <?php if($odemeayar['kargolimit_width']==1){?> 90%; <?php }else {?> 100% <?php }?>; height: auto; margin: 0 auto; padding:5px 0;  background: linear-gradient(to right, #<?=$odemeayar['kargolimit_bg_1']?>, #<?=$odemeayar['kargolimit_bg_2']?>); }


    </style>



    <?php
    $headertopdurum = $db->prepare("SELECT * from header_ayar where id='1' and durum='1'");
    $headertopdurum->execute();
    while($h = $headertopdurum->fetch(PDO::FETCH_ASSOC)){
        ?>
        <!-- TOP OF HEADER  ============================ !-->
        <div class="header-section header-ust-bar-main">
            <div class="container">
                <div class="row align-items-center">
                    <div class="col-lg-8 col-md-12">
                        <div class="header-widget">
                            <ul>
                              <?php
                              $headersosyaldurum = $db->prepare("SELECT * from header_ayar where id='1' and tel='1'");
                              $headersosyaldurum->execute();
                              while($h = $headersosyaldurum->fetch(PDO::FETCH_ASSOC)){
                                ?>
                                <li class="header-ust-bar-right-table-ic-box font-<?php echo $h[font]?>">
                                    <i class="fa fa-phone" aria-hidden="true"></i>
                                    <a href="tel:<?=$telsonuc?>" style="text-decoration: none; color:#<?php echo $head[text_color] ?>">
                                        <?php echo $ayar[site_tel] ?>
                                    </a>
                                </li>
                            <?php } ?>
                            <?php if($head[tel_2] == 1) { ?>
                                <li class="header-ust-bar-right-table-ic-box font-<?php echo $head[font]?>">
                                    <i class="fa fa-mobile" aria-hidden="true" style="font-size:18px"></i>
                                    <a href="tel:<?=$gsmsonuc?>" style="text-decoration: none; color:#<?php echo $head[text_color] ?>">
                                        <?php echo $ayar[site_gsm] ?>
                                    </a>
                                </li>
                            <?php }?>
                            <?php
                            $headersosyaldurum = $db->prepare("SELECT * from header_ayar where id='1' and whatsapp='1'");
                            $headersosyaldurum->execute();
                            while($h = $headersosyaldurum->fetch(PDO::FETCH_ASSOC)){ ?>
                                <li class="header-ust-bar-right-table-ic-box font-<?php echo $head[font]?>">
                                    <i class="fa fa-whatsapp" aria-hidden="true"></i>
                                    <a href="https://api.whatsapp.com/send?phone=<?=$whtsonuc2?>&text=Merhaba&source=&data=" target="_blank" style="text-decoration: none; color:#<?php echo $head[text_color] ?>">
                                        <?php echo $whtsonuc1 ?>
                                    </a>
                                </li>
                            <?php } ?>
                            <?php
                            $headersosyaldurum = $db->prepare("SELECT * from header_ayar where id='1' and mail='1'");
                            $headersosyaldurum->execute();
                            while($h = $headersosyaldurum->fetch(PDO::FETCH_ASSOC)){
                                ?>
                                <li class="header-ust-bar-right-table-ic-box font-<?php echo $head[font]?>">
                                    <i class="fa fa-envelope-o" aria-hidden="true"></i><?php echo $ayar[site_mail] ?>
                                </li>
                            <?php } ?>
                        </ul>
                    </div>
                </div>
                <div class="col-md-4">
                    <div class="header-social text-right">
                        <ul>
                         <?php
                         $headersosyaldurum = $db->prepare("SELECT * from header_ayar where id='1' and sosyal='1'");
                         $headersosyaldurum->execute();
                         while($h = $headersosyaldurum->fetch(PDO::FETCH_ASSOC)){ ?>
                            <?php foreach ($sosyalcon as $sosyal){ ?>
                                <li>
                                    <a href="<?php echo $sosyal[url]?>" target="_blank">
                                        <i class="fa <?php echo $sosyal[icon]?>" aria-hidden="true" data-toggle="tooltip" data-placement="bottom" title="<?php echo $sosyal[baslik] ?>"></i>
                                    </a>
                                </li>
                            <?php }?>
                        <?php } ?>
                    </ul>
                </div>
            </div>              
        </div>
    </div>
</div>

<?php } ?>


<!-- MAIN HEADER WEB  ============================ !-->
<?php
if ($head['header_tip'] == 1) {
    include'headertype/header-1.php';
}
if ($head['header_tip'] == 2) {
    include "headertype/header-2.php";
}
?>

</header>


