-
Notifications
You must be signed in to change notification settings - Fork 5
/
rssnewplayers.php
60 lines (43 loc) · 1.84 KB
/
rssnewplayers.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
// RSS Feed - Newest Players
// Version 1.09
$page = "rssfeed";
$time = time();
require('conf/variables.php');
require_once 'rss_generator.inc.php';
$selfUrl = (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on' ? 'http://' : 'https://');
$selfUrl .= $_SERVER['HTTP_HOST'];
// if ($row[Confirmation] != "" AND $row[Confirmation] != "Ok")
$sql = "SELECT name, country, joined FROM $playerstable ORDER BY player_id DESC LIMIT 0,20";
$result = mysqli_query($db, $sql);
// Lets start using the class...
$rss_channel = new rssGenerator_channel();
$rss_channel->atomLinkHref = '';
$rss_channel->title = 'New PLayers';
$rss_channel->link = $selfUrl;
$rss_channel->description = 'The newest players at Ladder of Wesnoth.';
$rss_channel->language = 'en-us';
$rss_channel->generator = 'PHP RSS Feed Generator';
$rss_channel->managingEditor = '[email protected] (eye)';
$rss_channel->webMaster = '[email protected] (eye)';
while ($row = mysqli_fetch_array($result)) {
$item = new rssGenerator_item();
$item->title = $row['name'];
$describtiontxt = "";
// What, except for the name, will we show in the description?
if ($row['country'] != "No country") {
$describtiontxt = $describtiontxt . " - " . $row['country'];
}
// if ($row[LastGame] != "") { $describtiontxt = $describtiontxt . "<br>Last game: " . $row[LastGame]; }
$item->description = $describtiontxt;
$item->link = $selfUrl . '/profile.php?name=' . $row['name'];
$item->guid = $selfUrl . '/profile.php?name=' . $row['name'];
//$item->pubDate = 'Tue, 07 Mar 2006 00:00:01 GMT';
$item->pubDate = date("D, d M Y H:i:s", $row['joined']) . " GMT";
$rss_channel->items[] = $item;
}
$rss_feed = new rssGenerator_rss();
$rss_feed->encoding = 'UTF-8';
$rss_feed->version = '2.0';
header('Content-Type: text/xml');
echo $rss_feed->createFeed($rss_channel);