v2.5.2
Giriş yap

Admin Paneli Hakkında

ynscnr55
452 defa görüntülendi

Arkadaşlar Merhaba. Bir admin paneli düzenleyip kodladım fakat aklımı almadığı bi olayla karşılaştım. panele girdeğem zaman login ekranına yönlendirmesi gerekirken derik anasayfa çıkıyor. Farklı bir sayfaya tıkladığım zaman login ekranına yönlendiriyor. Acaba nedendir. ?

Site Adresi https://yunuscinar.xyz/panel

      <?php
  include "inc/header.php";
include "inc/sidebar.php";
if (!isset($_SESSION['username']) and !isset($_SESSION['user_fullname']))
{
header("Location:login.php");
}
  $bugun=date("d"); // bugünün tarihi 
  $ay=date("m"); // bu ay
  $yil=date("Y"); // bu yıl 
  $onlineSuresi=time()-2*60*60; // iki dakika aktif olmazsa onlineden düşecek
  $ip=$_SERVER['REMOTE_ADDR']; // ziyaretçinin ip si 
  $bugunGiris=$db->query("SELECT * FROM hit WHERE ip='$ip' AND gun='$bugun'")->rowCount(); // bugün o ip ile girilmişmi 
  if($bugunGiris!=0){ // yani bugün girilmişse
    $al=$db->query("SELECT * FROM `hit` WHERE  `ip`='".$ip."' AND `gun`='".$bugun."'")->fetch();
  $guncelle=$db->query("UPDATE `hit` SET `sayac`='".($al['sayac']+1)."' WHERE id='".$al['id']."'"); // çoğulu 1 artırdık 

  }
  // evet sıra geldi online, tekil ve çoğulu Göstermeye
  // online Kişi 
  $online=$db->query("SELECT * FROM hit WHERE simdi>='$onlineSuresi'")->rowCount(); // onlnie kişilerimiz
  // çoğul hitler 
  $bugunx=$db->query("SELECT SUM(sayac) FROM hit WHERE gun='$bugun' AND ay='$ay' AND yil='$yil' ORDER BY id desc")->fetch();
  $bugun_cogul=$bugunx['SUM(sayac)']; // bugün çoğul
  $dunx=$db->query("SELECT SUM(sayac) FROM hit WHERE gun='".($bugun-1)."' AND ay='$ay' AND yil='$yil' ORDER BY id desc")->fetch();
  $dun_cogul=$dunx['SUM(sayac)']; // dün Çoğul 
  $ayx=$db->query("SELECT SUM(sayac) FROM hit WHERE ay='$ay' AND yil='$yil' ORDER BY id desc")->fetch();
  $buay_cogul=$ayx['SUM(sayac)']; // bu ay çoğul
  $toplamx=$db->query("SELECT SUM(sayac) FROM hit ORDER BY id desc")->fetch();
  $toplam_cogul=$toplamx['SUM(sayac)']; // toplam çoğulumuz
  // tekil hitler 
  $bugun_tekil=$db->query("SELECT * FROM hit WHERE gun='$bugun' AND ay='$ay' AND yil='$yil'")->rowCount(); // bugün tekil
  $dun_tekil=$db->query("SELECT * FROM hit WHERE gun='".($bugun-1)."' AND ay='$ay' AND yil='$yil'")->rowCount(); // dün tekil
  $buay_tekil=$db->query("SELECT * FROM hit WHERE  ay='$ay' AND yil='$yil'")->rowCount(); // dün tekil
  $toplam_tekil=$db->query("SELECT * FROM hit")->rowCount(); // dün tekil
?>  
<title>Yönetim Paneli - <?php echo $ayarcek['ayar_title']; ?></title>  
<meta name="description" content="<?php echo $ayarcek['ayar_description']; ?>">
<meta name="keywords" content="<?php echo $ayarcek['ayar_keywords']; ?>">
<style>
  .bg-c-blue {
    background:#4fc3f7;
  }
    .bg-c-green {
    background:#33db9e;
  }
    .bg-c-yellow {
    background:#ff8a65;
  }
  .bg-c-red {
    background:#f0466b;
  }
  .card .card-block {
    padding: 20px 30px;
  }
  .card .card-footer {
    border-top:none;
    padding:20px 30px;
    border-radius:0 0 5px 5px;
  }
  .col {
    flex-basis:0;
    -webkit-box-flex:1;
    flex-grow:1;
    max-width: 100%;
  }
  .text-c-blue {
    color:#4fc3f7;
  }
  .text-c-green {
    color:#33db9e;
  }
  .text-c-yellow {
    color:#ff8a65;
  }
  .text-c-red {
    color:#f0466b;
  }
  .f-30 {
    font-size:30px;
  }
</style>
    <!-- Page wrapper  -->
        <!-- ============================================================== -->
        <div class="page-wrapper">
            <!-- ============================================================== -->
            <!-- Bread crumb and right sidebar toggle -->
            <!-- ============================================================== -->
         
            <!-- ============================================================== -->
            <!-- End Bread crumb and right sidebar toggle -->
            <!-- ============================================================== -->
            <!-- ============================================================== -->
            <!-- Container fluid  -->
            <!-- ============================================================== -->
            <div class="container-fluid">
                <!-- *************************************************************** -->
                <!-- Start First Cards -->
                <!-- *************************************************************** -->
                <div class="card">
                     <div class="page-breadcrumb">
                <div class="row">
                    <div class="col-lg-12">
                        <h3 class="card-title">Hoşgeldin, <?php  echo $_SESSION['user_fullname'];?></h3>
                      
                    </div>
                  
                </div>
            </div></br><br>
               
                <div class="col-xl-12 col-lg-12">
                    <div class="row">
                   <div class="col-xl-3 col-md-6">
                  <div class="card o-hidden proj-t-card">
                    <div class="card-block">
                      <div class="row align-items-center">
                        <div class="col-auto">
                          <i class="fas fa-users text-c-green f-30"></i>
                        </div>
                        <div class="col">
                          <h2 class="m-b-0 text-c-green"><?php echo $online ?> </h2><small class="text-muted">ZİYARETÇİ</small>
                          <p class="m-b-0">ONLINE</p>
                        </div>
                      </div>
                    </div>
                    <div class="card-footer bg-c-green">
                      <div class="row align-items-center">
                       <div class="col text-left">
                        <h6 class="text-white m-b-0"><small>Son 1 Dakika İçinde Yapılan Ziyaret </small> </h6>
                      </div>
                    </div>
                  </div>
                  <h6 class="pt-badge bg-c-green"></h6>
                </div>
              </div>
               <div class="col-xl-3 col-md-6">
                  <div class="card o-hidden proj-t-card">
                    <div class="card-block">
                      <div class="row align-items-center">
                        <div class="col-auto">
                          <i class="fas fa-users text-c-blue f-30"></i>
                        </div>
                        <div class="col">
                          <h2 class="m-b-0 text-c-blue"><?php echo $buay_tekil ?> </h2><small class="text-muted">ZİYARETÇİ</small>
                          <p class="m-b-0">BUGÜN</p>
                        </div>
                      </div>
                    </div>
                    <div class="card-footer bg-c-blue">
                      <div class="row align-items-center">
                       <div class="col text-left">
                        <h6 class="text-white m-b-0"><i class="fas fa-eye"></i> <small>&nbsp;&nbsp;&nbsp;&nbsp;Gösterim : </small> <?php echo $buay_cogul ?></h6>
                      </div>
                    </div>
                  </div>
                  <h6 class="pt-badge bg-c-blue"></h6>
                </div>
              </div>
               <div class="col-xl-3 col-md-6">
                  <div class="card o-hidden proj-t-card">
                    <div class="card-block">
                      <div class="row align-items-center">
                        <div class="col-auto">
                          <i class="fas fa-users text-c-yellow f-30"></i>
                        </div>
                        <div class="col">
                          <h2 class="m-b-0 text-c-yellow"><?php echo $toplam_tekil ?> </h2><small class="text-muted">ZİYARETÇİ</small>
                          <p class="m-b-0">AYLIK</p>
                        </div>
                      </div>
                    </div>
                    <div class="card-footer bg-c-yellow">
                      <div class="row align-items-center">
                       <div class="col text-left">
                        <h6 class="text-white m-b-0"><i class="fas fa-eye"></i> <small>&nbsp;&nbsp;&nbsp;&nbsp;Gösterim : </small> <?php echo $toplam_cogul ?></h6>
                      </div>
                    </div>
                  </div>
                  <h6 class="pt-badge bg-c-yellow"></h6>
                </div>
              </div>
               <div class="col-xl-3 col-md-6">
                  <div class="card o-hidden proj-t-card">
                    <div class="card-block">
                      <div class="row align-items-center">
                        <div class="col-auto">
                          <i class="fas fa-users text-c-red f-30"></i>
                        </div>
                        <div class="col">
                          <h2 class="m-b-0 text-c-red"><?php echo $bugun_tekil ?> </h2><small class="text-muted">ZİYARETÇİ</small>
                          <p class="m-b-0">TOPLAM</p>
                        </div>
                      </div>
                    </div>
                    <div class="card-footer bg-c-red">
                      <div class="row align-items-center">
                       <div class="col text-left">
                        <h6 class="text-white m-b-0"><i class="fas fa-eye"></i> <small>&nbsp;&nbsp;&nbsp;&nbsp;Gösterim : </small> <?php echo $bugun_cogul ?></h6>
                      </div>
                    </div>
                  </div>
                  <h6 class="pt-badge bg-c-red"></h6>
                </div>
              </div>
                 </div>
                   

                            </div>

                <!-- *************************************************************** -->
                <!-- End First Cards -->
                <!-- *************************************************************** -->
                <!-- *************************************************************** -->
                <!-- Start Sales Charts Section -->
                <!-- *************************************************************** -->
                <div class="row">
                    <div class="col-12">
                        <div class="card">
                            <div class="card-body">
							 <div class="row">
                                            <div class="col-md-12">
                                                <h2 class="card-title" >Gelen Kutusu</h2>
                                            </div>
                       
                                          </div>
                                         <br>
                                         <div class="table-responsive">
                                <table id="zero_config" class="table table-bordered table-responsive-sm">
                                    <thead>
                                     <tr>
                                    
                                      <th>#</th>
                                      <th>Ad-Soyad</th>
                                      <th>E-Posta</th>
                                      <th >Konu</th>
                                      <th >Telefon</th>
                                      <th >Mesaj</th>
                                      <th >İşlemler</th>

                                     
                                  </tr>
                                    </thead>
                  
                                      <?php
                                               

                                                $formsor=$db->prepare("SELECT * FROM form ORDER BY id "); //("SELECT * FROM galeri ORDER BY galeri_durum DESC, galeri_id ASC")  // Burada galeri_durum'a öncelik tanıdık ve artandan azalana göre sıraladık (DESC), ardından galeri_id  
                                                $formsor->execute();
                                                while ($formCek=$formsor->fetch(PDO::FETCH_ASSOC)) { ?>
                                   <tr>
                                   
                                      <td><?php echo $formCek['id'] ?></td>
                                        <td><?php $adsoyad=$formCek['adsoyad']; if (strlen($adsoyad) > 25) { echo substr($adsoyad, 0, 25) . '...'; } else { echo $adsoyad; } ?></td>
                                      <td><?php $eposta=$formCek['eposta']; if (strlen($eposta) > 25) { echo substr($eposta, 0, 25) . '...'; } else { echo $eposta; } ?></td>
                                      <td><?php $konu=$formCek['konu']; if (strlen($konu) > 25) { echo substr($konu, 0, 25) . '...'; } else { echo $konu; } ?></td>
                                      <td><?php $telefon=$formCek['telefon']; if (strlen($telefon) > 25) { echo substr($telefon, 0, 25) . '...'; } else { echo $telefon; } ?></td>
                                      <td><?php $mesaj=$formCek['mesaj']; if (strlen($mesaj) > 25) { echo substr($mesaj, 0, 25) . '...'; } else { echo $mesaj; } ?></td>
                                    <td>
                                     <a href="#" data-toggle="modal" data-target="#oku<?=$formCek['id']?>"><button  type="submit"  name="formGuncelle"class="btn btn-success">Oku</button></a>&nbsp;&nbsp;&nbsp;&nbsp;
                <button class="btn btn-danger" data-toggle="modal" data-target="#altmenu<?=$formCek['id']?>"> Sil</button></td>
                          <div id="altmenu<?=$formCek['id']?>" class="modal fade" tabindex="-1" role="dialog"
                                    aria-labelledby="myModalLabel" aria-hidden="true">
                                    <div class="modal-dialog">
                                        <div class="modal-content">
                                            <div class="modal-header">
                                                <h4 class="modal-title" id="myModalLabel">Silmek İstediğinize Emin Misiniz?</h4>
                                                <button type="button" class="close" data-dismiss="modal"
                                                    aria-hidden="true">×</button>
                                            </div>
                                            <div class="modal-body">
                                               
                                                <p>Yapılan silme işlemi geri alınamaz!!</p>
                                            </div>
                                            <div class="modal-footer">
                                                <button type="button" class="btn btn-light"
                                                    data-dismiss="modal">Kapat</button>
                                                <a href="islemler/form_sil.php?id=<?php echo $formCek['id'];?>"><button class="btn btn-danger"><i class="fas fa-trash-alt"></i> Sil</button></a>
                                            </div>
                                        </div><!-- /.modal-content -->
                                    </div><!-- /.modal-dialog -->
                                </div><!-- /.modal -->
                                      <div id="oku<?=$formCek['id']?>" class="modal fade ">
    <div class="modal-dialog modal-lg modal-sm modal-dialog-centered">

        <div class="modal-content">
            <div class="modal-header">
                <h4 class="modal-title">Mesaj İçeriği</h4>
                <button type="button" class="close" data-dismiss="modal">×</button>
            </div>
              <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
                            <div class="card">
                                
                                <div class="card-body">
                                    <form enctype="multipart/form-data">
                                        <div class="form-group row"></br>
                                            <label class="col-12 col-sm-3 col-form-label text-sm-right">Ad Soyad</label>
                                            <div class="col-12 col-sm-8 col-lg-6">
                                                <input disabled type="text" name="adsoyad" value="<?php echo $formCek['adsoyad'] ?>" class="form-control">
                                            </div>
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-12 col-sm-3 col-form-label text-sm-right">E-posta</label>
                                            <div class="col-12 col-sm-8 col-lg-6">
                                                <input disabled type="text" name="eposta" value="<?php echo $formCek['eposta'] ?>" class="form-control">
                                            </div>
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-12 col-sm-3 col-form-label text-sm-right">Telefon</label>
                                            <div class="col-12 col-sm-8 col-lg-6">
                                                <input disabled type="text" name="telefon" value="<?php echo $formCek['telefon'] ?>" class="form-control">
                                            </div>
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-12 col-sm-3 col-form-label text-sm-right">Konu</label>
                                            <div class="col-12 col-sm-8 col-lg-6">
                                                <input disabled type="text" name="konu" value="<?php echo $formCek['konu'] ?>" class="form-control">
                                            </div>
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-12 col-sm-3 col-form-label text-sm-right">Mesaj</label>
                                            <div class="col-12 col-sm-8 col-lg-6">
                                            <input disabled type="text" name="mesaj" value="<?php echo $formCek['mesaj'] ?>" class="form-control">
                                            </div>
                                        </div>                                     
                                    </form>
                                </div>
                            </div>
                        </div>
            <div class="modal-footer">
                <button class="btn btn-light" type="button" data-dismiss="modal">Kapat</button>
              <a href="islemler/form_sil.php?id=<?php echo $formCek['id'];?>"><button class="btn btn-danger"><i class="fas fa-trash-alt"></i> Sil</button></a></div>
                                  </tr>
                                  <?php  }
                                  ?>
                                 
                </tr>
                                </table>
                            </div> 
                              
                            
                            </div>
                        </div>
                    </div>
                </div>
                 <!-- *************************************************************** -->
				</div>
				</div>
          </div>         
                 
                </div>
                <!-- *************************************************************** -->
                <!-- End Sales Charts Section -->
                <!-- *************************************************************** -->
                <!-- *************************************************************** -->
                <!-- Start Location and Earnings Charts Section -->
             
                <!-- *************************************************************** -->
                <!-- End Location and Earnings Charts Section -->
                <!-- *************************************************************** -->
                <!-- *************************************************************** -->
                <!-- Start Top Leader Table -->
                <!-- *************************************************************** -->
         
                <!-- *************************************************************** -->
                <!-- End Top Leader Table -->
                <!-- *************************************************************** -->
            </div>
            <!-- ============================================================== -->
            <!-- End Container fluid  -->
            <!-- ============================================================== -->
<?php
include "inc/footer.php";
?>
house2k
798 gün önce

Sorunun kaynağını bimiyorum ama ben yerinde olsaydım sayfaya erişimi engellemek için javascript ile yönlendirme yapmazdım. Onun yerine htaccess. dosyasını kullanarak sayafa bütün erişimleri kapatırdım ve sadece isimleri vs yazılı kişilerin sayfaya erişimini açık bırakırdım çünkü bu yazdığın kodda teknik olarak sayfaya erişebiliyorsun sadece seni başka bir adrese yönlendiriyor bilgili bir kimse bu yönlendirmeyi kapatıp panelde çok rahat dolaşabilir.