• 22-04-2009, 11:10:00
    #19
    $_SESSION['ID'] boş oLabiLir
    ve session_start(); kodunu sayfanın en başına koy
  • 22-04-2009, 15:42:46
    #20
    Üyeliği durduruldu
    sdemirkeser adlı üyeden alıntı: mesajı görüntüle
    bu verdiginiz index.php mi üstad?
    evet hocam orta kısımda gelmesi gereken sayfa yani. aşağıda php kodlarının başladığı yerde ilgili kısım.
    YuqseLX adlı üyeden alıntı: mesajı görüntüle
    $_SESSION['ID'] boş oLabiLir
    ve session_start(); kodunu sayfanın en başına koy
    denedim o şekildede aynı hatayı veriyor.

    sesionla olması şart değil javascript yada html kodlarıylada olabilir dediğim orta kısma gelmesi yeterli.
  • 22-04-2009, 16:33:51
    #21
    <?
    session_start();
    //include "ayar.php";
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <title>Excess by Free Css Templates</title>
    <meta name="keywords" content="" />
    <meta name="description" content="" />
    <link href="default.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
    <!--
    .style2 {font-size: 24px}
    -->
    </style>
    </head>
    <body>
    <!-- start header -->
    <div id="header">
    	<div id="logo">
    		<h1><a href="#">Excess<sup></sup></a></h1>
    		<h2>Designed by FreeCSSTemplates</h2>
    	</div>
    	<div id="menu">
    		<ul>
    			<li class="active"><a href="#">homepage</a></li>
    			<li><a href="#">photo gallery</a></li>
    			<li><a href="#">about us</a></li>
    			<li><a href="#">links</a></li>
    			<li><a href="#">contact us</a></li>
    		</ul>
    	</div>
    </div>
    <!-- end header -->
    <!-- start page -->
    <div id="page">
    	<!-- start content -->
      <div id="content">
        <!-- end content -->
    	<!-- start sidebar -->
    	 <?php 
    $_SESSION['ID'] = $_GET['ID'];
    switch ($_GET['sayfa']) {
    				case "anasayfa":
    					$inc = 'index1.php'; break;
    				case "hakkimda":
    					$inc = 'hakkimda.php'; break;
    				case "yazi":
    					if($_SESSION['ID'] == ""){
    						echo 'ID değişkeni boş değer döndü.';
    						exit();}
    						$inc = "yazi.php?id=".$_SESSION['ID']."";
    				break;
    				default:
    				$inc = 'index1.php';break;
    default;
    }
    include ($inc);
    ?>
      </div>
    	<div id="sidebar">
    		<ul>
    			<li id="search">
    				<h2><b class="text1">Arama</b></h2>
    				<form method="get" action="">
    					<fieldset>
    					<input type="text" id="s" name="s" value="" />
    					<input type="submit" id="x" value="Search" />
    					</fieldset>
    				</form>
    			</li>
    			<li>
    				<h2><strong><span class="style2">K</span>ategoriler</strong></h2>
    				<?				 $sql = mysql_query ("select * from kategori");
    while ($liste = mysql_fetch_array($sql)) {
    ?>
    				<ul>
    					<li><a href="kategori.php?kat=<? echo "$liste[0]" ; ?> "><? echo "$liste[1]" ; ?></a></li>
    				</ul>
    				<? } ?>
    			</li>
    			<li>
    				<h2>&nbsp;</h2>
    		  </li>
    			<li>
    				<h2><b>Dost</b> siteler</h2>
    				<ul>
    					<li><a href="#">Nec metus sed donec</a></li>
    					<li><a href="#">Magna lacus bibendum mauris</a></li>
    					<li><a href="#">Velit semper nisi molestie</a></li>
    					<li><a href="#">Eget tempor eget nonummy</a></li>
    				</ul>
    			</li>
    	  </ul>
    	</div>
    	<!-- end sidebar -->
    	<div style="clear: both;">&nbsp;</div>
    </div>
    <!-- end page -->
    <!-- start footer -->
    <div id="footer">
    	<div id="footer-menu">
    		<ul>
    			<li class="active"><a href="#">homepage</a></li>
    			<li><a href="#">photo gallery</a></li>
    			<li><a href="#">about us</a></li>
    			<li><a href="#">links</a></li>
    			<li><a href="#">contact us</a></li>
    		</ul>
    	</div>
    	<p id="legal">(c) 2008 YourSite. Design by <a href="http://www.freecsstemplates.org/">Free CSS Templates</a>.</p>
    </div>
    <!-- end footer -->
    </body>
    </html>
    Bunu dener misin?
  • 22-04-2009, 18:01:33
    #22
    Üyeliği durduruldu
    electronicboy adlı üyeden alıntı: mesajı görüntüle
    <?
    session_start();
    //include "ayar.php";
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <title>Excess by Free Css Templates</title>
    <meta name="keywords" content="" />
    <meta name="description" content="" />
    <link href="default.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
    <!--
    .style2 {font-size: 24px}
    -->
    </style>
    </head>
    <body>
    <!-- start header -->
    <div id="header">
    	<div id="logo">
    		<h1><a href="#">Excess<sup></sup></a></h1>
    		<h2>Designed by FreeCSSTemplates</h2>
    	</div>
    	<div id="menu">
    		<ul>
    			<li class="active"><a href="#">homepage</a></li>
    			<li><a href="#">photo gallery</a></li>
    			<li><a href="#">about us</a></li>
    			<li><a href="#">links</a></li>
    			<li><a href="#">contact us</a></li>
    		</ul>
    	</div>
    </div>
    <!-- end header -->
    <!-- start page -->
    <div id="page">
    	<!-- start content -->
      <div id="content">
        <!-- end content -->
    	<!-- start sidebar -->
    	 <?php 
    $_SESSION['ID'] = $_GET['ID'];
    switch ($_GET['sayfa']) {
    				case "anasayfa":
    					$inc = 'index1.php'; break;
    				case "hakkimda":
    					$inc = 'hakkimda.php'; break;
    				case "yazi":
    					if($_SESSION['ID'] == ""){
    						echo 'ID değişkeni boş değer döndü.';
    						exit();}
    						$inc = "yazi.php?id=".$_SESSION['ID']."";
    				break;
    				default:
    				$inc = 'index1.php';break;
    default;
    }
    include ($inc);
    ?>
      </div>
    	<div id="sidebar">
    		<ul>
    			<li id="search">
    				<h2><b class="text1">Arama</b></h2>
    				<form method="get" action="">
    					<fieldset>
    					<input type="text" id="s" name="s" value="" />
    					<input type="submit" id="x" value="Search" />
    					</fieldset>
    				</form>
    			</li>
    			<li>
    				<h2><strong><span class="style2">K</span>ategoriler</strong></h2>
    				<?				 $sql = mysql_query ("select * from kategori");
    while ($liste = mysql_fetch_array($sql)) {
    ?>
    				<ul>
    					<li><a href="kategori.php?kat=<? echo "$liste[0]" ; ?> "><? echo "$liste[1]" ; ?></a></li>
    				</ul>
    				<? } ?>
    			</li>
    			<li>
    				<h2>&nbsp;</h2>
    		  </li>
    			<li>
    				<h2><b>Dost</b> siteler</h2>
    				<ul>
    					<li><a href="#">Nec metus sed donec</a></li>
    					<li><a href="#">Magna lacus bibendum mauris</a></li>
    					<li><a href="#">Velit semper nisi molestie</a></li>
    					<li><a href="#">Eget tempor eget nonummy</a></li>
    				</ul>
    			</li>
    	  </ul>
    	</div>
    	<!-- end sidebar -->
    	<div style="clear: both;">&nbsp;</div>
    </div>
    <!-- end page -->
    <!-- start footer -->
    <div id="footer">
    	<div id="footer-menu">
    		<ul>
    			<li class="active"><a href="#">homepage</a></li>
    			<li><a href="#">photo gallery</a></li>
    			<li><a href="#">about us</a></li>
    			<li><a href="#">links</a></li>
    			<li><a href="#">contact us</a></li>
    		</ul>
    	</div>
    	<p id="legal">(c) 2008 YourSite. Design by <a href="http://www.freecsstemplates.org/">Free CSS Templates</a>.</p>
    </div>
    <!-- end footer -->
    </body>
    </html>
    Bunu dener misin?
    hocam buu koydum.sayfayı index.php?sayfa=yazi&Id=1 olarak çağırdığımda
    "ID değişkeni boş değer döndü." hatası geliyor.
  • 22-04-2009, 18:40:53
    #23
    index.php?sayfa=yazi&Id=1 yerine yı index.php?sayfa=yazi&ID=1 yazıp denermisin. Linuxde veya linux serverda deniyorsan büyük küçük harf duyarlıdır. ID boş gidiyor bir şekilde.
  • 22-04-2009, 18:53:55
    #24
    Üyeliği durduruldu
    electronicboy adlı üyeden alıntı: mesajı görüntüle
    index.php?sayfa=yazi&Id=1 yerine yı index.php?sayfa=yazi&ID=1 yazıp denermisin. Linuxde veya linux serverda deniyorsan büyük küçük harf duyarlıdır. ID boş gidiyor bir şekilde.
    dediğin şekilde yaptığımda 61. satırda hata veriyor.
    Warning: include(yazi.php?id=1) [function.include]: failed to open stream: No error in C:\AppServ\www\skl\index.php on line 61
    
    Warning: include() [function.include]: Failed opening 'yazi.php?id=1' for inclusion (include_path='.;C:\php5\pear') in C:\AppServ\www\skl\index.php on line 61
    Localhostta çalıştırıyorum.
  • 23-04-2009, 13:53:35
    #25
    Üyeliği durduruldu
    Sorun halledilmiştir.Yardımcı olan arkadalara teşekkür ederim.
    Sorunu şu şekilde hallettim.
    ?sayfa=yazi&id=1 olarka çağırmak için index.phpde uğraşıyorduk hatamız buradaymış.yazı.php de $_GET['id'] olarak idyi tanımladım ve değişkene aktardım bu değişkene göre veritabanından bilgi istedim. Problem çözüldü.