<?php
header("Content-type: application/xml");

$t = time();
$t2 = 300*floor($t/300);
$t4 = $t2+175;

$db = mysqli_connect("localhost","ChitICR","sI56_Kse-fpI(zznvR","ChitICR") or die('-5');
$r = $db->query("SELECT Host FROM `DomainDetail` left join Domain on Domain.ID=DomainDetail.DomainID WHERE `Rating` = 'Unknown' and UTCAdded<date_add(now(),interval -3 day)");
$h2='';
while($r2=$r->fetch_assoc()){
 $h2.='<url><loc>https://icr.chit.eu/request/'.$r2['Host'].'</loc><priority>0.29000</priority></url>';
}

$r = $db->query("SELECT Host FROM `DomainDetail` left join Domain on Domain.ID=DomainDetail.DomainID WHERE DomainID>=36803 and DomainID<=36953");
while($r2=$r->fetch_assoc()){
 $h2.='<url><loc>https://icr.chit.eu/check/'.$r2['Host'].'</loc><priority>0.26000</priority></url>';
}

$r = $db->query("SELECT Host FROM `DomainDetail` left join Domain on Domain.ID=DomainDetail.DomainID WHERE Target in ('AllChildren','YoungChildren','TeenageChildren','YoungAdults','Learners') and Level<=4");
while($r2=$r->fetch_assoc()){
 $h2.='<url><loc>https://icr.chit.eu/check/'.$r2['Host'].'</loc><priority>0.22000</priority></url>';
}

$db->close();

$h='<?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>https://icr.chit.eu/</loc>
  <priority>0.95000</priority>
 </url>'.$h2.'</urlset>';
echo $h;
?>
