<?php
/*
  $Id: create_account.php,v 1.65 2003/06/09 23:03:54 hpdl Exp $

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2003 osCommerce

  Released under the GNU General Public License
*/

  require('includes/application_top.php');
// needs to be included earlier to set the success message in the messageStack
  require(DIR_WS_LANGUAGES . $language . '/' . 'cancel.php');
	$subname=$_POST["subname"];
  if ($subname=="cancel"){
  }
  else
  if ($subname=="cancelemail"){
		if (!eregi("^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3}$",$useremail))
		{
       		echo '<script language="javascript">alert("'.TEXT_ERROR_WRONG.'!");history.go(-1)</script>';
		}
		else
		{
			$check_sql="select count(*) as rowno from get_email where email='".mysql_real_escape_string($useremail)."'";
			//echo $check_sql;
			$check_query=tep_db_query($check_sql);
			$check_row=tep_db_fetch_array($check_query);
			if ($check_row['rowno']==1)
			{
				$can_sql="update get_email set flag=2 where email = '" . mysql_real_escape_string($useremail) . "' limit 1";
				$message=preg_replace("/\\\/",'',$_POST["whycancel"]);
				$tep_res=tep_db_query($can_sql);
				mail("john@ebest24.com", WWW_DOMAIN_COM." Unsubscribe: ".$useremail, $message);
			}
			else
			{
				echo '<script language="javascript">alert("'.TEXT_ERROR_NO.'!");history.go(-1)</script>';
				exit;
			}
	  	}
  }
  else
  	  tep_redirect(HTTP_SERVER);
?>
<!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; ?>">
<title><?php echo TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="style.css">
<?php require('includes/form_check.js.php'); ?>
</head>
<body>
<div id="pg">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

	<!-- body //-->
<div id="bdmain" class="layout">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
<!-- body_text //-->
<div id="bdcenter">
<!--TEXT_MAIN_CENTER_TOP-->
									  <p class="pageHeading"><?PHP echo HEADING_TITLE;?></p>
							  <!----TD----->
								 <?php if ($_POST['subname']=="cancelemail"){
									echo '<center style="color:#f00; font-weight:bold;font-size:12px">' . TEXT_SUCCESS . '</center>';
								 }
								 else if ($_POST['subname']=="cancel"){?>
									  <p style="text-indent:2em; text-align:left;"><?PHP echo TEXT_PLEASEFILL;?></p>
								<form name="cancelemail" action="cancel.php?subname=cancelemail" method="post" id="cancelemail">
								<table width="600"  border="0" align="center" cellpadding="0" cellspacing="5">
										<tr valign="middle">
										<input type="hidden" name="subname" value="cancelemail">										
										<td width="135" height="22"  class="text_2" style="font-weight:bold; text-indent:2em;"><?php echo TEXT_EMAILADDRESS;?> : </td>
										<td align="left"  class="text_2"><input style="border:1px solid #333;width:240;" type="text" name="useremail" value="<? echo $useremail;?>" ></td>					
								    </tr>
								  </table>
									  <p class="pageText" style="text-indent:2em;text-align:left;"><?PHP echo TEXT_PLEASEREASON;?></p>
								<table width="600"  border="0" align="center" cellpadding="0" cellspacing="5">
									<tr >
									  <td width="135" height="22"  class="text_2" style="font-weight:bold; text-indent:2em;"><?php echo Reason;?> : </td>
									  <td align="left" ><textarea name="whycancel"  rows="5" id="whycancel" style="border:1px solid #333; width:360px;"></textarea></td>
  </tr>
									<tr valign="middle">
									  <td height="30"  class="text_2">&nbsp;</td>
									  <td align="left"  class="text_2"><input name="image" type="image" title="cancel " src="<? 
									  echo DIR_WS_LANGUAGES . $language;?>/images/buttons/button_unsubscribe.gif" alt="cancel" border="0" /></td>
  </tr>
								</table></form>
								<?php }?><!----TD----->
						<!--TEXT_MAIN_CENTER_TOP--><br>
<br>
			
						  <!--TEXT_MAIN_CENTER_BOM-->
<!--TEXT_MAIN_CENTER_BOM-->			
						<?php include(DIR_WS_BOXES . 'center_output2.php');?>
						</div>
<!-- body_text_eof //-->
<!-- right_navigation //-->
<?php include(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
</div>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //--></div>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
