Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Installed Opt-Out Newsletter v1.0


Guest

Recommended Posts

I have tried to find specific info on this but cannot.

 

when I click on the unsubscribe button it tells me:

 

"The email address listed below, was not found in our newsletter database, or has already been removed from our newsletter subscription list."

 

However the email IS there, and to further make it confusing, I AM subscribed but it says I am not. I have tried it several times with different emails and names I have registered and it all comes out the same. I would not bother wondering why this is happening but I think it's a great way to tick off a customer that thinks they are either not in the database or have unsubscribed when in fact they have NOT. If this happens too many times to the wrong person it might be ugly. Any help is appreciated, thanks!

 

Tony

Link to comment
Share on other sites

Tony

 

Which screen are you on when you try to un-subscribe.

 

Can you post the code involved?

 

G

Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Link to comment
Share on other sites

Tony

 

Which screen are you on when you try to un-subscribe.

 

Can you post the code involved?

 

G

 

news_optout.php is the page, here is the code:

 

<?php

/*

$Id: Newsletter Opt-Out, v 1.0 (/catalog/news_optout.php) 2005/12/12

By: Skip Water (www.ccssinc.net)

 

Developed for osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

require('includes/application_top.php');

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_NEWS_OPTOUT);

$email_to_news_optout=$HTTP_GET_VARS['email'];

$breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_NEWS_OPTOUT, '', 'NONSSL'));

$filename_news_optout_done=FILENAME_NEWS_OPTOUT_DONE . "?email=" . $email_to_news_optout;

 

//

?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html <?php echo HTML_PARAMS; ?>>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

 

<?php

if ( file_exists(DIR_WS_INCLUDES . 'header_tags.php') ) {

require(DIR_WS_INCLUDES . 'header_tags.php');

} else {

?>

<title><?php echo TITLE ?></title>

<?php

}

?>

 

<base href="<?php echo (getenv('HTTPS') == 'on' ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">

<link rel="stylesheet" type="text/css" href="stylesheet.css">

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">

<!-- header //-->

<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

<!-- header_eof //-->

 

<!-- body //-->

<table border="0" width="100%" cellspacing="3" cellpadding="3">

<tr>

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- left_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>

<!-- left_navigation_eof //-->

</table></td>

<!-- body_text //-->

<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td class="main"><?php echo NEWS_OPTOUT_TEXT_INFORMATION; ?></td>

</tr>

</table></td>

</tr>

<tr>

<td align="center" class="main"><br><?php echo '<a href="' . tep_href_link($filename_news_optout_done, '', 'NONSSL') . '">' . tep_image_button('button_news_optout.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>

</tr>

</table></td>

<!-- body_text_eof //-->

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- right_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>

<!-- right_navigation_eof //-->

</table></td>

</tr>

</table>

<!-- body_eof //-->

 

<!-- footer //-->

<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>

<!-- footer_eof //-->

<br>

</body>

</html>

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

--------------------------------and this the final page when complete------------------------

 

<?php

/*

$Id: Newsletter Opt-Out, v 1.0 (/catalog/news_optout_done.php) 2005/12/12

By: Skip Water (www.ccssinc.net)

 

Developed for osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

require('includes/application_top.php');

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_NEWS_OPTOUT);

$email_to_news_optout=$HTTP_GET_VARS['email'];

 

// remove session for email lookup

$splitemail = explode("?", $email_to_news_optout);

$email_to_news_optout = $splitemail[0];

$session = $splitemail[1];

 

$breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_NEWS_OPTOUT, '', 'NONSSL'));

 

// Check and see if the email exists in the database, and is subscribed to the newsletter.

$cus_optout_raw = "SELECT 1 FROM customers WHERE customers_newsletter = '1' AND customers_email_address = '" . $email_to_news_optout . "'";

$cus_optout_query = tep_db_query($cus_optout_raw);

$cus_optout = tep_db_fetch_array($cus_optout_query);

?>

 

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html <?php echo HTML_PARAMS; ?>>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

 

<?php

if ( file_exists(DIR_WS_INCLUDES . 'header_tags.php') ) {

require(DIR_WS_INCLUDES . 'header_tags.php');

} else {

?>

<?php // ## Changed Header Tag Controler V2 ## ?>

<?php

if ( file_exists(DIR_WS_INCLUDES . 'header_tags.php') ) {

require(DIR_WS_INCLUDES . 'header_tags.php');

} else {

?>

<title><?php echo TITLE ?></title>

<?php

}

?>

<?php // ## End added ## ?>

<?php

}

?>

 

<base href="<?php echo (getenv('HTTPS') == 'on' ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">

<link rel="stylesheet" type="text/css" href="stylesheet.css">

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">

<!-- header //-->

<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

<!-- header_eof //-->

 

<!-- body //-->

<table border="0" width="100%" cellspacing="3" cellpadding="3">

<tr>

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- left_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>

<!-- left_navigation_eof //-->

</table></td>

<!-- body_text //-->

<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<?php

// If we found the customers email address, and they currently subscribe

if ($cus_optout) {

// Unsubscribe Opt-Out them

tep_db_query("UPDATE customers SET customers_newsletter = '0' WHERE customers_email_address = '" .$email_to_news_optout . "'");

?>

<td class="main"><?php echo NEWS_OPTOUT_DONE_TEXT_INFORMATION . $email_to_news_optout; ?></td>

<?php

// Otherwise, we want to display an error message

} else {

?>

<td class="main"><?php echo NEWS_OPTOUT_ERROR_INFORMATION . $email_to_news_optout; ?></td>

<?php

}

?>

 

</tr>

</table></td>

</tr>

<tr>

<td align="center" class="main"><br><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT, '', 'NONSSL') . '">' . tep_image_button('button_continue_shopping.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>

</tr>

</table></td>

<!-- body_text_eof //-->

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- right_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>

<!-- right_navigation_eof //-->

</table></td>

</tr>

</table>

<!-- body_eof //-->

 

<!-- footer //-->

<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>

<!-- footer_eof //-->

<br>

</body>

</html>

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

---------------------------------------

 

I dunno.....perplexed....any thoughts? thanks for the help!! :)

Link to comment
Share on other sites

news_optout.php is the page, here is the code:

 

<?php

/*

$Id: Newsletter Opt-Out, v 1.0 (/catalog/news_optout.php) 2005/12/12

By: Skip Water (www.ccssinc.net)

 

Developed for osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

require('includes/application_top.php');

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_NEWS_OPTOUT);

$email_to_news_optout=$HTTP_GET_VARS['email'];

$breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_NEWS_OPTOUT, '', 'NONSSL'));

$filename_news_optout_done=FILENAME_NEWS_OPTOUT_DONE . "?email=" . $email_to_news_optout;

 

//

?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html <?php echo HTML_PARAMS; ?>>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

 

<?php

if ( file_exists(DIR_WS_INCLUDES . 'header_tags.php') ) {

require(DIR_WS_INCLUDES . 'header_tags.php');

} else {

?>

<title><?php echo TITLE ?></title>

<?php

}

?>

 

<base href="<?php echo (getenv('HTTPS') == 'on' ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">

<link rel="stylesheet" type="text/css" href="stylesheet.css">

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">

<!-- header //-->

<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

<!-- header_eof //-->

 

<!-- body //-->

<table border="0" width="100%" cellspacing="3" cellpadding="3">

<tr>

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- left_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>

<!-- left_navigation_eof //-->

</table></td>

<!-- body_text //-->

<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td class="main"><?php echo NEWS_OPTOUT_TEXT_INFORMATION; ?></td>

</tr>

</table></td>

</tr>

<tr>

<td align="center" class="main"><br><?php echo '<a href="' . tep_href_link($filename_news_optout_done, '', 'NONSSL') . '">' . tep_image_button('button_news_optout.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>

</tr>

</table></td>

<!-- body_text_eof //-->

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- right_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>

<!-- right_navigation_eof //-->

</table></td>

</tr>

</table>

<!-- body_eof //-->

 

<!-- footer //-->

<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>

<!-- footer_eof //-->

<br>

</body>

</html>

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

--------------------------------and this the final page when complete------------------------

 

<?php

/*

$Id: Newsletter Opt-Out, v 1.0 (/catalog/news_optout_done.php) 2005/12/12

By: Skip Water (www.ccssinc.net)

 

Developed for osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

require('includes/application_top.php');

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_NEWS_OPTOUT);

$email_to_news_optout=$HTTP_GET_VARS['email'];

 

// remove session for email lookup

$splitemail = explode("?", $email_to_news_optout);

$email_to_news_optout = $splitemail[0];

$session = $splitemail[1];

 

$breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_NEWS_OPTOUT, '', 'NONSSL'));

 

// Check and see if the email exists in the database, and is subscribed to the newsletter.

$cus_optout_raw = "SELECT 1 FROM customers WHERE customers_newsletter = '1' AND customers_email_address = '" . $email_to_news_optout . "'";

$cus_optout_query = tep_db_query($cus_optout_raw);

$cus_optout = tep_db_fetch_array($cus_optout_query);

?>

 

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html <?php echo HTML_PARAMS; ?>>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

 

<?php

if ( file_exists(DIR_WS_INCLUDES . 'header_tags.php') ) {

require(DIR_WS_INCLUDES . 'header_tags.php');

} else {

?>

<?php // ## Changed Header Tag Controler V2 ## ?>

<?php

if ( file_exists(DIR_WS_INCLUDES . 'header_tags.php') ) {

require(DIR_WS_INCLUDES . 'header_tags.php');

} else {

?>

<title><?php echo TITLE ?></title>

<?php

}

?>

<?php // ## End added ## ?>

<?php

}

?>

 

<base href="<?php echo (getenv('HTTPS') == 'on' ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">

<link rel="stylesheet" type="text/css" href="stylesheet.css">

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">

<!-- header //-->

<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

<!-- header_eof //-->

 

<!-- body //-->

<table border="0" width="100%" cellspacing="3" cellpadding="3">

<tr>

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- left_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>

<!-- left_navigation_eof //-->

</table></td>

<!-- body_text //-->

<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<?php

// If we found the customers email address, and they currently subscribe

if ($cus_optout) {

// Unsubscribe Opt-Out them

tep_db_query("UPDATE customers SET customers_newsletter = '0' WHERE customers_email_address = '" .$email_to_news_optout . "'");

?>

<td class="main"><?php echo NEWS_OPTOUT_DONE_TEXT_INFORMATION . $email_to_news_optout; ?></td>

<?php

// Otherwise, we want to display an error message

} else {

?>

<td class="main"><?php echo NEWS_OPTOUT_ERROR_INFORMATION . $email_to_news_optout; ?></td>

<?php

}

?>

 

</tr>

</table></td>

</tr>

<tr>

<td align="center" class="main"><br><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT, '', 'NONSSL') . '">' . tep_image_button('button_continue_shopping.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>

</tr>

</table></td>

<!-- body_text_eof //-->

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- right_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>

<!-- right_navigation_eof //-->

</table></td>

</tr>

</table>

<!-- body_eof //-->

 

<!-- footer //-->

<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>

<!-- footer_eof //-->

<br>

</body>

</html>

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

---------------------------------------

 

I dunno.....perplexed....any thoughts? thanks for the help!! :)

 

 

bumping for another shot at an answer...

Link to comment
Share on other sites

  • 10 months later...

Hello!

 

Its been a year ago since you asked this but I am having the same problem right now.

 

I have discovered the following, if i change the following line:

 

tep_db_query("UPDATE customers SET customers_newsletter = '0' WHERE customers_email_address = '" .$email_to_news_optout . "'");

 

TO:

 

tep_db_query("UPDATE customers SET customers_newsletter = '0' WHERE customers_email_address = '[email protected]'");

 

It will actually work, but of course only for the account registered with that mail address. Anyways, this will verify that the problem is not server

side but actually something related to the coding itself (especially functioning of $email_to_news_optout). Someone who knows something about

PHP has any suggestions here?

Link to comment
Share on other sites

THERE IS ALTERNATIVE SOLUTION:

 

I gave up trying to fix this bug, but I made another very very simple code myself that will do the same thing.

By clicking unsubscribe in email customer will be directed to a page that contains an empty form where he shall

insert his email address and click "Unsubscribe". After that customer will be directed to page of your choice (in

this example UNSUBSCRIBE_COMPLETE.php). For this reason there is java involved. The source code for this page is:

 

 

 

1. Insert inside the end of <HEAD> tags:

 

<script type="text/javascript">

<!--

function doubleSubmit(f)

{

// submit to action in form

f.submit();

// set second action and submit

f.target="_blank";

f.action="UNSUBSCRIBE_COMPLETE.php";

f.submit();

return false;

}

//-->

</script>

 

-------------------------------------------------------

 

2. Insert this DIV to a page where you direct customer from email unsubscribe link

 

<div>

<form method="POST" onsubmit="doubleSubmit(this)" action="<?php tep_db_query("UPDATE customers SET customers_newsletter = '0' WHERE customers_email_address = '" .$_POST['email'] . "'"); ?>">

<table width="250" border="0" cellspacing="2" cellpadding="0">

<tr>

<td class="bodytext">Email address:</td>

<td><input name="email" type="text" id="email" size="32"></td>

</tr>

<tr>

<td class="bodytext"> </td>

<td align="left" valign="top"><input type="submit" name="Submit" value="Unsubscribe"></td>

</tr>

</table>

</form>

</div>

 

I hope i have helped someone :)

Link to comment
Share on other sites

EDIT: There is a problem having two actions in one form. The java code will work for a couple attempts only... Havent found solution to this so I have just removed java part temporarily. The problem is now customer wont get any respond saying he has been removed from the mailing list.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...