<?php
require '../include/gnomoradio.inc';
my_header(array('title'=>'Add Song', 'topdir'=>'../', 'page'=>'artists/lone-song.php'));

if (substr($url, 0, 7) == 'http://') {
$r = pg_exec($db, "select * from lone_songs where url='$url'");
if (pg_numrows($r) == 0) {
mail('garrison@case.edu', 'LONE SONG', $url, 'From: LONE SONG <garrison@case.edu>');
pg_exec($db, "insert into lone_songs (url) values ('$url')");
?>
<p>Thank you for submitting a song.  It will be added to the list of recommended songs shortly.</p>
<?php
} else {
?>
<p>This song is already in the database.</p>
<?php
}
} else {
echo '<p>URL syntax is not valid.  Please go back and try again.</p>', "\n";
}

echo '<p><a href="./">Back to artists\' page</a></p>', "\n";
my_footer(array());
?>
