<?php

// XML SITEMAP V1.0 - John Campbell - johnpcampbell1985@googlemail.com - http://www.aukseo.co.uk 
//
//To configure the sitemap follow 3 steps
// 1. add into the mysql_connect the location of the database normally local host, the user and password - line 16
// 2. add the main URL of the directory to $site - line 17 *** make sure you leave a trailing slash e.g. http://www.domain.com/ and not http://www.domain.com ***
//
// e.g.
//
// $con = mysql_connect("localhost","addictiz_sitemap","goood52146");
// $site = 'http://www.addictionire.com/';
// 
// 3. Add in the name of the database $dbname 
// 4. Upload file to the server

$con = mysql_connect("localhost","addictiz_sitemap","goood52146");
$site = 'http://www.addictionire.com/';
$dbname = 'addictiz_sitemap';
$today = date("Y-m-d");

if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db($dbname, $con);

echo '<?xml version="1.0" encoding="UTF-8"?>';
echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
echo '<url>';
    echo '<loc>'.$site.'</loc>';
    echo '<lastmod>'.$today.'</lastmod>';
    echo '<changefreq>daily</changefreq>';
   echo ' <priority>1</priority>';
echo '</url>';

echo '<url>';
    echo '<loc>'.$site.'add.php</loc>';
    echo '<lastmod>'.$today.'</lastmod>';
    echo '<changefreq>monthly</changefreq>';
   echo ' <priority>0.1</priority>';
echo '</url>';

echo '<url>';
    echo '<loc>'.$site.'latest-links.html</loc>';
    echo '<lastmod>'.$today.'</lastmod>';
    echo '<changefreq>monthly</changefreq>';
   echo ' <priority>0.1</priority>';
echo '</url>';

echo '<url>';
    echo '<loc>'.$site.'premium-links.html</loc>';
    echo '<lastmod>'.$today.'</lastmod>';
    echo '<changefreq>monthly</changefreq>';
   echo ' <priority>0.1</priority>';
echo '</url>';

echo '<url>';
    echo '<loc>'.$site.'contact.php</loc>';
    echo '<lastmod>'.$today.'</lastmod>';
    echo '<changefreq>monthly</changefreq>';
   echo ' <priority>0.1</priority>';
echo '</url>';

$result = mysql_query("SELECT * FROM categories");

while($row = mysql_fetch_array($resul1))
  {
echo '<url>';
    echo '<loc>'.$site.$row['catpath'].'/</loc>';
    echo '<lastmod>'.$today.'</lastmod>';
    echo '<changefreq>monthly</changefreq>';
   echo ' <priority>0.75</priority>';
echo '</url>';

  }

$resultb = mysql_query("SELECT * FROM link WHERE approved ='yes'");

while($rowb = mysql_fetch_array($resul1b))
  {
  
  echo '<url>';
    echo '<loc>'.$site.'info/'.$rowb['id'].'.html</loc>';
    echo '<lastmod>'.$today.'</lastmod>';
    echo '<changefreq>monthly</changefreq>';
   echo ' <priority>0.5</priority>';
echo '</url>';

  }

echo '</urlset>';
mysql_close($con);

?> 

