• 14-06-2017, 04:16:04
    #1
    Merhabalar,
    Konuya hakim arkadaşlar yardımcı olurlarsa çok sevinirim.

    Chrome kullanılarak girildiğinde

    www.domain.com/sitemap.xml
    yada www.domain.com/sitemap.php

    bu hatayı alıyorum ve google bu yüzden sitemap görmüyor
    Hata :
    This page contains the following errors:
    
    error on line 1 at column 6: XML declaration allowed only at the start of the document
    Below is a rendering of the page up to the first error.
    Fakat aynı hatayı firefox ta almıyorum.

    Buda sitemap php


    <?php require_once('Connections/config.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
    {
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      }
    
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
    
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;    
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      }
      return $theValue;
    }
    }
    
    mysql_select_db($database_config, $config);
    $query_smtp = "SELECT * FROM ayarlar_smtp";
    $smtp = mysql_query($query_smtp, $config) or die(mysql_error());
    $row_smtp = mysql_fetch_assoc($smtp);
    $totalRows_smtp = mysql_num_rows($smtp);
    ?>
    <?php require_once('inc/fonksiyonlar.php'); ?>
    <!DOCTYPE html>
    <html lang="en">
      <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
        <title><?php echo $row_MetaTag['site_adi']; ?></title>
    	<meta name="description" content="<?php echo $row_MetaTag['site_aciklama']; ?>" />
        <meta name="keywords" content="<?php echo $row_MetaTag['site_anahtar_kelimeleri']; ?>" />
        <meta name="author" content="<?php echo $row_MetaTag['site_yazar']; ?>" />   
        <meta name="owner" content="<?php echo $row_MetaTag['site_sahibi']; ?>" />    
        <meta name="copyright" content="<?php echo $row_MetaTag['site_acilis_yili']; ?>" />
    	<meta property="og:url"         content="<?php echo $row_base_url['url']; ?>" />
        <meta property="og:title"       content="<?php echo $row_MetaTag['site_adi']; ?>" />
        <meta property="og:description" content="<?php echo $row_MetaTag['site_aciklama']; ?>" />
        <meta property="og:image"       content="upload/logo/<?php echo $row_logo_header['logo_resim']; ?>" />
    
    <?php include('inc/header.php'); ?>
    		
            <div class="container bas wow slideInUp" data-wow-delay="1s">
            	
                	<div class="beyaz">
                    	<div class="row text-center" style="padding-top:200px; padding-bottom:200px;">
                          
    <?php
    require("inc/class.phpmailer.php");
    $isim = $_POST['isim'];
    $telefon = $_POST['telefon'];
    $eposta = $_POST['eposta'];
    $mesaj = $_POST['mesaj'];
    
    $mail = new PHPMailer();
    
    $mail->IsSMTP();   // send via SMTP
    $mail->Host     = $row_smtp['sunucu']; // SMTP servers
    $mail->SMTPAuth = true;     // turn on SMTP authentication
    $mail->Username = $row_smtp['username'];  // SMTP username
    $mail->Password = $row_smtp['sifre']; // SMTP password
    $mail->SMTPSecure = 'ssl';
    $mail->SetLanguage("tr", "inc/language");
    $mail->Port = $row_smtp['smtp_port'];
    $mail->CharSet = "utf-8";
    $mail->IsHTML(true);
    $mail->From     = $row_smtp['username']; // smtp kullanýcý adýnýz ile ayný olmalý
    $mail->Fromname = $row_MetaTag['site_adi'];
    $mail->AddAddress($row_smtp['mail'],$row_MetaTag['site_adi']);
    $mail->Subject  =  $row_smtp['baslik'];
    $mail->Body     =  implode("<br>",$_POST);
    
    	
    
    if(!$mail->Send())
    {
       echo '<b style="color:red;">Mesaj Gönderilemedi! <b>';
       echo "Mailer Error: " . $mail->ErrorInfo;
       exit;
    }
    
    echo "<h1>Mesajınız başarı ile gönderildi</h1>";
    
    
    ?>
                        
                    	</div>
                    </div>
             
            </div>
    		
       
    <?php include('inc/footer.php'); ?>
    <?php
    mysql_free_result($smtp);
    ?>

    Konuya hakim arkadaşlardan yardım bekliyorum
    Teşekkür ederim.
  • 14-06-2017, 09:58:04
    #2
    Merhaba,

    Yazıdan da anlaşılacağı üzere, XML Output unuzun 1. satırı 6. sütununda XML yapısına uygun olmayan bir değer geldiğinden sayfa hatası almaktasınız. XML ler yapı dışında output çıkarttığında bu hata normaldir.

    URL den girdiğinizde birde çıktı alınan kaynak kodunuda buraya koyarsanız ne çıktı veriyor sistem onuda görmüş oluruz.
  • 15-06-2017, 14:40:24
    #3
    MesutEyrice adlı üyeden alıntı: mesajı görüntüle
    Merhaba,

    Yazıdan da anlaşılacağı üzere, XML Output unuzun 1. satırı 6. sütununda XML yapısına uygun olmayan bir değer geldiğinden sayfa hatası almaktasınız. XML ler yapı dışında output çıkarttığında bu hata normaldir.

    URL den girdiğinizde birde çıktı alınan kaynak kodunuda buraya koyarsanız ne çıktı veriyor sistem onuda görmüş oluruz.

    Yazmamda sakınca var mı bilmiyorum lakin
    söylediklerinizden anladığım kadarı ile...
    aripak.com/sitemap.xml firefox ve chrome de farklı sonuçlar veriyor.
    Firefox ta normal sanırım

    Chrome daki sonuç bu
    This page contains the following errors:
    
    error on line 1 at column 6: XML declaration allowed only at the start of the document
    Below is a rendering of the page up to the first error.
    İlginize teşekkür ederim
  • 15-06-2017, 14:47:49
    #4
    Merhaba,

    Evet tarayıcılar farklı yorumladıkları için farklı çıkacaktır.

    Buradaki hata diyorki başlangıç tag ından önce bir karakter olamaz. Büyük ihtimal yazılım ayağınızda sayfanın output tarafında yok boşluk yada özel bir karakter ataması yapıyor fakat göremiyorsunuz. Kullandığınız editörden de kaynaklanıyor olabilir yada yazılan yazılımdan da kaynaklanıyor olabilir.

    Kısaca sıfırıncı karakter (0) <? ile başlamalıdır.

    Sitemap.xml dosyanız mod_rewrite a girmeden ana dizinde bir dosya ise dosyanızı kontrol edin, Eğer php tarafından oluşturulan bir yönlenmdirme ise lütfen o yazılımı kontrol ediniz.

    Tarman adlı üyeden alıntı: mesajı görüntüle
    Yazmamda sakınca var mı bilmiyorum lakin
    söylediklerinizden anladığım kadarı ile...
    aripak.com/sitemap.xml firefox ve chrome de farklı sonuçlar veriyor.
    Firefox ta normal sanırım

    Chrome daki sonuç bu
    This page contains the following errors:
    
    error on line 1 at column 6: XML declaration allowed only at the start of the document
    Below is a rendering of the page up to the first error.
    İlginize teşekkür ederim
  • 15-06-2017, 21:54:02
    #5
    evet php yönlendirme ama sorunu bulamadım

    sitemap.php

    <?php require_once('Connections/config.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
    {
    if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
    }

    $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

    switch ($theType) {
    case "text":
    $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
    break;
    case "long":
    case "int":
    $theValue = ($theValue != "") ? intval($theValue) : "NULL";
    break;
    case "double":
    $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
    break;
    case "date":
    $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
    break;
    case "defined":
    $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
    break;
    }
    return $theValue;
    }
    }

    mysql_select_db($database_config, $config);
    $query_url = "SELECT * FROM site_dili";
    $url = mysql_query($query_url, $config) or die(mysql_error());
    $row_url = mysql_fetch_assoc($url);
    $totalRows_url = mysql_num_rows($url);

    mysql_select_db($database_config, $config);
    $query_kurumsal = "SELECT * FROM kurumsal ORDER BY id DESC";
    $kurumsal = mysql_query($query_kurumsal, $config) or die(mysql_error());
    $row_kurumsal = mysql_fetch_assoc($kurumsal);
    $totalRows_kurumsal = mysql_num_rows($kurumsal);

    mysql_select_db($database_config, $config);
    $query_hizmetler = "SELECT * FROM hizmetler ORDER BY id DESC";
    $hizmetler = mysql_query($query_hizmetler, $config) or die(mysql_error());
    $row_hizmetler = mysql_fetch_assoc($hizmetler);
    $totalRows_hizmetler = mysql_num_rows($hizmetler);

    mysql_select_db($database_config, $config);
    $query_kategori = "SELECT * FROM proje_kategorileri ORDER BY id DESC";
    $kategori = mysql_query($query_kategori, $config) or die(mysql_error());
    $row_kategori = mysql_fetch_assoc($kategori);
    $totalRows_kategori = mysql_num_rows($kategori);

    mysql_select_db($database_config, $config);
    $query_projeler = "SELECT * FROM projeler ORDER BY id DESC";
    $projeler = mysql_query($query_projeler, $config) or die(mysql_error());
    $row_projeler = mysql_fetch_assoc($projeler);
    $totalRows_projeler = mysql_num_rows($projeler);

    mysql_select_db($database_config, $config);
    $query_haberler = "SELECT * FROM haberler ORDER BY id DESC";
    $haberler = mysql_query($query_haberler, $config) or die(mysql_error());
    $row_haberler = mysql_fetch_assoc($haberler);
    $totalRows_haberler = mysql_num_rows($haberler);

    mysql_select_db($database_config, $config);
    $query_iletisim = "SELECT * FROM ayarlar_iletisim_bilgileri ORDER BY id DESC";
    $iletisim = mysql_query($query_iletisim, $config) or die(mysql_error());
    $row_iletisim = mysql_fetch_assoc($iletisim);
    $totalRows_iletisim = mysql_num_rows($iletisim);

    header("Content-type: text/xml");
    echo '<?xml version="1.0" encoding="UTF-8" ?>';

    ?>



    <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">

    <url>
    <loc><?php echo $row_url['url']; ?></loc>
    <changefreq>always</changefreq>
    </url>
    <url>
    <loc><?php echo $row_url['url']; ?>hizmetler</loc>
    <changefreq>always</changefreq>
    </url>
    <url>
    <loc><?php echo $row_url['url']; ?>haberler</loc>
    <changefreq>always</changefreq>
    </url>
    <url>
    <loc><?php echo $row_url['url']; ?>foto-galeri</loc>
    <changefreq>always</changefreq>
    </url>
    <url>
    <loc><?php echo $row_url['url']; ?>video-galeri</loc>
    <changefreq>always</changefreq>
    </url>
    <?php do { ?>
    <url>
    <loc><?php echo $row_url['url']; ?>kurumsal-<?php echo $row_kurumsal['id']; ?>-<?php echo permalink($row_kurumsal['baslik']); ?></loc>
    <changefreq>always</changefreq>

    </url>
    <?php } while ($row_kurumsal = mysql_fetch_assoc($kurumsal)); ?>

    <?php do { ?>
    <url>
    <loc><?php echo $row_url['url']; ?>hizmet-<?php echo $row_hizmetler['id']; ?>-<?php echo permalink($row_hizmetler['baslik']); ?></loc>
    <changefreq>always</changefreq>

    </url>
    <?php } while ($row_hizmetler = mysql_fetch_assoc($hizmetler)); ?>
    <?php do { ?>
    <url>
    <loc><?php echo $row_url['url']; ?>kategori-<?php echo $row_kategori['id']; ?>-<?php echo permalink($row_kategori['baslik']); ?></loc>
    <changefreq>always</changefreq>

    </url>
    <?php } while ($row_kategori = mysql_fetch_assoc($kategori)); ?>
    <?php do { ?>
    <url>
    <loc><?php echo $row_url['url']; ?>proje-<?php echo $row_projeler['id']; ?>-<?php echo permalink($row_projeler['baslik']); ?></loc>
    <changefreq>always</changefreq>

    </url>
    <?php } while ($row_projeler = mysql_fetch_assoc($projeler)); ?>
    <?php do { ?>
    <url>
    <loc><?php echo $row_url['url']; ?>haber-<?php echo $row_haberler['id']; ?>-<?php echo permalink($row_haberler['baslik']); ?></loc>
    <changefreq>always</changefreq>

    </url>
    <?php } while ($row_haberler = mysql_fetch_assoc($haberler)); ?>
    <?php do { ?>
    <url>
    <loc><?php echo $row_url['url']; ?>iletisim-<?php echo $row_iletisim['id']; ?>-<?php echo permalink($row_iletisim['baslik']); ?></loc>
    <changefreq>always</changefreq>

    </url>
    <?php } while ($row_iletisim = mysql_fetch_assoc($iletisim)); ?>

    </urlset>
    <?php
    mysql_free_result($url);

    mysql_free_result($kurumsal);

    mysql_free_result($hizmetler);

    mysql_free_result($kategori);

    mysql_free_result($projeler);

    mysql_free_result($haberler);

    mysql_free_result($iletisim);
    ?>