Contribution can be found here: http://www.oscommerce.com/community/contributions,3976
Cheers,
Chris
Edited by stonebridgecomputing, 24 January 2006, 09:15.
Posted 24 January 2006, 09:14
Edited by stonebridgecomputing, 24 January 2006, 09:15.
Posted 24 January 2006, 12:13
Posted 24 January 2006, 21:00
Hasmik, on Jan 24 2006, 11:13 PM, said:
Posted 29 January 2006, 06:25
<?php
/*
$Id: contact_us.php,v 1.42 2003/06/12 12:17:07 hpdl Exp $
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce Released under the GNU General Public License
Modified for VN2 Free Skin E by Kevin jeffery - www.vn2designs.com
*/
require('includes/application_top.php');
require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CONTACT_US);
$error = false;
if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'send')) {
$name = tep_db_prepare_input($HTTP_POST_VARS['name']);
$email_address = tep_db_prepare_input($HTTP_POST_VARS['email']);
$enquiry = tep_db_prepare_input($HTTP_POST_VARS['enquiry']);
if (isset($HTTP_POST_VARS['newsletter'])) {
$newsletter = tep_db_prepare_input($HTTP_POST_VARS['newsletter']);
} else {
$newsletter = false;
}
if (tep_validate_email($email_address)) {
tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT, $enquiry, $name, $email_address);
if(SEND_CONTACT_US_RESPONSE=='true')
tep_mail($name, $email_address, CONTACT_US_RESPONSE_EMAIL_SUBJECT, CONTACT_US_RESPONSE_EMAIL_TEXT."\n\n-------------------------Your Message:\n".$enquiry, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
tep_redirect(tep_href_link(FILENAME_CONTACT_US, 'action=success'));
} else {
$error = true;
$messageStack->add('contact', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
}
}
// Begin PHPlist Newsletter add-on
require(DIR_WS_INCLUDES . '/phplist_define.php'); //get the phplist specifics
//get user specifics from PHPlist
$existing_email_query = tep_db_query("select id, email, foreignkey from " . PHPLIST_DB . "" . PHPLIST_TABLE_PREFIX . "user_user where email = '" . $email_address . "'"); //check for existing by email address
$history_systeminfo_text = "\nHTTP_USER_AGENT = " . $_SERVER["HTTP_USER_AGENT"] ."\nHTTP_REFERER = " . $_SERVER["HTTP_REFERER"] . "\nREMOTE_ADDR = " . $_SERVER["REMOTE_ADDR"] . "";
$history_detail_text = "";
//subscribe logic
if ($newsletter) {
if (tep_db_num_rows($existing_email_query) < 1) { //no existing user by email address found (therefore a new user - no id or email found)
$id = md5(uniqid(mt_rand())); //generate unique id and add new user to database
tep_db_query("insert into " . PHPLIST_DB . "" . PHPLIST_TABLE_PREFIX . "user_user (email, confirmed, subscribepage, entered, modified, disabled, uniqid, htmlemail, foreignkey) values ('" . $email_address . "', 1, " . PHPLIST_SPAGE . ", now(), now(), 0, '" . $id . "', " . PHPLIST_HTMLEMAIL . ", " . $customer_id . ")"); //insert the new user into phplist
$user_query=tep_db_query("select id from " . PHPLIST_DB . "" . PHPLIST_TABLE_PREFIX . "user_user where email = '" . $email_address . "'"); //get the new user's phplist id
$user = tep_db_fetch_array($user_query);
//tep_db_query("insert into " . PHPLIST_DB . "" . PHPLIST_TABLE_PREFIX . "user_user_attribute (attributeid, userid, value) values (" . PHPLIST_FIRSTNAME . ", " . $user['id'] . ", '" . $firstname . "')"); //add the users firstname to the attributes table
//tep_db_query("insert into " . PHPLIST_DB . "" . PHPLIST_TABLE_PREFIX . "user_user_attribute (attributeid, userid, value) values (" . PHPLIST_LASTNAME . ", " . $user['id'] . ", '" . $lastname . "')"); //add the users lastname to the attributes table
tep_db_query("insert into " . PHPLIST_DB . "" . PHPLIST_TABLE_PREFIX . "listuser (userid, listid, entered) values (" . $user['id'] . ", " . PHPLIST_LISTNO . ", now())"); //subscribe the new user to the correct list
//generating history
$history_detail_text .= "\nSubscribepage = " . PHPLIST_SPAGE . "\nforeign key = " . $customer_id . "\n";
//$attribute_name_query = tep_db_query("select name from " . PHPLIST_DB . "" . PHPLIST_TABLE_PREFIX . "user_attribute where id = " . PHPLIST_FIRSTNAME . "");
//$attribute_name = tep_db_fetch_array($attribute_name_query);
//$history_detail_text .= "" . $attribute_name[name] . " = " . $firstname . "\n";
//$attribute_name_query = tep_db_query("select name from " . PHPLIST_DB . "" . PHPLIST_TABLE_PREFIX . "user_attribute where id = " . PHPLIST_LASTNAME . "");
//$attribute_name = tep_db_fetch_array($attribute_name_query);
//$history_detail_text .= "" . $attribute_name[name] . " = " . $lastname . "\n";
$list_name_query = tep_db_query("select name from " . PHPLIST_DB . "" . PHPLIST_TABLE_PREFIX . "list where id = " . PHPLIST_LISTNO . "");
$list_name = tep_db_fetch_array($list_name_query);
$history_detail_text .= "\nList subscriptions:\n" . $list_name['name'] . "";
tep_db_query("insert into " . PHPLIST_DB . "" . PHPLIST_TABLE_PREFIX . "user_user_history (userid, ip, date, summary, detail, systeminfo) values (" . $user['id'] . ", '" . $_SERVER["REMOTE_ADDR"] . "', '" . date('Y-m-d H:i:s') . "', 'Update through osC', '" . $history_detail_text . "', '" . $history_systeminfo_text . "')"); //create history post
}
else { //subscribe the existing user if disabled and add foreignkey match to customer_id
$existing_email = tep_db_fetch_array($existing_email_query); //existing user by email found
tep_db_query("update " . PHPLIST_DB . "" . PHPLIST_TABLE_PREFIX . "user_user set disabled = 0, confirmed = 1, foreignkey = " . $customer_id . " where id = " . $existing_email['id'] . "");
$history_detail_text .= "foreign key = " . $customer_id . "\nchanged from ";
//check to see if they already are subscribed to the correct list
$list_query = tep_db_query("select * from " . PHPLIST_DB . "" . PHPLIST_TABLE_PREFIX . "listuser where userid = " . $existing_email['id'] . " and listid = " . PHPLIST_LISTNO . "");
if ($list=tep_db_num_rows($list_query) < 1) { //no existing subscription to the newsletter found
//generating history, previous subscriptions
$history_detail_text .= "\n\nList subscriptions:\n";
$existing_subscription_query = tep_db_query("select li.name from " . PHPLIST_DB . "" . PHPLIST_TABLE_PREFIX . "list li, " . PHPLIST_DB . "" . PHPLIST_TABLE_PREFIX . "listuser lu where li.id = lu.listid and lu.userid = " . $existing_email['id'] . "");
if (tep_db_num_rows($existing_subscription_query) < 1) {
$history_detail_text .= "Was subscribed to: \n";
} else {
while($existing_subscription = tep_db_fetch_array($existing_subscription_query)){
$history_detail_text .= "Was subscribed to: " . $existing_subscription[name] . "\n";
}
}
tep_db_query("insert into " . PHPLIST_DB . "" . PHPLIST_TABLE_PREFIX . "listuser (userid, listid, entered) values (" . $existing_email['id'] . ", " . PHPLIST_LISTNO . ", now())"); //subscribe the new user to the correct list
//generating history, current (updated) subscriptions
$updated_subscription_query = tep_db_query("select li.name from " . PHPLIST_DB . "" . PHPLIST_TABLE_PREFIX . "list li, " . PHPLIST_DB . "" . PHPLIST_TABLE_PREFIX . "listuser lu where li.id = lu.listid and lu.userid = " . $existing_email['id'] . "");
while ($updated_subscription = tep_db_fetch_array($updated_subscription_query)) {
$history_detail_text .= "Is now subscribed to: " . $updated_subscription[name] . "\n";
}
}
tep_db_query("insert into " . PHPLIST_DB . "" . PHPLIST_TABLE_PREFIX . "user_user_history (userid, ip, date, summary, detail, systeminfo) values (" . $existing_email['id'] . ", '" . $_SERVER["REMOTE_ADDR"] . "', '" . date('Y-m-d H:i:s') . "', 'Update through osC', '" . $history_detail_text . "', '" . $history_systeminfo_text . "')"); //create history post
}
}
// End PHPlist Newsletter add-on
$breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_CONTACT_US));
?>
<!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>
<META NAME="publisher" CONTENT="HostingosCommerce.com">
<base href="<?php echo (($request_type == 'SSL') ? 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="760" align="center" cellspacing="0" cellpadding="0" background="images/mainbg.jpg">
<tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="0">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
</table></td>
<!-- body_text //-->
<td width="100%" valign="top"><?php echo tep_draw_form('contact_us', tep_href_link(FILENAME_CONTACT_US, 'action=send')); ?><table border="0" width="440" align="center" cellspacing="0" cellpadding="0">
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
<td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_contact_us.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
</tr>
</table></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<?php
if ($messageStack->size('contact') > 0) {
?>
<tr>
<td><?php echo $messageStack->output('contact'); ?></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<?php
}
if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'success')) {
?>
<tr>
<td class="main" align="center"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_man_on_board.gif', HEADING_TITLE, '0', '0', 'align="left"') . TEXT_SUCCESS; ?></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></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 align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<?php
} else {
?>
<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 class="main">If you have any enquries, please feel free to email us at <a href="mailto:sales@stonebridgecomputing.com.au">sales@stonebridgecomputing.com.au</a>, or feel free to use the following form.<br><br></td>
</tr>
<tr>
<td class="main"><?php echo ENTRY_NAME; ?></td>
</tr>
<tr>
<td class="main"><?php echo tep_draw_input_field('name'); ?></td>
</tr>
<tr>
<td class="main"><?php echo ENTRY_EMAIL; ?></td>
</tr>
<tr>
<td class="main"><?php echo tep_draw_input_field('email'); ?></td>
</tr>
<tr>
<td class="main">Subscribe to Newsletter?
<?php echo tep_draw_checkbox_field('newsletter', '1',checked) . ' ' . (tep_not_null(ENTRY_NEWSLETTER_TEXT) ? '<span class="inputRequirement">' . ENTRY_NEWSLETTER_TEXT . '</span>': ''); ?></td>
</tr>
<tr>
<td class="main"><?php echo ENTRY_ENQUIRY; ?></td>
</tr>
<tr>
<td><?php echo tep_draw_textarea_field('enquiry', 'soft', 50, 15); ?></td>
</tr>
</table></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="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 align="right"><?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></td>
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<?php
}
?>
</table></form></td>
<!-- body_text_eof //-->
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="0">
<!-- 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'); ?>
Posted 10 February 2006, 20:20
Posted 10 February 2006, 23:30
basnyd, on Feb 11 2006, 07:20 AM, said:
Posted 18 February 2006, 12:57
Quote
Posted 18 February 2006, 22:57
NDComputers, on Feb 18 2006, 11:57 PM, said:
Posted 24 February 2006, 21:36
Posted 25 February 2006, 01:22
smashing_machine, on Feb 25 2006, 08:36 AM, said:
Posted 25 February 2006, 03:08
stonebridgecomputing, on Feb 24 2006, 07:22 PM, said:
Posted 25 February 2006, 03:40
smashing_machine, on Feb 25 2006, 02:08 PM, said:
Posted 25 February 2006, 05:45
stonebridgecomputing, on Feb 24 2006, 09:40 PM, said:
Posted 01 March 2006, 01:14
stonebridgecomputing, on Feb 24 2006, 09:40 PM, said:
Posted 29 March 2006, 11:45
Posted 29 March 2006, 13:01
Edited by Salvo, 29 March 2006, 13:02.
Posted 31 March 2006, 13:24
Quote
Posted 31 March 2006, 16:35
Posted 31 March 2006, 22:47
kevinsmit, on Apr 1 2006, 03:35 AM, said:
Posted 02 April 2006, 19:25