$start_month) ) { header("Location: /25years/content/sorry"); } elseif ( $yr_diff == 16 && ($dob_month == $start_month) && ($dob_day > $start_day) ) { header("Location: /25years/content/sorry"); } } $formname = 'narutomoviebondssweeps'; $contestenddate = "9/16/2011"; $errors = array(); // Initialize error message array $entered_fields = array(); $data_fields = array('name' => 'Name', // Set up form field array - name/display name 'address' => 'Address', 'city' => 'City', 'state' => 'State', 'zip' => 'ZIP', 'email' => 'E-mail', 'dob_month' => 'Month', 'dob_day' => 'Day', 'dob_year' => 'Year', 'opt-out' => 'Mailing list Opt-Out', 'partner-opt-out' => 'Mailing list Opt-Out'); foreach ($data_fields as $field => $field_name) { // Make array from previously submitted data, if any $entered_fields[$field] = isset($_REQUEST[$field]) ? htmlentities(trim($_REQUEST[$field])) : ''; } function validate_zipcode($zipcode) { // Check zip for correct format, 5 or 5+4 return preg_match("/^[0-9]{4}/", $zipcode); } function validate_email($email) { // Check for @ symbol and a character or two return preg_match("/^[^\@]+\@[^\@\.]+\.[^\@\.]+/", $email); } function validate_date($mon, $day, $yr) { // Make sure month/day/year combination is valid return checkdate($mon, $day, $yr); } function validate_text_field($value) { // Check for blank fields if ( strlen(trim($value)) > 0 ) { return true; } else { return false; } } function validate_form() { // Validate received form data //global $entered_fields; //global $errors; if ( ! validate_text_field($_REQUEST['name']) ) { $errors['name'] = "Your name must be supplied."; } if ( ! validate_text_field($_REQUEST['address']) ) { $errors['address'] = "Address must not be blank."; } if ( ! validate_text_field($_REQUEST['city']) ) { $errors['city'] = "City must not be blank."; } if ( ! validate_text_field($_REQUEST['state']) ) { $errors['state'] = "State must not be blank."; } //if ( ! validate_zipcode($_REQUEST['zip']) ) { if ( ! validate_text_field($_REQUEST['zip']) ) { $errors['zip'] = "ZIP Codes or Candaian Postal Codes must not be blank."; } if ( ! validate_email($_REQUEST['email']) ) { $errors['email'] = "Email address must be in user@server.com format."; } if ( isset($_REQUEST['dob_month']) || isset($_REQUEST['dob_day']) || isset($_REQUEST['dob_year']) ) { if ( ! validate_date($_REQUEST['dob_month'], $_REQUEST['dob_day'], $_REQUEST['dob_year']) ) { $errors['dob'] = "You have entered an invalid date."; } else { $start_month = intval( date("m") ); $start_day = intval( date("d") ); $start_year = date("Y"); $yr_diff = $start_year - $entered_fields['dob_year']; $dob = $entered_fields['dob_month']."-".$entered_fields['dob_day']."-".$entered_fields['dob_year']; setcookie('dob', $dob); if ( $yr_diff < 16 ) { $errors['coppa'] = "You must be 16 or over to participate in this sweepstakes."; header("Location: /25years/content/sorry"); } elseif ( $yr_diff == 16 && ($entered_fields['dob_month'] > $start_month) ) { $errors['coppa'] = "You must be 16 or over to participate in this sweepstakes."; header("Location: /25years/content/sorry"); } elseif ( $yr_diff == 16 && ($entered_fields['dob_month'] == $start_month) && ($entered_fields['dob_day'] > $start_day) ) { $errors['coppa'] = "You must be 16 or over to participate in this sweepstakes."; header("Location: /25years/content/sorry"); } $capture_age = $yr_diff; if ( $entered_fields['dob_month'] > $start_month ) { $capture_age = $capture_age - 1; } else if ( ($entered_fields['dob_month'] == $start_month) && ($entered_fields['dob_day'] > $start_day) ) { $capture_age = $capture_age - 1; } } } if ( count($errors) == 0 ) { // If no errors, mail data submit_data(); } return $errors; } function error_email($body) { mail ('andy.wang@viz.com', 'naruto movie bonds sweepstakes error', $body, "From: website_robot@viz.com\r\n"); } function submit_data() { //global $mysqlhost; //global $HTTP_SERVER_VARS; print "Saw a Submit!!"; // set up vars to make query easier $name = trim($_REQUEST['name']); $address = trim($_REQUEST['address']); $city = trim($_REQUEST['city']); $state = trim($_REQUEST['state']); $zip = trim($_REQUEST['zip']); $email = trim($_REQUEST['email']); $month = trim($_REQUEST['dob_month']); $day = trim($_REQUEST['dob_day']); $year = trim($_REQUEST['dob_year']); $gender = trim($_REQUEST['gender']); if ( trim($_REQUEST['opt-out']) == "opt-out" ) { $opt_in = "Y"; } else { $opt_in = "N"; } if ( trim($_REQUEST['partner-opt-out']) == "partner-opt-out" ) { $partner_opt_in = "Y"; } else { $partner_opt_in = "N"; } // connect to db // insert (email on error) //mysql_connect($mysqlhost, 'viz', 'vi004rts') or error_email ("'could not connect\n" . mysql_error()); //mysql_select_db('viz'); $query = "insert viz_narutomoviebondssweeps "; $query .= "(date, ip_address, name, address, city, state, zip, email, day, month, year, opt_in, partner_opt_in, gender)"; $query .= "values "; $query .= "(now(), '$HTTP_SERVER_VARS[REMOTE_ADDR]', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')"; db_query($query,$name,$address,$city,$state,$zip,$email,$day,$month,$year,$opt_in,$partner_opt_in,$gender) or error_email("insert failed\n$query\n" . mysql_error()); // now redirect to thanks page header("Location:/25years/content/thanks"); } // If the script has received form data, validate it if ( isset($_REQUEST['name']) ) { $errors = validate_form(); } ?>

For our 25th year, we’re paying homage to the biggest heroes in anime with the Heroes of Anime Sweepstakes. Every month this summer we’ll award one lucky fan the latest Bleach or Naruto video games, or the latest DVD set from the biggest names in anime today. Get your entry in by September for a chance at winning a 16 GB iPad 2 with a month of Hulu Plus (great for watching the latest episodes of Bleach and Naruto) or the Heroes of Anime Sweepstakes Grand Prize: a trip for two to the Naruto Shippuden the Movie: Bonds premeire in New York, NY.

Click here for official rules. Open to US and Canadian residents only.

This contest ended on September 15, 2011. Please check back soon for the winners.

"; } ?>
 
\n"; echo " \n"; echo " \n"; echo " \n"; } ?> \n"; echo " \n"; echo " \n"; echo " \n"; } ?> \n"; echo " \n"; echo " \n"; echo " \n"; } ?> \n"; echo " \n"; echo " \n"; echo " \n"; } ?> \n"; echo " \n"; echo " \n"; echo " \n"; } ?> \n"; echo " \n"; echo " \n"; echo " \n"; } ?>

"; echo $errors['name']; echo "

*

Name:

"; echo $errors['address']; echo "

*

Address:

"; echo $errors['city']; echo "

*

City:

"; echo $errors['state']; echo "

*

State/Provinces:

"; echo $errors['zip']; echo "

*

ZIP:

"; echo $errors['email']; echo "

*

E-mail:

*

Date of Birth:

(Must be 13 and older)

Male Female

Yes, I am interested in receiving information, advertising and promotional materials related to VIZ Media, SHONEN JUMP and/or their business partners as well as any related products, services, news, events, contests, promotions and special offers via email.

Yes, I am interested in receiving information, advertising and promotional materials related to VIZ Media, SHONEN JUMP and/or their business partners as well as any related products, services, news, events, contests, promotions and special offers via postal mail.

By entering, I hereby agree that I have had the chance to review the official rules and privacy policy and agree to be bound by both of them.