<?php
	$db_name = "systems";
	$table_name = "sacTEST";

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

	$today="";
	$FLName = $_POST['FLName'];
	$authtext = $_POST['auth'];
	//echo"$authtext";
	//echo"$FLName";
	$connection = @mysql_connect("libitdb.lang.uc.edu", "phpadmin", "25or624")
		or die("Couldn't connect to database server");

	$query= "SELECT * FROM $table_name WHERE (numkey=\"$FLName\")";

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

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

		while ($row = mysql_fetch_array($result)) {
			$auth = $row['auth'];
			$FName = $row[FName];
					$LName = $row[LName];
					$blank = " ";
					$FLNametext = $FName.$blank.$LName;

    	}
    $auth2 = "yes";
	if ($authtext == $auth) {
	$Nominee = $FLNametext . " authenticated.";
 	echo "
  <html>
  <head>
  <title>Staff Advisory Committee Nomination Acceptance Form</title>
  </head>
  <body>
  <h1 align=\"center\">Staff Advisory Committee Nomination Acceptance Form</h1>
  <center>
  <p>$Nominee</p>  
  <p></p>  
  <p>Select either ACCEPT or DECLINE.</p>  
  <p>Thank you for participating.</p>  
  <FORM METHOD=\"post\" ACTION=\"SACaccept.php\">

  <TABLE CELLSPACING=\"3\" CELLPADDING=\"3\">
    <TR>
      <TD height=\"125\" VALIGN=TOP>
        <p>
	  			<input type=\"hidden\" name=\"FLName\" value=\"$FLName\"><BR>
	  			<input type=\"hidden\" name=\"auth\" value=\"$auth\"><BR> 
        </p>
        <p>
          <INPUT type=\"radio\" name=\"accepted\" value=\"yes\">ACCEPT<BR>
          <INPUT type=\"radio\" name=\"accepted\" value=\"no\">DECLINE<BR>
        </p>
        <P>
          <INPUT TYPE=\"SUBMIT\" NAME=\"submit\" VALUE=\"Submit Ballot\">
        </P></TD>
      </TR>
      <TR>
        <TD width=\"904\" height=\"125\" VALIGN=TOP> <P>&nbsp;
          </TD>
      </TR>
    </TABLE>
  
  </FORM>

  </body>
  </html>
  "; 
  }
  else {
	  $Nominee = $FLName . " not authenticated.";
    echo "
      <html>
      <head>
      <title>Staff Advisory Committee Nomination Acceptance Form</title>
      </head>
      <body>
      <center>
      <h1 align=\"center\">$FLName Please Try Again.</h1>
      <p></p>
      <p>If the problem persists, please contact Cherie Matchan at 556-1404.  Thank You.</p>
      </center>
      </body>
      </html>
      "; 
    }
 
?>
