'$24.95 Monthly Subscription - USA', "R48FYMPQZERHL" => '$37.95 Monthly Subscription - Canada', "EHB7RQWVVTDGN" => '$10.95 Flat Monthly Subscription - USA', "563NYVML6ZK22" => '$15.95 Flat Monthly Subscription - Canada', "RRY6W5DACJ4PW" => '$28.95 Postcard Yearly Subscription - USA', "7WH9NQUE8SYM8" => '$39.95 Postcard Yearly Subscription - Canada' ); $page = 'subscribe_buyer_info.php'; $fields = array( 'subscriber_name', 'subscriber_email', 'kid_name', 'kid_gender', 'kid_dob_m', 'kid_dob_d', 'kid_dob_y', 'kid_address', 'kid_city', 'kid_state', 'kid_zip', 'kid_interests', 'kid_collections', 'kid_colors', 'kid_characters', 'kid_foods', 'kid_allergies', 'plan_code' ); $defaults = array('plan_code' => 'HSAQYT2CUXYXA'); # Grab from session or set default foreach ($fields as $field ) { if ( isset($_SESSION[$field]) ) { $$field = $_SESSION[$field]; } else { if ( isset($defaults[$field]) ) { $$field = $defaults[$field]; } else { $$field = ''; } } } if ( isset($_SESSION['selected_holidays']) && is_array($_SESSION['selected_holidays']) ) { $selected_holidays = $_SESSION['selected_holidays']; } else { $selected_holidays = array(); } $holidays = array(); $sql = "SELECT * FROM holidays ORDER BY holiday_month ASC"; $rs = mysql_query($sql); if (! mysql_error() ) { while ( $row = mysql_fetch_array($rs) ) { $holidays[$row['holiday_id']] = $row; } } else { die("Couldn't get holidays, " . mysql_error()); } if ( isset($_POST['action']) && $_POST['action'] == 'subscribe' ) { # subscriber info $subscriber_name = trim($_POST['subscriber_name']); if (! isset($subscriber_name) || ! strlen($subscriber_name) ) { $errors[] = 'Please enter your name.'; } $subscriber_email = trim($_POST['subscriber_email']); if ( isset($subscriber_email) && strlen($subscriber_email) ) { $subscriber_email = trim($_POST['subscriber_email']); if (! IsValidEmail($subscriber_email) ) { $errors[] = 'The email address you entered does not appear to be valid.'; } } else { $errors[] = 'Please enter your email address.'; } # kid info $kid_name = trim($_POST['kid_name']); if (! isset($kid_name) || ! strlen($kid_name) ) { $errors[] = "Please enter the child's name."; } # plan info $plan_code = trim($_POST['plan_code']); $selected_holidays = array(); if ( isset($plan_code) || ! strlen($plan_code) ) { if ( isset($REQUIRE_HOLIDAYS[$plan_code]) ) { if ( is_array($_POST['holiday']) ) { foreach ( $_POST['holiday'] as $holiday_id ) { if ( isset($holidays[$holiday_id]) ) { $selected_holidays[] = $holiday_id; } else { $errors[] = "Invalid holiday submitted. How did that even happen?"; } } if ( count($selected_holidays) != $REQUIRE_HOLIDAYS[$plan_code] ) { $errors[] = "Please select " . $REQUIRE_HOLIDAYS[$plan_code] . " holidays"; } } else { $errors[] = "Please select the holidays for which cards should be sent"; } } } else { $errors[] = "Please select a plan."; } # Save to session $page_fields = array('subscriber_name', 'subscriber_email', 'kid_name', 'plan_code'); foreach ($page_fields as $field ) { $_SESSION[$field] = $$field; } $_SESSION['selected_holidays'] = $selected_holidays; if ( sizeof($errors) === 0 ) { $page = 'subscribe_child_info.php'; } } elseif ( isset($_POST['action']) && $_POST['action'] == 'kid' ) { $page = 'subscribe_child_info.php'; $kid_name = trim($_POST['kid_name']); if (! isset($kid_name) || ! strlen($kid_name) ) { $errors[] = "Please enter the child's name."; } if ( trim($_POST['kid_gender']) == 'M' ) { $kid_gender = 'M'; } else { $kid_gender = 'F'; } if ( is_numeric($_POST['kid_dob_m']) && $_POST['kid_dob_m'] > 0 && $_POST['kid_dob_m'] <= 12 ) { $kid_dob_m = $_POST['kid_dob_m']; } else { $errors[] = "Please tell us the child's birth month"; } if ( is_numeric($_POST['kid_dob_d']) && $_POST['kid_dob_d'] > 0 && $_POST['kid_dob_d'] <= 31 ) { $kid_dob_d = $_POST['kid_dob_d']; } else { $errors[] = "Please tell us the child's birth day"; } $Y = date('Y'); if ( is_numeric($_POST['kid_dob_y']) && $_POST['kid_dob_y'] >= $Y - 14 && $_POST['kid_dob_y'] <= $Y ) { $kid_dob_y = $_POST['kid_dob_y']; } else { $errors[] = "Please tell us the child's birth year"; } $kid_address = trim($_POST['kid_address']); if (! isset($kid_address) || ! strlen($kid_address) ) { $errors[] = 'We need your address to send you mail!'; } $kid_city = trim($_POST['kid_city']); if (! isset($kid_city) || ! strlen($kid_city) ) { $errors[] = "We need to know your city, or we'll never find you! "; } $kid_state = trim($_POST['kid_state']); if (! isset($kid_state) || ! strlen($kid_state) ) { $errors[] = "What state do you even live in?"; } $kid_zip = trim($_POST['kid_zip']); if (! isset($kid_zip) || ! strlen($kid_zip) ) { $errors[] = "What is your zip code? "; } $kid_interests = trim($_POST['kid_interests']); if (! isset($kid_interests) || ! strlen($kid_interests) ) { $errors[] = "Please give us some hints about your child's interrests"; } $kid_collections = trim($_POST['kid_collections']); $kid_colors = trim($_POST['kid_colors']); $kid_characters = trim($_POST['kid_characters']); $kid_foods = trim($_POST['kid_foods']); $kid_allergies = trim($_POST['kid_allergies']); # Save to session $page_fields = array( 'kid_name', 'kid_gender', 'kid_dob_m', 'kid_dob_d', 'kid_dob_y', 'kid_address', 'kid_city', 'kid_state', 'kid_zip', 'kid_interests', 'kid_collections', 'kid_colors', 'kid_characters', 'kid_foods', 'kid_allergies', ); foreach ($page_fields as $field ) { $_SESSION[$field] = $$field; } if ( sizeof($errors) === 0 ) { $page = 'subscribe_confirm.php'; } } elseif ( isset($_POST['action']) && $_POST['action'] == 'confirm' ) { #### Save the subscriber info ### if ( sizeof($errors) === 0 ) { $sql = "INSERT INTO subscribers (dateadded,name,email) VALUES ( NOW(), '" . AddSlashes($subscriber_name) . "', '" . AddSlashes($subscriber_email) . "' )"; mysql_query($sql); if (! mysql_error()) { $sql = "SELECT last_insert_id() AS subscriber_id FROM subscribers"; $rs = mysql_query($sql); if (! mysql_error()) { if ($row = mysql_fetch_array($rs) ) { $subscriber_id = $row['subscriber_id']; $_SESSION['subscriber_id'] = $subscriber_id; } else { $errors[] = 'ERROR: Lost the subscriber ID, ' . mysql_error(); } } else { $errors[] = "ERROR: Couldn't get the subscriber ID, " . mysql_error(); } } else { $errors[] = 'ERROR: Could not add subscriber to database, ' . mysql_error(); } } #### Save the kid info ### if ( sizeof($errors) === 0 ) { $kid_dob = $kid_dob_y . '-' . $kid_dob_m . '-' . $kid_dob_d; $sql = "INSERT INTO kids ( dateadded, subscriber_id, plan_code, name, gender, dob, address, city, state, zip, interests, collections, colors, characters, foods, allergies ) VALUES ( NOW(), '" . AddSlashes($subscriber_id) . "', '" . AddSlashes($plan_code) . "', '" . AddSlashes($kid_name) . "', '" . AddSlashes($kid_gender) . "', '" . AddSlashes($kid_dob) . "', '" . AddSlashes($kid_address) . "', '" . AddSlashes($kid_city) . "', '" . AddSlashes($kid_state) . "', '" . AddSlashes($kid_zip) . "', '" . AddSlashes($kid_interests) . "', '" . AddSlashes($kid_collections) . "', '" . AddSlashes($kid_colors) . "', '" . AddSlashes($kid_characters) . "', '" . AddSlashes($kid_foods) . "', '" . AddSlashes($kid_allergies) . "' )"; mysql_query($sql); if (! mysql_error()) { $sql = "SELECT last_insert_id() AS kid_id FROM kids"; $rs = mysql_query($sql); if (! mysql_error()) { if ($row = mysql_fetch_array($rs) ) { $kid_id = $row['kid_id']; $_SESSION['kid_id'] = $kid_id; $sql = "DELETE FROM kid_holiday_link WHERE kid_id=$kid_id"; mysql_query($sql); foreach ( $selected_holidays as $holiday_id ) { $sql = "INSERT INTO kid_holiday_link (kid_id, holiday_id) VALUES ($kid_id, $holiday_id)"; mysql_query($sql); } $page = 'subscribe_paypal.php'; } else { $errors[] = 'ERROR: Lost the kid ID, ' . mysql_error(); } } else { $errors[] = "ERROR: Couldn't get the kid ID, " . mysql_error(); } } else { $errors[] = 'ERROR: Could not add kid to database, ' . mysql_error(); } } } function IsValidEmail ($address) { return ( preg_match( '/^[-!#$%&\'*+\\.\\/0-9=?A-Z^_`a-z{|}~]+' . '@' . '[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.' . '[-!#$%&\'*+\\.\\/0-9=?A-Z^_`a-z{|}~]+$/', $address )); } ?> Rabbit Post Children's Mail Subscription Service, Personalized for Children aged 3-18
Rabbit Post Personalized Mail Subscription Service for Children aged 3-18

All children love receiving regular mail!

At Rabbit Post Personalized Mail Subscription Service,
we love sending happy mail to children, making every letter and package
extra special for each individual girl and boy, from toddlers to teens.