Andrew Tomaka
b7fb4c8ced
Implement xml-generator.php that will automatically generate XML files from the database based on an ID passed in a get query. This allows new calls to be added using new MP3s without having to create a new XML file by hand everytime. This is the first step to a full web implementation.
20 lines
No EOL
419 B
PHP
20 lines
No EOL
419 B
PHP
<?php
|
|
|
|
$id = isset($_GET['id']) ? $_GET['id'] : 'bad';
|
|
|
|
if(!filter_var($id, FILTER_VALIDATE_INT)) {
|
|
die("\n");
|
|
}
|
|
|
|
$db = new PDO('sqlite:db/songcaller.db');
|
|
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
|
|
|
$result = $db->query("SELECT mp3 FROM calls WHERE id=$id LIMIT 1");
|
|
|
|
$row = $result->fetch();
|
|
|
|
header('Content-Type: text/xml');
|
|
?>
|
|
<Response>
|
|
<Play><?php echo $row['mp3']; ?></Play>
|
|
</Response>
|