//_GeneralFunction.php function WriteHeader($sPageTitle, $sHeader, $sSubHead, $sKeyWords)
$sKeyWords = 'Grateful Dead, Setlist, database, setlists, songs, the dead, jerry garcia';
//_GeneralFunction.php function WriteHeader($sPageTitle, $sHeader, $sSubHead, $sKeyWords)
$sKeyWords = 'Grateful Dead, Setlist, database, setlists, songs, the dead, jerry garcia';
WriteHeader('Grateful Dead Setlist Database by Kory Hurst', 'Grateful Dead', $sSubHead, $sKeyWords);
//content goes here
//sample content
// i need custom classes for the rest of the site here, actually can probable correct the
// default class in this style, as the intext ul with >> is junk.
$sSQL = 'select SongNotes as Guest, count(*) as Appearances  ';
$sSQL = $sSQL . 'from tblsetlistsongdetailextranotes ';
$sSQL = $sSQL . 'where SongNotes like "%with%" ';
$sSQL = $sSQL . 'group by SongNotes ';
$sSQL = $sSQL . 'order by count(*) desc ';
//echo $sSQL;
$aGuests = GetRS($sSQL);
//Print2DArray($aGuests);
echo '<div id="content" class="narrowcolumn">' . $GLOBALS['NewLine'];
echo '<div class="post">' . $GLOBALS['NewLine'];
//because we are matching up to Word Press we use post, but it is just a section
echo '<div id="entry">' . $GLOBALS['NewLine'];
echo '<table>';
echo '<tr>';
echo '<td valign="top">';
echo '<ul>';
foreach ($aGuests as $aGuest) {
    echo '<li><a href="guestdetails.php?Guest=' . $aGuest['Guest'] . '">' . $aGuest['Guest'];
    echo ' Appearances = ' . $aGuest['Appearances'];
    echo '</a></li>';
}
echo '</td>';
} elseif ($sSortBy == 'SongText') {
    $sSubHead = 'Songs by Title';
}
$sKeyWords = 'Grateful Dead, Setlist, database, setlists, songs, the dead, jerry garcia';
WriteHeader('Grateful Dead Setlist Database by Kory Hurst', 'Grateful Dead', $sSubHead, $sKeyWords);
echo '<div id="content" class="narrowcolumn">' . $NewLine;
echo '<div class="post">' . $NewLine;
//because we are matching up to Word Press we use post, but it is just a section
echo '<div id="entry">' . $NewLine;
$sSQLSongs = 'select ts.SongID, SongText, MainVocals, count(*) as TimesPlayed ';
$sSQLSongs = $sSQLSongs . 'from tblsong as ts inner join tblsetlistsongdetail td ';
$sSQLSongs = $sSQLSongs . 'on ts.SongID = td.SongID ';
$sSQLSongs = $sSQLSongs . 'group by SongID, SongText, MainVocals ';
$sSQLSongs = $sSQLSongs . 'order by ' . $sSortBy . ' ' . $sSortOrder;
//echo $sSQLSongs ;
$aSongs = GetRS($sSQLSongs);
//Print2dArray(aSongs);
//content goes here
//echo floor(count($aSongs)/2);
echo '<table>';
echo '<tr>';
echo '<td valign="top">';
echo '<ul>';
$iSongCount = 0;
foreach ($aSongs as $aSong) {
    $iSongCount = $iSongCount + 1;
    //echo $iSongCount ;
    if ($iSongCount == floor(count($aSongs) / 3) or $iSongCount == 2 * floor(count($aSongs) / 3)) {
        echo '</ul>';
        echo '</td>';
        echo '<td valign="top">';
		Basic
*/
include "_Vars.php";
$sSortOrder = $_GET["SortOrder"];
$sSortBy = $_GET["SortBy"];
WriteHeader('Personal Site of Kory Hurst', 'Kory Hurst', 'Home', 'science, web development, experiments');
echo '<div id="content" class="narrowcolumn">' . $NewLine;
echo '<div class="post">' . $NewLine;
//because we are matching up to Word Press we use post, but it is just a section
echo '<div id="entry">' . $NewLine;
$sSQLJams = 'select JamID, JamText, count(*) as TimesPlayed ';
$sSQLJams = $sSQLJams . 'from tblJam ';
$sSQLJams = $sSQLJams . 'group by JamID ';
$sSQLJams = $sSQLJams . 'order by ' . $sSortBy . ' ' . $sSortOrder;
//echo $sSQLJams ;
$aSongs = GetRS($sSQLJams);
//Print2dArray(aSongs);
//content goes here
//echo floor(count($aSongs)/2);
echo '<table>';
echo '<tr>';
echo '<td valign="top">';
echo '<ul>';
foreach ($aSongs as $aSong) {
    $iSongCount = $iSongCount + 1;
    //echo $iSongCount ;
    if ($iSongCount == floor(count($aSongs) / 2)) {
        echo '</ul>';
        echo '</td>';
        echo '<td valign="top">';
        echo '<ul>';
include "_Vars.php";
$sSubHead = 'Shows By Tape Rank';
//_GeneralFunction.php function WriteHeader($sPageTitle, $sHeader, $sSubHead, $sKeyWords)
$sKeyWords = 'Grateful Dead, Setlist, database, setlists, songs, the dead, jerry garcia';
WriteHeader('Grateful Dead Setlist Database by Kory Hurst', 'Grateful Dead', $sSubHead, $sKeyWords);
//content goes here
//sample content
// i need custom classes for the rest of the site here, actually can probable correct the
// default class in this style, as the intext ul with >> is junk.
$sSQL = 'select ShowID, ShowDate, ShowName, Venue, TapeRank, GotIT ';
//$sSQL = $sSQL . 'from tblShow as ts inner join tblVenue as tv on ts.VenueId = tv.VenueID ';
$sSQL = $sSQL . 'from vwshow ';
$sSQL = $sSQL . 'where TapeRank > 0 ';
$sSQL = $sSQL . 'order by TapeRank asc';
//echo $sSQL;
$aShows = GetRS($sSQL);
//Print2DArray($aShows);
echo '<div id="content" class="narrowcolumn">' . $GLOBALS['NewLine'];
echo '<div class="post">' . $GLOBALS['NewLine'];
//because we are matching up to Word Press we use post, but it is just a section
echo '<div id="entry">' . $GLOBALS['NewLine'];
echo '<table>';
echo '<tr>';
echo '<td valign="top">';
echo '<ul>';
foreach ($aShows as $aShow) {
    echo '<li><a href="show.php?ShowID=' . $aShow['ShowID'] . '">';
    echo $aShow['TapeRank'] . ' - ' . $aShow['ShowName'] . ' (' . $aShow['Venue'] . ')';
    if ($aShow['GotIT'] == 1) {
        echo ' * ';
    }
echo '<div class="post">' . $NewLine;
//because we are matching up to Word Press we use post, but it is just a section
echo '<div id="entry">' . $NewLine;
//echo 'Man this query needs tuning.';
$sSQLSong = 'select SongText, MainVocals from tblSong where SongID = ' . $iSongID;
$sSQLTimesPlayed = 'select tsh.ShowID, ShowDate, City ';
$sSQLTimesPlayed = $sSQLTimesPlayed . 'from tblSetListSongDetail tsd ';
$sSQLTimesPlayed = $sSQLTimesPlayed . 'inner join tblSetList tse on tsd.SetListID = tse.SetListID ';
$sSQLTimesPlayed = $sSQLTimesPlayed . 'inner join tblShow tsh on tse.ShowID = tsh.ShowID ';
$sSQLTimesPlayed = $sSQLTimesPlayed . 'inner join tblVenue tv on tv.VenueID = tsh.VenueID ';
$sSQLTimesPlayed = $sSQLTimesPlayed . 'where SongID = ' . $iSongID . ' ';
$sSQLTimesPlayed = $sSQLTimesPlayed . 'order by ShowDate asc ';
//echo $sSQLSong ;
//echo $sSQLTimesPlayed ;
$aSong = GetRS($sSQLSong);
$aTimesPlayed = GetRS($sSQLTimesPlayed);
$aSongFirst = $aTimesPlayed[0];
$aSongLast = $aTimesPlayed[count($aTimesPlayed) - 1];
//Print2dArray($aSong);
//content goes here
//This is a bit fragile, as it assumes only one row returned.
//Should be fine as query is based on identity column,
//but a little error prevention might be wise.
echo '<h2>' . $aSong[0]['SongText'];
if ($aSong[0]['MainVocals'] != '') {
    ' - ' . $aSong['MainVocals'] . '</h2>';
}
echo '<h3>';
echo '<table>';
echo '<tr>';
echo '<td>Times Played</td>';
//This is to recycle this page for use in registration
//basically to retrieve the UserID, which was created during
//the registration insert
if (isset($_SESSION['UserName'])) {
    print_r($_SESSION);
    $UserName = $_SESSION["UserName"];
    $Password = $_SESSION["Password"];
} else {
    $UserName = $_POST["UserName"];
    $Password = hash('sha256', $_POST["Password"]);
}
//probably worth getting the password too (once it is hashed)
//for use on password resets
$sSQLUser = "******";
$sSQLUser = $sSQLUser . "where UserName = '******' and Password = '******'";
$aUser = GetRS($sSQLUser);
//echo $sSQL ;
if (count($aUser) == 0) {
    echo $sSQL;
    echo "<br><br>User Not Validated";
    //maybe this can still go back to the main page with a session variable for
    //login error - to be used in WriteLoginBox function
    //header('Location: ' . 'LoginError.php');
} else {
    $_SESSION['UserID'] = $aUser[0]['UserID'];
    $_SESSION['FirstName'] = $aUser[0]['FirstName'];
    $_SESSION['LastName'] = $aUser[0]['LastName'];
    GetApplicationSpecificDetails($_SESSION['UserID']);
    //$sUserID = $search[0];
    //echo $sUserID;
    //echo $_SESSION['UserID'];