function format_poll_header($current_poll, $category) { $category = str_replace('Tv', 'TV', $category); $category = $current_poll == 'unnecessary_sequels' ? $category . ' or Reboots ' : $category; $saddest = $current_poll == 'celebrity_deaths' ? ' Saddest ' : ''; $suffix = $current_poll != 'most_anticipated_albums' ? ' of this Year' : ' for next Year'; return "Vote for Your Top <span id=\"max_pick\">" . max_picks_for($current_poll) . "</span> " . $saddest . $category . $suffix; }
/*Redirect to be used after year end poll*/ header("Location: http://www.ynotradio.net/pages.php?page=top215of2015"); die; $page_file = "yearendpoll.php"; $page_title = "Year End Poll"; require "functions/main_fns.php"; require "functions/year_end_poll_fns.php"; require "partials/_header.php"; $ip = $_SERVER['REMOTE_ADDR']; $current_poll = $_GET['poll']; $polls = get_poll_names(); $votes = $_POST['year_end_votes']; $poll_form = $_POST['poll']; $vote_count = $_POST['write_in_value'] == '' ? count($votes) : count($votes) + 1; if ($vote_count != max_picks_for($poll_form)) { echo "<div class=\"row\" id=\"flash\">\n\n <div class=\"twelve columns top-spacer_20 center error\">Wow, this is embarrassing...<br>It seems that you didn't pick enough, please try again.</div>\n\n \n</div>"; } else { if (has_voted($ip, $poll_form) == false) { $insert = add_votes_for($poll_form, $votes); if ($poll_form == 'songs') { add_song_votes_for($ip, $votes, $_POST['write_in_value']); } if ($_POST['write_in_value']) { $insert = add_manual_vote_for($ip, $poll_form, $_POST['write_in_value']); } if ($insert) { add_ip($ip, $poll_form); echo "<div class=\"row\" id=\"flash\">\n\n <div class=\"twelve columns top-spacer_20 center success\">Thanks!<br>Your votes have been recorded!</div>\n\n \n</div>"; } }
<?php $poll_values = get_values($current_poll); $category = ucwords(str_replace("_", " ", $current_poll)); $column_names = get_column_names($current_poll); echo "<h2 class=\"center top-spacer_20\">" . format_poll_header($current_poll, $category) . "</h2>\n\n <form action=\"yearendpoll.php\" method=\"post\" name=\"year_end_" . $current_poll . "\" class=\"form-default\">\n <fieldset>\n<div class=\"control-group\">\n<div class=\"controls\">\n"; for ($i = 1; $i <= mysql_num_rows($poll_values); $i++) { $info = mysql_fetch_assoc($poll_values); echo "<label for=\"" . $info['id'] . "\" class=\"half\"><input type=\"checkbox\" name=\"year_end_votes[]\" id=\"" . $info['id'] . "\" value=\"" . $info['id'] . "\">"; for ($c = 1; $c <= count($column_names) - 2; $c++) { echo "<span>" . $info[$column_names[$c]]; if ($column_names[$c + 1] != 'votes') { echo " - "; } } echo "\n</span>\n</label>\n"; } echo "</div>\n<div class=\"control-group top-spacer_20\">\n\n <div class=\"controls\">\n\n <input type=\"checkbox\" id=\"song_write_in\"> <input type=\"text\" disabled=\"disabled\" class=\"input-xl\" id=\"write_in_value\" name=\"write_in_value\">\n\n <div class=\"form-other\">Other (please specify)</div>\n</div>\n</div>\n\n </div>\n<div class=\"form-actions\">\n<button class=\"btn-info disabled\" type=\"submit\" disabled=\"disabled\" id=\"vote\">Pick " . max_picks_for($current_poll) . " more!</button>\n\n <input type=\"hidden\" name=\"poll\" value=" . $current_poll . ">\n</div>\n\n </form>\n</div>\n</fieldset>";