these should come from the settings table in database $stage = $stages['vote']; $year = "2007"; // var initializations $error = false; $error_fields = array(0=>false); $error_count = 0; $success = false; /* CONTROLLERS */ if($_POST['submit']) { switch($stage) { /* NOMINATIONS */ case $stages['nominate']: // Send Email Nomination // this should go into a database late $to = 'nominations@aigany.org'; $subject = 'Board Nomination'; $headers = 'From: "'.strip_tags($_POST['name']).'" <'. strip_tags($_POST['email']) . ">\r\n"; $message = "NOMINEE:\r\n".strip_tags($_POST['nominee'])."\r\n\r\n"; $message .= "CONTACT:\r\n".strip_tags($_POST['contact'])."\r\n\r\n"; $message .= "COMPANY:\r\n".strip_tags($_POST['company'])."\r\n\r\n"; $message .= "DISCIPLINE:\r\n".strip_tags($_POST['discipline'])."\r\n\r\n"; $message .= "WHY:\r\n".strip_tags($_POST['notes'])."\r\n\r\n"; if( mail($to, $subject, $message, $headers) ) $success = "

Thank You

Thanks for participating in the nominating process. Your nomination has been forwarded to the New York Chapter board officers for ballot consideration. The ballot will be posted in April for ratification by the membership.

"; break; /* VOTING */ case $stages['vote']: if( !isset($_POST['vote']) ) { $error .= '
  • You need to cast a vote.
  • '; $error_count++; array_push($error_fields,'vote'); } if( isset($_POST['vote']) and !($_POST['vote']=='y' or $_POST['vote']=='n') ) { $error .= '
  • That is an invalid vote.
  • '; $error_count++; array_push($error_fields,'vote'); } if( !isset($_POST['memberid']) or $_POST['memberid']=='' ) { $error .= '
  • You need to specify you member ID.
  • '; $error_count++; array_push($error_fields,'memberid'); } if( $_POST['memberid']!='' and !preg_match("/[0-9]{4,5}/",$_POST['memberid']) ) { $error .= '
  • Please enter a valid member ID. Only AIGA New York members in good standing are allowed to vote.
  • '; $error_count++; array_push($error_fields,'memberid'); } if( $_POST['memberid']!='' ) { $r = mysql_query("SELECT * FROM boardselection_votes WHERE year='{$year}' AND memberid=".quote_smart($_POST['memberid'])); if( mysql_num_rows($r) > 0 ) { $error .= '
  • This member ID has already been used to cast a vote. You can only vote once.
  • '; $error_count++; array_push($error_fields,'memberid'); } } if ( $error ) { if ( $error_count == 1 ) { $error = "

    There is a problem with your submission:

    "; } if ( $error_count > 1 ) { $error = "

    There are {$error_count} problems with your submission:

    "; } } else { // insert into database if ( mysql_query("INSERT INTO boardselection_votes (year,memberid,vote,ipaddress) VALUES ({$year},".quote_smart($memberid).",".quote_smart($vote).",'$REMOTE_ADDR')") ) $success = "

    Thank You

    Thanks for participating in the ratification process. Your vote has been cast. The final board nominees will be posted in June.

    "; else $error = "

    ERROR

    Sorry, there has been a technical problem. Please try again later.

    "; } break; default: die("Sorry, an error occurred."); } } /* VIEWS */ ?> AIGA New York
    The board nomination and ratification period is over. The current board is now hard at work on chapter business.

    "; break; case $stages['nominate']: include("board/_nominate.html"); break; case $stages['counting']: echo "

    The votes are in and we are currently tallying the results. The new slate of nominees will be announced so, and then ratification will begin.

    "; break; case $stages['vote']: include("board/_vote.html"); echo "


    "; include("board/_newboard.html"); break; case $stages['done']: break; } /* */ ?>