Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Recommended Posts

Posted

I cannot send emails through gv_Send.php, i do not understand everything else works perfect and is great. On the send page the first form with the entry boxes works fine, the second page with the information works fine but when i click send it just goes to a blank page and nothign happens!!!

 

Tried so many code versions of this page nothing works, please please please help me!!!

 

I have been through so many forums and cannot find an answer to this, my code is:

 

require('includes/application_top.php');

 

require('includes/classes/http_client.php');

 

// if the customer is not logged on, redirect them to the login page

if (!tep_session_is_registered('customer_id')) {

$navigation->set_snapshot();

tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));

}

 

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

 

if (($HTTP_POST_VARS['back_x']) || ($HTTP_POST_VARS['back_y'])) {

$HTTP_GET_VARS['action'] = '';

}

if ($HTTP_GET_VARS['action'] == 'send') {

$error = false;

if (!tep_validate_email(trim($HTTP_POST_VARS['email']))) {

$error = true;

$error_email = ERROR_ENTRY_EMAIL_ADDRESS_CHECK;

}

$gv_query = tep_db_query("select amount from " . TABLE_COUPON_GV_CUSTOMER . " where customer_id = '" . $customer_id . "'");

$gv_result = tep_db_fetch_array($gv_query);

$customer_amount = $gv_result['amount'];

$gv_amount = trim($HTTP_POST_VARS['amount']);

if (ereg('[^0-9/.]', $gv_amount)) {

$error = true;

$error_amount = ERROR_ENTRY_AMOUNT_CHECK;

}

if ($gv_amount>$customer_amount || $gv_amount == 0) {

$error = true;

$error_amount = ERROR_ENTRY_AMOUNT_CHECK;

}

}

if ($HTTP_GET_VARS['action'] == 'process') {

$id1 = create_coupon_code($mail['customers_email_address']);

$gv_query = tep_db_query("select amount from " . TABLE_COUPON_GV_CUSTOMER . " where customer_id='".$customer_id."'");

$gv_result=tep_db_fetch_array($gv_query);

$new_amount=$gv_result['amount']-$HTTP_POST_VARS['amount'];

if ($new_amount<0) {

$error= true;

$error_amount = ERROR_ENTRY_AMOUNT_CHECK;

$HTTP_GET_VARS['action'] = 'send';

} else {

$gv_query=tep_db_query("update " . TABLE_COUPON_GV_CUSTOMER . " set amount = '" . $new_amount . "' where customer_id = '" . $customer_id . "'");

$gv_query=tep_db_query("select customers_firstname, customers_lastname from " . TABLE_CUSTOMERS . " where customers_id = '" . $customer_id . "'");

$gv_customer=tep_db_fetch_array($gv_query);

$gv_query=tep_db_query("insert into " . TABLE_COUPONS . " (coupon_type, coupon_code, date_created, coupon_amount) values ('G', '" . $id1 . "', NOW(), '" . $HTTP_POST_VARS['amount'] . "')");

$insert_id = tep_db_insert_id($gv_query);

$gv_query=tep_db_query("insert into " . TABLE_COUPON_EMAIL_TRACK . " (coupon_id, customer_id_sent, sent_firstname, sent_lastname, emailed_to, date_sent) values ('" . $insert_id . "' ,'" . $customer_id . "', '" . addslashes($gv_customer['customers_firstname']) . "', '" . addslashes($gv_customer['customers_lastname']) . "', '" . $HTTP_POST_VARS['email'] . "', now())");

 

 

$gv_email = "\n" .

EMAIL_SEPARATOR . "\n" .

sprintf(EMAIL_GV_TEXT_HEADER, $currencies->format($HTTP_POST_VARS['amount'])) . "\n" .

EMAIL_SEPARATOR . "\n" .

sprintf(EMAIL_GV_FROM, stripslashes($HTTP_POST_VARS['send_name'])) . "\n";

if (isset($HTTP_POST_VARS['message'])) {

$gv_email .= EMAIL_GV_MESSAGE . "\n";

if (isset($HTTP_POST_VARS['to_name'])) {

$gv_email .= sprintf(EMAIL_GV_SEND_TO, stripslashes($HTTP_POST_VARS['to_name'])) . "\n\n";

}

$gv_email .= stripslashes($HTTP_POST_VARS['message']) . "\n\n";

}

$gv_email .= sprintf(EMAIL_GV_REDEEM, $id1) . "\n\n";

$gv_email .= EMAIL_GV_LINK . tep_href_link(FILENAME_GV_REDEEM, 'gv_no=' . $id1,'NONSSL',false);

$gv_email .= "\n\n";

$gv_email .= EMAIL_GV_FIXED_FOOTER . "\n\n";

$gv_email .= EMAIL_GV_SHOP_FOOTER . "\n\n";;

$gv_email_subject = sprintf(EMAIL_GV_TEXT_SUBJECT, stripslashes($HTTP_POST_VARS['send_name']));

tep_mail('', $HTTP_POST_VARS['email'], $gv_email_subject, nl2br($gv_email), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, '');

}

 

}

$breadcrumb->add(NAvb script:couponpopupWindow(\'' . tep_href_link(FILENAME_POPUP_COUPON_HELP, 'cID=' . $cc_id) . '\')">' . CART_COUPON_INFO . '</a>';

}

// ADDED FOR CREDIT CLASS GV END ADDITTION

?>

</td>

</tr>

</table>

</td>

</tr>

<tr>

<td valign="bottom" class="main"><?php echo ENTRY_EMAIL; ?></td>

</tr>

<tr>

<td class="main"><?php echo tep_draw_input_field('email', $HTTP_POST_VARS['email']); if ($error) echo $error_email; ?></td>

</tr>

<tr>

<td valign="bottom" class="main"><?php echo ENTRY_AMOUNT; ?></td>

</tr>

<tr>

<td class="main" colspan="2"><?php echo tep_draw_input_field('amount', $HTTP_POST_VARS['amount'], '', '', false); if ($error) echo $error_amount; ?></td>

</tr>

<tr>

<td valign="bottom" class="main" colspan="2"><?php echo ENTRY_MESSAGE; ?></td>

</tr>

<tr>

<td class="main" colspan="2"><?php echo tep_draw_textarea_field('message', 'soft', 50, 15, stripslashes($HTTP_POST_VARS['message'])); ?></td>

</tr>

</table>

</td>

</tr>

</table>

</td>

</tr>

</table>

</td>

</tr>

<tr>

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

</tr>

<tr>

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

<tr class="infoBoxContents">

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

<tr>

<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

<td class="main"><a href="java script:history.back(-1);"><?php echo tep_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '</a>'; ?></td>

<td align="right"><?php echo tep_image_submit('button_send.gif', 'Click to send...'); ?></td>

<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

</tr>

</table></td>

</tr>

</table></td>

</tr>

</form>

<?php

}

?>

</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'); ?>

:blink:

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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...