<?php

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

	//echo "$monday";

  if ($monday >= 1020 and $monday <= 1024)
	{
	  $db_name = "systems";
  	$table_name = "sacTEST";

   	//Create a connection
	  $connection = @mysql_connect("libitdb.lang.uc.edu", "phpadmin", "25or624") 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 * FROM $table_name ORDER BY LName" ;

	  //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
	  {
		echo "

      <HTML>
      <HEAD>
      <TITLE>SAC Nomination Acceptance</TITLE>
      </HEAD>
      <BODY>

      <H1>Nominee Authentication:</H1>
      <p>Please select your name from the drop down box below and then enter the authorizationtion code provided to you via email.</p>

      <FORM METHOD=\"post\" ACTION=\"SAC_accept.php\">

      <TABLE CELLSPACING=\"3\" CELLPADDING=\"3\">
        <TR>
          <TD height=\"125\" VALIGN=TOP><P><STRONG>Staff Member's Last Name:</STRONG><BR>
            <select name=\"FLName\">
              <option selected value=\"\">Select <b>Your</b> Last Name.......</option>
			 ";
			  	while ($row = @mysql_fetch_array($sql_result)) {
					$FName = $row[FName];
					$LName = $row[LName];
					$numkey = $row[numkey];
					$blank = " ";
					$FLName = $FName.$blank.$LName;
					
					  echo "<option value=\"$numkey\">$FLName</option>";
				  }
		   echo "
            </select>
            <p>
				     Enter Your Authorization Code: <input type=\"text\" name=\"auth\" size=30> 
            </p>
            <P>
              <INPUT TYPE=\"SUBMIT\" NAME=\"submit\" VALUE=\"Submit Authentication\">
            </P>
          </TD>
        </TR>
        <TR>
          <TD width=\"904\" height=\"125\" VALIGN=TOP> <P>&nbsp;
          </TD>
        </TR>
      </TABLE>
  
    </FORM>

    </BODY>
    </HTML>
    ";
 
    }
  }
  else if ($monday <= 1020 and $monday >= 1024)
  {
    echo "<center>
            <p>SAC elections are held once a year.  This year...</p>
            </br>
            <p>SAC Nominations may be made between October 20th and October 24th.</p>
            </br>
            <p>The SAC election period is between October 24th and October 31st.</p>
          </center>";
  }
  else
  {
    echo "<center>
            <p>SAC elections are held once a year.  Starting in 2008...</p>
            </br>
            <p>SAC Nominations may be made between October 20th and October 24th.</p>
            </br>
            <p>The SAC election period is between October 25th and October 31st.</p>
          </center>";
  }
?>
