<?php
	$day = date("d");
	$mon = date("m");
	$monday = $mon * 100 + $day;

	$db_name = "systems";
	$table_name = "sacTEST";

	//Create a connection
	$connection = @mysql_connect("libitdb.lang.uc.edu", "sac", "staffstuff") or die("Couldn't connect to database server.");

	//Select a database
	$db = @mysql_select_db($db_name, $connection) or die("Couldn't select $db_name database ");

	//SQL statement
	$query= "SELECT FLName, email FROM $table_name ORDER BY FLName" ;


	//execute SQL query and get result
	$sql_result = @mysql_query($query, $connection) or die ("Couldn't execute query. <p>$query</p>");

	if (!$sql_result) {
		echo "<p>couldn't get list! $sql_result</p>";
	}
	else
	{

    if ($monday >= 1001 and $monday <= 1015)
    {
       echo "<center> <a href=\"http://ul.uc.edu/groups/SAC/elections/nominate/SACnom.php\"> ";
       echo "Nominate someone for to serve on SAC.</a></center>";
    }
    else if ($monday >= 1016 and $monday <= 1031) 
    {
       echo "<center> <a href=\"http://ul.uc.edu/groups/SAC/elections/vote/SACvote.php\"> ";
		   echo "Vote for SAC members.</a></center>";
    }
    else
   		echo "

    <HTML>
    <HEAD>
    <TITLE>SAC Nominee Selection</TITLE>
    </HEAD>
    <BODY>

      <H1>Select a SAC Nominee</H1>
      <FORM METHOD=\"post\" ACTION=\"SAC_bylname.php\">


      <TABLE CELLSPACING=\"3\" CELLPADDING=\"3\">
      <TR>
        <TD height=\"125\" VALIGN=TOP><P><STRONG>Staff Member's Name:</STRONG><BR>
           <select name=\"FLName\">
           <option selected value=\"\">Select.......</option>
		   	";
				while ($row = @mysql_fetch_array($sql_result)) {
					$FLName = $row[FLName];

					echo "<option>$FLName</option>";
			  	}
	      	echo "
          </select>
          <P>
            <INPUT TYPE=\"SUBMIT\" NAME=\"submit\" VALUE=\"Submit Nomination\">
          </P>
        </TD>
      </TR>
      <TR>
        <TD width=\"904\" height=\"125\" VALIGN=TOP> <P>&nbsp;
        </TD>
      </TR>
    </TABLE>

   </FORM>

   </BODY>
   </HTML>
   ";
  }
?>
