AlaK4X
Linux lhjmq-records 5.15.0-118-generic #128-Ubuntu SMP Fri Jul 5 09:28:59 UTC 2024 x86_64



Your IP : 3.149.214.28


Current Path : /var/www/lhjmq-records.qc.ca/public_html/
Upload File :
Current File : /var/www/lhjmq-records.qc.ca/public_html/xmlresults.php

<?php
/**
 * Copyright (C) 2006 Netsimplify Solutions, Inc.
 *
 * This page returns games results for the current day in an XML format. 
 *
 * Based on RDS (Reseau des sports) requirements
 *
 * 20060907 sb@netsimplify
 *
 */

include("includes/mysql_server_setup.php");

// Misc settings
$today = date("Y-m-d");
$period = array("A", "1", "2", "3", "OT1", "OT2", "OT3", "OT4", "OT5", "OT6");

// Set the appropriate content-type for an XML document
header("Content-Type: text/xml");

// XML header
echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n";
echo "<games>\n";

// Select games that are scheduled for today
$result = mysql_query("SELECT nom_equipe_dom, nom_equipe_vis, heure_match, match_fin, periode, but_vis, but_dom FROM parties WHERE date_match = '" . $today . "'", $mysql_link);

// For each game, output our <game></game> block
while ($row = mysql_fetch_assoc($result)) {
	echo " <game ligue=\"lhjmq\" date=\"" . $today . "\" heure=\"" . $row["heure_match"] . "\">\n";
	echo "  <awayteam>" . $row["nom_equipe_vis"] . "</awayteam>\n";
	echo "  <hometeam>" . $row["nom_equipe_dom"] . "</hometeam>\n";
	echo "  <awayscore>" . $row["but_vis"] . "</awayscore>\n";
	echo "  <homescore>" . $row["but_dom"] . "</homescore>\n";
	// Period can be either A (avant-match), 1, 2, 3, OT1, OT2... OT6, F (ended)
	echo "  <period>";
	if ($row["match_fin"] !== "00:00:00") echo "F"; // Ended
	else echo $period[$row["periode"]];
	echo "</period>\n";
	echo " </game>\n";
}

// Done
echo "</games>";

// Close database connection
mysql_close($mysql_link);
?>