acipinarli Posted December 11, 2013 Share Posted December 11, 2013 Arkadaşlar, okulda derste öğrencilere internet programcılığı dersinde php anlatıyorum. Oturum yönetimine geldik ve şöyle bir sorunumuz var kodları sunucuya atınca sorunsuz çalışıyor ancak localhostta çalıştırınca $_session komutu ile oturum kaydediliyor ancak diğer sayfaya yönlenince kayıt siliniyor ve yönetim sayfasına gelince oturum açılmadı gibi görme yetkiniz yok diyor. kodlar şu şekilde; index.php bu kullanıcı adı şifre girilen form kullanıcı adı şifresi doğru ise panel.php dosyasına yönlenecek <? @session_start(); //oturum işlerini başlat if ($_POST[gir]) { $kullanici= $_POST[ad]; $sifre = $_POST[sifre]; $sorgu = "select * from yoneticiler where kullanici='$kullanici' and sifre='$sifre'"; //echo $sorgu; include("baglan.php"); $liste = mysql_query($sorgu); if (mysql_num_rows($liste) > 0) { $_SESSION["kullanici_adi"] = $kullanici; echo "<script> location.href='panel.php'</script>"; } else echo "Yanlış kullanıcı adı şifre"; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Başlıksız Belge</title> </head> <body> <form id="form1" name="form1" method="post" action=""> <p> </p> <p> </p> <table width="400" border="1" align="center"> <tr> <td colspan="2" align="center">OTURUM BİLGİLERİNİZİ GİRİN</td> </tr> <tr> <td>Kullanıcı Adı</td> <td><label for="ad"></label> <input type="text" name="ad" id="ad" /></td> </tr> <tr> <td>Şifre</td> <td><label for="sifre"></label> <input type="password" name="sifre" id="sifre" /></td> </tr> <tr> <td colspan="2" align="center"><input type="submit" name="gir" id="gir" value="Giriş" /></td> </tr> </table> </form> </body> </html> panel.php bu da şifre doğru ise sayfayı gösterecek yanlış ise görme yetkiniz yok diyecek şekilde ayarlandı. <? @session_start(); if (isset($_SESSION['kullanici_adi'])) { ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Başlıksız Belge</title> </head> <body> <table width="472" border="0" align="center"> <tr> <td align="center"><table width="200" border="1"> <tr> <td bgcolor="#99CCCC">Yönetici İşlemleri</td> </tr> <tr> <td><a href="yoneticiekle.php">Yönetici Ekle</a></td> </tr> <tr> <td>Yönetici Sil</td> </tr> <tr> <td>Yönetici Düzenle</td> </tr> <tr> <td><a href="yoneticigor.php">Yöneticileri Gör</a></td> </tr> </table></td> <td align="center"><table width="200" border="1"> <tr> <td bgcolor="#99CCCC">Haber İşlemleri</td> </tr> <tr> <td>Haber Ekle</td> </tr> <tr> <td>Haber Sil</td> </tr> <tr> <td>Haber Düzenle</td> </tr> <tr> <td> </td> </tr> </table></td> </tr> </table> </body> </html> <? } else echo "Görme yetkiniz yok."; ?> dediğim gibi sunucuya atınca çalışıyor ancak localde çalışmıyor. bir ayarı falan mı var? yardımcı olursanız sevinirim. Quote Link to comment Share on other sites More sharing options...
veyselinci2 Posted December 11, 2013 Share Posted December 11, 2013 Hangi programı kullanıyorsunuz localhost için? Quote Link to comment Share on other sites More sharing options...
acipinarli Posted December 11, 2013 Author Share Posted December 11, 2013 (edited) Hangi programı kullanıyorsunuz localhost için? appserv 2.5.10 kullanıyorum Edited December 11, 2013 by acipinarli Quote Link to comment Share on other sites More sharing options...
veyselinci2 Posted December 11, 2013 Share Posted December 11, 2013 (edited) <?php echo phpinfo(); ?> Bu kodu bir php sayfasına yazıp tarayıcınızdan açın. CTRL + S ile sayfayı kaydedip şu siteye yükleyin ve linkini bana atın: http://www.upload.gen.tr/ Edited December 11, 2013 by veyselinci2 Quote Link to comment Share on other sites More sharing options...
acipinarli Posted December 11, 2013 Author Share Posted December 11, 2013 Buradan indirebilirsiniz Quote Link to comment Share on other sites More sharing options...
veyselinci2 Posted December 11, 2013 Share Posted December 11, 2013 Bir sorun göremedim. Teamviewer bilgilerinizi verin, yakından bakayım isterseniz. Quote Link to comment Share on other sites More sharing options...
acipinarli Posted December 11, 2013 Author Share Posted December 11, 2013 özel mesaj gönder dedim ama ikinci mesaj için 20:49 a kadar süre verdi bu yeni mi çıktı bekliyorum. süre dolsun göndereyim Quote Link to comment Share on other sites More sharing options...
veyselinci2 Posted December 11, 2013 Share Posted December 11, 2013 Yeni mesaj göndermek için yeni konuşma başlatmanıza gerek yok. Mesaj kutunuza girin ve konuşmaya girip cevap yazın. Quote Link to comment Share on other sites More sharing options...
acipinarli Posted December 11, 2013 Author Share Posted December 11, 2013 yardımınız için teşekkürler. wampserver deneyeyim Quote Link to comment Share on other sites More sharing options...
acipinarli Posted December 11, 2013 Author Share Posted December 11, 2013 wampserver kurdum o daha tuhaf çalıştı. localhost/haber/yonetim/index.php yazıyorum kullanıcı adı şifre girmeden kendini localhost/haber/yonetim/panel.php ye yönlediriyor. bu apacheserverlar bana mı gıcık nedir? Quote Link to comment Share on other sites More sharing options...
veyselinci2 Posted December 11, 2013 Share Posted December 11, 2013 MySQL bağlantısını doğru kurmamış olabilirsiniz. Quote Link to comment Share on other sites More sharing options...
acipinarli Posted December 11, 2013 Author Share Posted December 11, 2013 MySQL bağlantısını doğru kurmamış olabilirsiniz. vallahi çıldıracağım. bu kadar zor olmasa gerek. Quote Link to comment Share on other sites More sharing options...
veyselinci2 Posted December 11, 2013 Share Posted December 11, 2013 İsterseniz ben size basit bir login ve admin paneli yapayım, onun üzerinden gösterin. Benim bildiğim $_POST[sifre] değilde $_POST['sifre'] diye yazılır. Ama sunucuda sorun çıkmadı dediğiniz için pek incelemedim. Bu şekilde kullandığınız içinde sorun olabilir. Quote Link to comment Share on other sites More sharing options...
veyselinci2 Posted December 11, 2013 Share Posted December 11, 2013 Yani demek istediğim mesela php bloğunu <?php ile de başlatabilirsiniz <? ile de. Ama bazı sunucularda <? kapalı olabilir. <?php yazarsanız hiç bir zaman sorun çıkmaz. Kullandığınız kodlar bu yüzden sorun yaratmış olabilir. Birde benim hazırladığım login sayfasını deneyin, sorun çıkarsa problem serverdan, çıkmazsa kodlardan kaynaklanmakta demektir. http://85.195.83.175/php.zip Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.