// Version 1.0
// 14:44 02.11.2009
session_start();
include_once("db-inc.php");
$sortfield = "datum";
$bilderdir = "pictures";
$banner = "images/Title1.jpg";
if (($_GET['language']!="de")&&($_GET['language']!="fr")){
header( 'Location: http://darkplaces.org' ) ;
die();
}
// Statistik in DB eintragen
function checkBot($string) {
$bots = array(
'bot', 'spider', 'spyder', 'crawl', 'robo', 'agentname',
'altaVista intranet', 'appie', 'arachnoidea', 'asterias',
'beholder', 'bumblebee', 'cherrypicker', 'cosmos', 'openxxx',
'fido', 'crescent', 'emailsiphon', 'emailwolf', 'extractorpro',
'gazz', 'gigabaz', 'gulliver', 'hcat', 'hloader', 'incywincy',
'infoseek', 'inktomi', 'link', 'internetami', 'internetseer',
'scan', 'fireball', 'larbin', 'libweb', 'trivial', 'mata hari',
'medicalmatrix', 'mercator', 'miixpc', 'moget', 'muscatferret',
'slurp', 'quosa', 'scooter', 'sly', 'webbandit', 'spy', 'wisewire',
'ultraseek', 'piranha', 't-h-u-n-d-e-r-s-t-o-n-e', 'indy library',
'ezresult', 'informant', 'swisssearch', 'sqworm',
'ask jeeves/teoma', 'libwww'
);
$string = strtolower($string);
$i = 0;
$summe = count($bots);
while ($i < $summe) {
if ( strstr($string, $bots[$i])) return true;
$i++;
}
return false;
}
if (isset($_SERVER['HTTP_USER_AGENT'])){ $user_agent = ($_SERVER['HTTP_USER_AGENT']); } else { $b4yc_user_agent = ""; }
if (!checkBot(user_agent)) {
$ip = $_SERVER['REMOTE_ADDR'];
$conn_id = @mysql_connect($datenbankserver, $datenbankuser, $datenbankpasswort);
@mysql_select_db($datenbankname,$conn_id);
$result = @mysql_query("SELECT counter FROM rss_statistics where ip = '".$ip."'");
$c = 0;
while($row = @mysql_fetch_array($result)) {
if ($row != null)
$c = $row['counter'];
}
$timestamp = time();
$datum = date("H:i:s",$timestamp) . " " . date("d.m.Y",$timestamp);
if ($c==0) {
$eintrag = "INSERT INTO rss_statistics (`date`, ip, counter) VALUES ('".$datum."','" . $ip . "', 1)";
} else {
$c = $c + 1;
$eintrag = "UPDATE rss_statistics set counter = $c" . ", `date` = '".$datum."' where ip = '". $ip ."'";
}
@mysql_query($eintrag);
// -- Statistick Ende
}
function sortdate($a, $b) {
return strnatcasecmp($b["datum"],$a["datum"]);
}
$xml = new DOMDocument('1.0', 'UTF-8');
$xml->formatOutput = true;
$roo = $xml->createElement('rss');
$roo->setAttribute('version', '2.0');
$roo->setAttribute('xmlns:atom', 'http://www.w3.org/2005/Atom');
$xml->appendChild($roo);
$cha = $xml->createElement('channel');
$roo->appendChild($cha);
$r2 = $xml->createElement('atom:link');
$r2->setAttribute('href', 'http://www.darkplaces.org'.$_SERVER['REQUEST_URI']);
$r2->setAttribute('rel', 'self');
$r2->setAttribute('type', 'application/rss+xml');
$cha->appendChild($r2);
$hea = $xml->createElement('title', utf8_encode('Darkplaces.org'));
$cha->appendChild($hea);
$hea = $xml->createElement('link', htmlentities('http://darkplaces.org'));
$cha->appendChild($hea);
$hea = $xml->createElement('copyright', 'Alex Ries');
$cha->appendChild($hea);
if ($_GET['language']=="de") {
$hea = $xml->createElement('description', utf8_encode($rss_desc_de));
}
if ($_GET['language']=="fr") {
$hea = $xml->createElement('description', utf8_encode($rss_desc_fr));
}
$cha->appendChild($hea);
$hea = $xml->createElement('image');
$h2 = $xml->createElement('url', htmlentities('http://www.darkplaces.org/'.$banner));
$hea->appendChild($h2);
$h2 = $xml->createElement('title',utf8_encode('Darkplaces.org'));
$hea->appendChild($h2);
$h2 = $xml->createElement('link',htmlentities('http://darkplaces.org'));
$hea->appendChild($h2);
$cha->appendChild($hea);
//var_dump($filteredlist);
$conn_id = @mysql_connect($datenbankserver, $datenbankuser, $datenbankpasswort);
@mysql_select_db($datenbankname,$conn_id);
$result = mysql_query("select * from news order by timestamp DESC limit 10");
$c = 0;
while (($row = mysql_fetch_object($result))&&($c<10)) {
$c = $c + 1;
//echo $row->description_de."
";
$itm = $xml->createElement('item');
// $itm->setAttribute('guid', crc32("$row->title_de"));
if ($_GET['language']=="de") {
$hea = $xml->createElement('title', utf8_encode(html_entity_decode(html_entity_decode($row->title_de))));
}
if ($_GET['language']=="fr") {
$hea = $xml->createElement('title', utf8_encode(html_entity_decode(html_entity_decode($row->title_fr))));
}
$itm->appendChild($hea);
$hea = $xml->createElement('pubDate', utf8_encode(date("D, j M Y H:i:s ",$row->timestamp).'GMT'));
$itm->appendChild($hea);
if ($_GET['language']=="de") {
if ($row->thumbnail!=null) {
$hea = $xml->createElement('description', utf8_encode(htmlentities(html_entity_decode($row->description_de))."