<html>
<head>
<title>Staff Advisory Committee Election Ballot</title>
</head>
<body>

<?php
	$dbserver = 'libitdb.lang.uc.edu';
	$dbuser = 'phpadmin';
	$dbpass = '25or624';
	$db = 'systems';
	$sqlConn = @mysql_connect($dbserver, $dbuser, $dbpass) or die("Couldn't connect to server");
	$dbConn = @mysql_select_db($db, $sqlConn) or die("Couldn't select database: $db");
	
	$sql_vote = "SELECT LName, FName, auth, email FROM sacTEST ORDER BY LName";
	$vote_result = @mysql_query($sql_vote, $sqlConn) or die("Couldn't execute query. $sql_vote");
	
	while ($row = mysql_fetch_array($vote_result))
	{
		$lname = $row['LName'];
		$fname = $row['FName'];
		$auth = $row['auth'];
		$email = $row['email'];
		$mail_to = $email;
		$mail_subj = "Staff Advisory Committee Election Ballot.";
		$mail_text = "It is time to vote for two new SAC representatives.  You may vote for two of the nominated staff members between October 16th and October 31st.  Voting ends at midnight on October 31st.\n" .
		             "\n" .
                 "The Staff Advisory Committee has two (2) openings. \n" .
			           "\n" .
			           "The two openings are for a full two year term and will be filled by the two nominees who receive the highest number of votes. \n" .
								 "\n" . 
		             "You may only vote once.  So, please be careful.  Even though the fact that you voted is recorded, the nominees you vote for are not.  Since the nominees you vote for are not recorded, there is no way to go back and redo your vote.  So, again, please vote carefully. \n" .
	  						 "\n" .
	               "Login Instructions: \n" .
                 "1. Select your Username from the drop down box of eligible voters. \n" .
                 "2. Enter Auth Code in the space provided. \n" .
                 "------------------------------------------- \n" .
                 "Your Username is:  " . $lname.",". $fname . " \n" .
                 "Your Auth Code is:  " . $auth . " \n" .
								 " \n" .
								 "Click here to vote http://ul.uc.edu/groups/SAC/elections/vote/ \n" ;
  
	
		$mail_header = "From: sac@mail.libraries.uc.edu\r\n";
		$mail_header .= "X-Mailer: server\r\n";
		$mail_header .= "Reply To: sac@mail.libraries.uc.edu\r\n";
		$sendmail_param = "sac@mail.libraries.uc.edu";
		
		mail("$mail_to","$mail_subj","$mail_text","$mail_header","-f$sendmail_param");
	}
	echo"Mail sent successfully.";

?>
</body>
</html>
