holiday celebrations | days & dates | fun & wacky daily holidays | holiday travel | holiday blog | holiday greeting cards | holiday recipes | email | holiday home

Holidays on the Net
Email Newsletter and Text Messaging Services
isRegistered() && $dms_user->active === 'N') return; echo '
Name:
Email Address:
Cellphone #: - -
Cellphone Carrier:
Timezone:
 
Subscriptions:
'; foreach (DMS_MessageCategory::retrieve_all(array('public' => 'Y')) as $dms_category) { echo '
'; if ($dms_user->receives($dms_category)) { echo '  ', $dms_category->name, '
'; if (FALSE === strstr($dms_category->name, '(SMS)')) { echo '

To ensure delivery to your inbox, please add "'.$dms_category->default_from_email_address.'" to your email address book.

'; } } else { echo '  ', $dms_category->name, '
'; } echo '
', $dms_category->description, '
'; } echo '
  '; if ($dms_user->isRegistered()) { echo ' '; } else { echo ' '; } echo '
'; } // accepting a POST happens under two conditions // 1. an unregistered user creates his account by POSTing the form // 2. a registered+verified/active user updates his account by POSTing the form function dms_handle_post(DMS_User $dms_user) { if (isset($_POST['dms_user_delete']) && TRUE === $dms_user->isRegistered() && $dms_user->active === 'Y') { $dms_user->delete(); mail('info@holidays.net', 'HON - DMS User Account Cancellation', preg_replace('/^\t+/ms', '', ' The following user has cancelled his/her account: Account: Name: '.$dms_user->name.' Email: '.$dms_user->email_address.' Cell #: '.$dms_user->cellphone_nr.' Carrier: '.(($dms_user->cellphone_carrier instanceof DMS_SMSCarrier) ? $dms_user->cellphone_carrier->name : 'None chosen (yet?)').' Timezone: '.$dms_user->timezone.' The user was subscribed to the following categories: '.join($dms_user->getSubscribedCategoryNames(), "\r\n ").' This mail sent by '.__FILE__.' at '.date('r').' (at line 320) -- Thanks, Holidays on the Net ') ); throw new DMSPublicBailOut('Your account has been removed.'); } if (FALSE === isset($_POST['dms_user_submit'])) { return; } if (TRUE === $dms_user->isRegistered() && $dms_user->active === 'N') { // don't accept post from registered-but-not-activated account return; } if (FALSE === $dms_user->isRegistered()) { // additional checks, no DMS exceptions will be caught here. $dms_check_email = preg_replace('/[^a-z0-9@\._-]/', '', $_POST['dms_user_email_address']); try { $dms_existing_email = DMS_User::retrieve(array('email_address' => $dms_check_email)); throw new DMSPublicException('Sorry, that email address is already in use!'); } catch (SimpleCRUDException $e) { } $dms_test_new_uid = substr(preg_replace('/[^a-z0-9]/', '', $_GET['dms_uid']), 0, 40); if (strlen($dms_test_new_uid) !== 40) { throw new DMSPrivateException('Invalid ID-HASH'); } try { $dms_existing_id_hash = DMS_User::retrieve(array('id_hash' => $dms_test_new_uid)); throw new DMSPrivateException('Existing ID-HASH'); } catch (SimpleCRUDException $e) { } $dms_user->id_hash = $dms_test_new_uid; } $_POST['dms_user_name'] = preg_replace('/[^\sA-Za-z\'\.-]/', '', $_POST['dms_user_name']); $_POST['dms_user_email_address'] = preg_replace('/[^a-z0-9@\._-]/i', '', $_POST['dms_user_email_address']); $_POST['dms_user_cellphone_nr_part1'] = preg_replace('/[^0-9]/', '', $_POST['dms_user_cellphone_nr_part1']); $_POST['dms_user_cellphone_nr_part2'] = preg_replace('/[^0-9]/', '', $_POST['dms_user_cellphone_nr_part2']); $_POST['dms_user_cellphone_nr_part3'] = preg_replace('/[^0-9]/', '', $_POST['dms_user_cellphone_nr_part3']); $_POST['dms_user_cellphone_carrier'] = preg_replace('/[^0-9]/', '', $_POST['dms_user_cellphone_carrier']); $_POST['dms_user_timezone'] = substr(preg_replace('/[^A-Z]/', '', $_POST['dms_user_timezone']), 0, 3); if (FALSE === in_array($_POST['dms_user_timezone'], array('EST', 'CST', 'MST', 'PST'))) { $_POST['dms_user_timezone'] = 'EST'; } $dms_user->timezone = $_POST['dms_user_timezone']; if (empty($_POST['dms_user_email_address'])) { throw new DMSPublicException('Empty email address!'); } $dms_user->name = $_POST['dms_user_name']; $dms_user->email_address = $_POST['dms_user_email_address']; $dms_user->cellphone_nr = $_POST['dms_user_cellphone_nr_part1'] . $_POST['dms_user_cellphone_nr_part2'] . $_POST['dms_user_cellphone_nr_part3']; try { if ($_POST['dms_user_cellphone_carrier'] > 0) { $dms_user->cellphone_carrier = DMS_SMSCarrier::retrieve(array('id' => $_POST['dms_user_cellphone_carrier'])); } else { throw new Exception(); //This one gets caught just below } } catch (Exception $e) { $dms_user->cellphone_carrier = 0; } if (sizeof(preg_grep('/^dms_subscribe_\d/', array_keys($_POST))) === 0) { if ($dms_user->getDbId() < 1) { throw new DMSPublicException('No categories selected!'); } } else { foreach (DMS_MessageCategory::retrieve_all(array('public' => 'Y')) as $dms_category) { if (isset($_POST['dms_subscribe_'.$dms_category->getDbId()])) { if (FALSE === $dms_user->addSubscription($dms_category)) { if (strstr($dms_category->name, '(SMS)')) { //if (FALSE === ($dms_user->cellphone_carrier instanceof DMS_SMSCarrier && $dms_user->cellphone_carrier->getDbId() > 0) || $dms_user->cellphone_nr === '') { echo ''; //} } if ($dms_user->receives($dms_category)) { $dms_user->unsubscribe($dms_category); } } } else { $dms_user->unsubscribe($dms_category); } } } if (FALSE === $dms_user->isRegistered()) // new signup { $dms_user->save(); mail($dms_user->email_address, 'Holidays on the Net - Subscription Confirmation', preg_replace('/^\t+/ms', '', 'Dear '.$dms_user->name.' Thanks for subscribing to Holidays on the Net Email and Text Messaging Services! Please activate your account by visiting the following URL: http://www.holidays.net/dms/verify_email.php?token='.$dms_user->verify_token.' Once activated, you can edit your subscription at any time by visiting the following URL: http://www.holidays.net/hol_list.htm?dms_uid='.$dms_user->id_hash.' If you did not request this service, please cancel your account by visiting the following URL: http://www.holidays.net/dms/cancel_email.php?token='.$dms_user->verify_token.' Your subscriptions: '.join($dms_user->getSubscribedCategoryNames(), "\r\n ").' -- Thanks again for joining us as we celebrate the holidays of the year. Holidays on the Net (http://www.holidays.net) '), 'From: mail@holidays.net'."\r\n". 'Reply-To: mail@holidays.net'."\r\n". 'Content-type: text/plain'."\r\n". 'X-Mailer: DMS/1.0' ); mail('info@holidays.net', 'HON - New DMS Signup', preg_replace('/^\t+/ms', '', ' The following account has been registered: Date/Time: '.date('r').' Account: Name: '.$dms_user->name.' Email: '.$dms_user->email_address.' Cell #: '.$dms_user->cellphone_nr.' Carrier: '.(($dms_user->cellphone_carrier instanceof DMS_SMSCarrier) ? $dms_user->cellphone_carrier->name : 'None chosen (yet?)').' Timezone: '.$dms_user->timezone.' Subscriptions: '.join($dms_user->getSubscribedCategoryNames(), "\r\n ").' Database details: User ID: '.$dms_user->getDbId().' User ID Hash: '.$dms_user->id_hash.' Quick-Delete: http://holidays.net/dms/admin/quickdelete.php?userId='.$dms_user->getDbId().' This email was sent by '.__FILE__.' (at line 445) -- Thanks, Holidays on the Net (http://www.holidays.net) ') ); } else { $dms_user->save(); } } // main "page" output try { // set up our user $dms_user = NULL; if (isset($_GET['dms_uid'])) { try { $dms_user_id_hash = preg_replace('/[^a-z0-9]/ms', '', $_GET['dms_uid']); // characters whitelist filter $dms_user_id_hash = substr($dms_user_id_hash, 0, 40); // it's a sha1 hash, always 40 bytes. $dms_user = DMS_User::retrieve(array('id_hash' => $dms_user_id_hash)); // throws exception if object not found } catch (Exception $e) { if (isset($_POST['dms_user_submit'])) { $dms_user = NULL; } else { // if the form was not submitted but an id-hash is defined in $_GET, this is a BS request. throw new DMSPrivateException('Invalid ID-hash in GET'); } } } // if $dms_user is still NULL at this point, we are dealing with an unregistered user if (NULL === $dms_user) { $dms_user = new DMS_User(); } // if user came through leprechaun link, set email address if (isset($_POST['dms_leprechaun_link'])) { $dms_user->email_address = preg_replace('/[^a-z0-9@\._-]/', '', $_POST['dms_user_email_address']); } dms_handle_post($dms_user); // print the appropriate header if ($dms_user->isRegistered()) { if ($dms_user->active === 'N') { echo '

Thanks for signing up! You have been sent an email containing instructions on how to activate your account. Please review this email and click the button below once you\'ve activated your account.

'; } else { echo '

You can edit your subscription below. You can bookmark this page and return to edit your subscription at any time.

'; } } else { if (isset($_POST['dms_leprechaun_link'])) { echo '

Please complete your signup using the following form:

'; } else { echo '

Holidays on the Net now offers a number of Free text messaging (SMS) and email services to help you celebrate the Holidays! Please fill out the form below and choose which services you\'d like to receive.

'; } } if ($dms_user->isRegistered() && $dms_user->active === 'Y' && isset($_COOKIE['backlink'])) { echo '
'; } dms_show_form($dms_user); } catch (Exception $e) { if ($e instanceof DMSPublicBailOut) { echo '

', $e->getMessage(), '

'; } elseif ($e instanceof DMSPublicException) { echo '

', $e->getMessage(), '

'; echo '
'; } else { echo '

Sorry, an unknown error has occurred.

'; echo '
'; } } // // TODO: refactor! this is way too complicated. // // define('DMS_EXCEPTION_ERROR_PRIVATE', 1001); // Prints in red to visitor "Sorry, an unknown error has occurred" along with a "Try Again" button. // define('DMS_EXCEPTION_ERROR_PUBLIC', 1002); // Prints exception message in red to visitor along with a "Try Again" button. // define('DMS_EXCEPTION_BAIL_PUBLIC', 1003); // Bails out and prints a message in green to visitor. (return, basically) // // try { // $dms_new_signup = FALSE; // $dms_accept_post = TRUE; // // try { // if (isset($_POST['dms_uid'])) { // $dms_user_id_hash = substr(preg_replace('/[^a-z0-9]/msi', '', $_POST['dms_uid']), 0, 40); // $dms_user = DMS_User::retrieve(array('id_hash' => $dms_user_id_hash)); // } // elseif (isset($_GET['dms_uid'])) { // $dms_user_id_hash = substr(preg_replace('/[^a-z0-9]/msi', '', $_GET['dms_uid']), 0, 40); // $dms_user = DMS_User::retrieve(array('id_hash' => $dms_user_id_hash)); // } // else { // $dms_user = new DMS_User(); // $dms_accept_post = FALSE; // } // } // catch (Exception $e) { // if (isset($_POST['dms_user_submit'])) { // new signup passes uid in GET/POST which throws exception above // $dms_check_email = preg_replace('/[^a-z0-9@\._-]/', '', $_POST['dms_user_email_address']); // // try { // $dms_existing_email = DMS_User::retrieve(array('email_address' => $dms_check_email)); // } // catch (Exception $e) { // $dms_existing_email = FALSE; // } // // if ($dms_existing_email instanceof DMS_User) { // throw new Exception('Sorry, that email address is already in use!', DMS_EXCEPTION_ERROR_PUBLIC); // } // // $dms_user = new DMS_User(); // // $dms_test_new_uid = substr(preg_replace('/[^a-z0-9]/', '', $_POST['dms_uid']), 0, 40); // // if (strlen($dms_test_new_uid) !== 40) { // throw new Exception(NULL, DMS_EXCEPTION_ERROR_PRIVATE); // } // // $dms_user->id_hash = $dms_test_new_uid; // // $dms_new_signup = TRUE; // } // else { // throw new Exception(NULL, DMS_EXCEPTION_ERROR_PRIVATE); // } // } // // if ($dms_user->active === 'Y' && $dms_user->getDbId() > 0 && isset($_POST['dms_user_delete'])) { // $dms_user->delete(); // // throw new Exception('Your account has been removed.', DMS_EXCEPTION_BAIL_PUBLIC); // } // // if (TRUE === $dms_accept_post && isset($_POST['dms_user_submit'])) { // $_POST['dms_user_name'] = preg_replace('/[^ A-Za-z\'\.-]/', '', $_POST['dms_user_name']); // $_POST['dms_user_email_address'] = preg_replace('/[^a-z0-9@\._-]/', '', $_POST['dms_user_email_address']); // $_POST['dms_user_cellphone_nr'] = preg_replace('/[^0-9]/', '', $_POST['dms_user_cellphone_nr']); // $_POST['dms_user_cellphone_carrier'] = preg_replace('/[^0-9]/', '', $_POST['dms_user_cellphone_carrier']); // $_POST['dms_user_timezone'] = substr(preg_replace('/[^A-Z]/', '', $_POST['dms_user_timezone']), 0, 3); // // if (FALSE === in_array($_POST['dms_user_timezone'], array('EST', 'CST', 'MST', 'PST'))) { // $_POST['dms_user_timezone'] = 'EST'; // } // // if (empty($_POST['dms_user_email_address'])) { // throw new Exception('Empty email address!', DMS_EXCEPTION_ERROR_PUBLIC); // } // // $dms_user->name = $_POST['dms_user_name']; // $dms_user->email_address = $_POST['dms_user_email_address']; // $dms_user->cellphone_nr = $_POST['dms_user_cellphone_nr']; // // try { // if ($_POST['dms_user_cellphone_carrier'] > 0) { // $dms_user->cellphone_carrier = DMS_SMSCarrier::retrieve(array('id' => $_POST['dms_user_cellphone_carrier'])); // } // else { // throw new Exception(); //This one gets caught just below // } // } // catch (Exception $e) { // $dms_user->cellphone_carrier = 0; // } // // $dms_user->timezone = $_POST['dms_user_timezone']; // // foreach (DMS_MessageCategory::retrieve_all(array('public' => 'Y')) as $dms_category) { // if (isset($_POST['dms_subscribe_'.$dms_category->getDbId()])) { // $dms_user->addSubscription($dms_category); // } // else { // $dms_user->unsubscribe($dms_category); // } // } // // $dms_user->save(); // // if (TRUE === $dms_new_signup) { // // $subscriptions_list = ''; // // foreach (DMS_MessageCategory::retrieve_all() as $category) { // if ($dms_user->receives($category)) { // $subscriptions_list .= ' ' . $category->name . PHP_EOL; // } // } // // mail($dms_user->email_address, 'Holidays on the Net - Subscription Confirmation', // preg_replace('/^\t+/ms', '', // 'Dear '.$dms_user->name.' // // Thanks for subscribing to Holidays on the Net Email and Text Messaging Services! // // Please activate your account by visiting the following URL: // http://www.holidays.net/dms/verify_email.php?token='.$dms_user->verify_token.' // // If you did not request this service, please cancel your account by visiting the following URL: // http://www.holidays.net/dms/cancel_email.php?token='.$dms_user->verify_token.' // // Your subscriptions: // '.$subscriptions_list.' // // You can edit your subscription at any time by visiting http://www.holidays.net/hol_lists2.htm?dms_uid='.$dms_user->id_hash.' // // -- // Thanks again for joining us as we celebrate the holidays of the year. // Holidays on the Net (http://www.holidays.net) // '), // 'From: mail@holidays.net'."\r\n". // 'Reply-To: mail@holidays.net'."\r\n". // 'Content-type: text/plain'."\r\n". // 'X-Mailer: DMS/1.0' // ); // // mail('info@holidays.net', 'HON - New DMS Signup', // preg_replace('/^\t+/ms', '', // ' The following account has been registered: // // Date/Time: // '.date('r').' // // Account: // Name: '.$dms_user->name.' // Email: '.$dms_user->email_address.' // Cell #: '.$dms_user->cellphone_nr.' // Carrier: '.(($dms_user->cellphone_carrier instanceof DMS_SMSCarrier) ? $dms_user->cellphone_carrier->name : 'None chosen (yet?)').' // Timezone: '.$dms_user->timezone.' // // Database details: // User ID: '.$dms_user->getDbId().' // User ID Hash: '.$dms_user->id_hash.' // // This email was sent by '.__FILE__.' (Line 268) // // -- // Thanks, Holidays on the Net (http://www.holidays.net) // ') // ); // } // } // // echo ' // // '; // // /* // if ($dms_new_signup === TRUE) { // //echo '

Thanks for signing up! You can edit your subscription below. You can bookmark this page and return to edit your subscription at any time.

'; // } // else { // if (isset($_POST['dms_leprechaun_link'])) { // echo '

Please complete your signup using the following form:

'; // } // else { // echo '

Holidays on the Net now offers a number of Free text messaging (SMS) and email services to help you celebrate the Holidays! Please fill out the form below and choose which services you\'d like to receive.

'; // } // } // */ // // if ($dms_user->getDbId() > 0 && $dms_user->active === 'Y' && isset($_COOKIE['backlink'])) { // echo ' //
//
// //
//
// '; // } // // if ($dms_user->getDbId() > 0 && $dms_user->active === 'N') { // echo ' //

// Thanks for signing up! You have been sent an email containing instructions on how to activate // your account. Please review this email and click the button below once you\'ve activated your account. //

//
//
// // //
//
// '; // //echo '

You have been sent an email containing information on how to activate your subscription. You can edit your subscription once you\'ve activated it.

'; // } // else { // if (isset($_POST['dms_leprechaun_link'])) { // echo '

Please complete your signup using the following form:

'; // } // else { // if ($dms_user->getDbId() > 0) { // echo '

You can edit your subscription below. You can bookmark this page and return to edit your subscription at any time.

'; // } // else { // echo '

Holidays on the Net now offers a number of Free text messaging (SMS) and email services to help you celebrate the Holidays! Please fill out the form below and choose which services you\'d like to receive.

'; // } // } // echo ' //
// // // // // // // // // // // // // // // // // // // // // // //
// Name: // // //
// Email Address: // // //
// Cellphone #: // // //
// Cellphone Carrier: // // //
// Timezone: // // //
// // // // // // // // // //
//   // //
Subscriptions:
// '; // // foreach (DMS_MessageCategory::retrieve_all(array('public' => 'Y')) as $dms_category) { // echo ' //
// receives($dms_category)) // ? 'checked="checked"' // : '' // ) // ,'type="checkbox" name="dms_subscribe_', $dms_category->getDbId(), '" /> ', $dms_category->name, '
', // ((TRUE === $dms_user->receives($dms_category) && (FALSE === strstr($dms_category->name, '(SMS)'))) // ? '

To ensure delivery to your inbox, please add "'.$dms_category->default_from_email_address.'" to your email address book.

' // : '' // ) // ,' //
', $dms_category->description, '
//
// '; // } // // echo ' //
  // '; // // if ($dms_user->getDbId() > 0) { // echo ' // // // '; // } // else { // echo ' // // '; // } // // echo ' //
//
// '; // } // } // catch (Exception $e) { // if ($e->getCode() === DMS_EXCEPTION_BAIL_PUBLIC) { // echo '

', $e->getMessage(), '

'; // } // elseif ($e->getCode() === DMS_EXCEPTION_ERROR_PUBLIC) { // echo '

', $e->getMessage(), '

'; // echo '
'; // } // else { // echo '

Sorry, an unknown error has occurred.

'; // echo '
'; // } // } ?>

Please Note: It is Holidays on the Nets policy to never release your email address, phone number, or any other information. Your email address or cell phone # will only be used to send out notifications of upcoming celebrations and holidays related news!

We thank you for your support.