本文整理汇总了PHP中tep_db_prepare_input函数的典型用法代码示例。如果您正苦于以下问题:PHP tep_db_prepare_input函数的具体用法?PHP tep_db_prepare_input怎么用?PHP tep_db_prepare_input使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tep_db_prepare_input函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tep_update_whos_online
function tep_update_whos_online()
{
global $customer_id;
if (tep_session_is_registered('customer_id')) {
$wo_customer_id = $customer_id;
$customer_query = tep_db_query("select customers_firstname, customers_lastname from " . TABLE_CUSTOMERS . " where customers_id = '" . (int) $customer_id . "'");
$customer = tep_db_fetch_array($customer_query);
$wo_full_name = $customer['customers_firstname'] . ' ' . $customer['customers_lastname'];
} else {
$wo_customer_id = '';
$wo_full_name = 'Guest';
}
$wo_session_id = tep_session_id();
$wo_ip_address = tep_get_ip_address();
$wo_last_page_url = tep_db_prepare_input(getenv('REQUEST_URI'));
$current_time = time();
$xx_mins_ago = $current_time - 900;
// remove entries that have expired
tep_db_query("delete from " . TABLE_WHOS_ONLINE . " where time_last_click < '" . $xx_mins_ago . "'");
$stored_customer_query = tep_db_query("select session_id from " . TABLE_WHOS_ONLINE . " where session_id = '" . tep_db_input($wo_session_id) . "' limit 1");
if (tep_db_num_rows($stored_customer_query) > 0) {
tep_db_query("update " . TABLE_WHOS_ONLINE . " set customer_id = '" . (int) $wo_customer_id . "', full_name = '" . tep_db_input($wo_full_name) . "', ip_address = '" . tep_db_input($wo_ip_address) . "', time_last_click = '" . tep_db_input($current_time) . "', last_page_url = '" . tep_db_input($wo_last_page_url) . "' where session_id = '" . tep_db_input($wo_session_id) . "'");
} else {
tep_db_query("insert into " . TABLE_WHOS_ONLINE . " (customer_id, full_name, session_id, ip_address, time_entry, time_last_click, last_page_url) values ('" . (int) $wo_customer_id . "', '" . tep_db_input($wo_full_name) . "', '" . tep_db_input($wo_session_id) . "', '" . tep_db_input($wo_ip_address) . "', '" . tep_db_input($current_time) . "', '" . tep_db_input($current_time) . "', '" . tep_db_input($wo_last_page_url) . "')");
}
}
示例2: quote
function quote($method = '')
{
global $order, $cart, $shipping_weight, $currencies, $currency;
$postcode_check_query = tep_db_query("select count(*) as total from " . TABLE_CITIES . " where city_id = '" . tep_db_input(tep_db_prepare_input($order->delivery['postcode'])) . "'");
$postcode_check = tep_db_fetch_array($postcode_check_query);
$shipping_cost = 0;
// if (empty($order->delivery['postcode'])) {
// $this->quotes['error'] = MODULE_SHIPPING_UKRPOSTBN_NO_ZIPCODE_FOUND;
// } elseif ($postcode_check['total'] < 1) {
// $this->quotes['error'] = MODULE_SHIPPING_UKRPOSTBN_NO_ZIPCODE_EXISTS;
// } else {
$total_sum = str_replace(',', '.', round($cart->total * $currencies->currencies[$currency]['value'], $currencies->currencies[$currency]['decimal_places']));
$persentage = str_replace(',', '.', MODULE_SHIPPING_UKRPOSTBN_COST);
$min_cost = str_replace(',', '.', MODULE_SHIPPING_UKRPOSTBN_MIN_COST);
$add_cost = str_replace(',', '.', MODULE_SHIPPING_UKRPOSTBN_ADDITIONAL_COST);
if ($persentage > 0) {
$shipping_cost = $total_sum * $persentage / 100;
}
if ($min_cost > 0 && $shipping_cost < $min_cost) {
$shipping_cost = $min_cost;
}
if ($add_cost > 0) {
$shipping_cost += $add_cost;
}
$shipping_method = sprintf(MODULE_SHIPPING_UKRPOSTBN_TEXT_WEIGHT, $shipping_weight);
// }
if ($shipping_cost > 0) {
$shipping_cost = $shipping_cost / $currencies->get_value($currency);
}
$this->quotes['id'] = $this->code;
$this->quotes['module'] = MODULE_SHIPPING_UKRPOSTBN_TEXT_TITLE;
$this->quotes['methods'] = array(array('id' => $this->code, 'title' => $shipping_method, 'cost' => $shipping_cost));
return $this->quotes;
}
示例3: after_process
function after_process()
{
global $insert_id;
parent::after_process();
tep_db_query("UPDATE pi_paymill_transaction SET preauth_id = '" . tep_db_prepare_input($_SESSION['paymill']['preauth_id']) . "' WHERE order_id = " . (int) $insert_id);
unset($_SESSION['paymill']);
}
示例4: objectInfo
function objectInfo($object_array)
{
reset($object_array);
while (list($key, $value) = each($object_array)) {
$this->{$key} = tep_db_prepare_input($value);
}
}
示例5: create_user
/**
* @param $first_name
* @param $last_name
* @param $email
* @return integer Customer ID
*/
public static function create_user($first_name, $last_name, $email)
{
$existing_customer = self::get_customer_id_by_email($email);
if (!$existing_customer) {
// Customer doesn't exist, create them.
// tep_encrypt_password deals with actual hashing, this is simply generating a longer string.
$password_string = md5(self::gen_random_string());
$customer_data = array('customers_firstname' => $first_name, 'customers_lastname' => $last_name, 'customers_email_address' => $email, 'customers_gender' => '', 'customers_dob' => tep_db_prepare_input('0001-01-01 00:00:00'), 'customers_telephone' => '', 'customers_newsletter' => '0', 'customers_default_address_id' => 0, 'customers_password' => tep_encrypt_password($password_string));
$cust = tep_db_perform(TABLE_CUSTOMERS, $customer_data);
$cust_id = tep_db_insert_id();
if (!$cust_id) {
return FALSE;
}
// Set an invalid password
$query = "UPDATE " . TABLE_CUSTOMERS . " SET `customers_password` = :pw WHERE `customers_id` = :id";
$query = bind_vars($query, ':pw', 'LOGINWITHAMAZON00000000000000000');
$query = bind_vars($query, ':id', $cust_id);
tep_db_query($query);
// Add user to the Amazon users table
$amazon_table_safe = tep_db_input(self::TABLE_NAME_ONLY);
$cust_id_safe = tep_db_input($cust_id);
$query = "INSERT INTO " . $amazon_table_safe . " (customer_id) VALUES (" . $cust_id_safe . ")";
tep_db_query($query);
// Create customer info entry
tep_db_query("insert into " . TABLE_CUSTOMERS_INFO . " (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created) values ('" . (int) $cust_id . "', '0', now())");
return $cust_id;
} else {
return $existing_customer;
}
}
示例6: execute
function execute()
{
global $sessiontoken, $login_customer_id, $messageStack, $oscTemplate;
$error = false;
if (isset($_GET['action']) && $_GET['action'] == 'process' && isset($_POST['formid']) && $_POST['formid'] == $sessiontoken) {
$email_address = tep_db_prepare_input($_POST['email_address']);
$password = tep_db_prepare_input($_POST['password']);
// Check if email exists
$customer_query = tep_db_query("select customers_id, customers_password from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "' limit 1");
if (!tep_db_num_rows($customer_query)) {
$error = true;
} else {
$customer = tep_db_fetch_array($customer_query);
// Check that password is good
if (!tep_validate_password($password, $customer['customers_password'])) {
$error = true;
} else {
// set $login_customer_id globally and perform post login code in catalog/login.php
$login_customer_id = (int) $customer['customers_id'];
// migrate old hashed password to new phpass password
if (tep_password_type($customer['customers_password']) != 'phpass') {
tep_db_query("update " . TABLE_CUSTOMERS . " set customers_password = '" . tep_encrypt_password($password) . "' where customers_id = '" . (int) $login_customer_id . "'");
}
}
}
}
if ($error == true) {
$messageStack->add('login', MODULE_CONTENT_LOGIN_TEXT_LOGIN_ERROR);
}
ob_start();
include 'includes/modules/content/' . $this->group . '/templates/login_form.php';
$template = ob_get_clean();
$oscTemplate->addContent($template, $this->group);
}
示例7: query
function query($order_id)
{
global $languages_id;
$order_id = tep_db_prepare_input($order_id);
// PWA BOF
// added customers_dummy_account
$order_query = tep_db_query("select customers_id, customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, customers_dummy_account, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, delivery_date, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, currency, currency_value, date_purchased, orders_status, last_modified from " . TABLE_ORDERS . " where orders_id = '" . (int) $order_id . "'");
// PWA EOF
$order = tep_db_fetch_array($order_query);
$totals_query = tep_db_query("select title, text from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int) $order_id . "' order by sort_order");
while ($totals = tep_db_fetch_array($totals_query)) {
$this->totals[] = array('title' => $totals['title'], 'text' => $totals['text']);
}
$order_total_query = tep_db_query("select text from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int) $order_id . "' and class = 'ot_total'");
$order_total = tep_db_fetch_array($order_total_query);
$shipping_method_query = tep_db_query("select title from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int) $order_id . "' and class = 'ot_shipping'");
$shipping_method = tep_db_fetch_array($shipping_method_query);
$order_status_query = tep_db_query("select orders_status_name from " . TABLE_ORDERS_STATUS . " where orders_status_id = '" . $order['orders_status'] . "' and language_id = '" . (int) $languages_id . "'");
$order_status = tep_db_fetch_array($order_status_query);
$this->info = array('currency' => $order['currency'], 'currency_value' => $order['currency_value'], 'payment_method' => $order['payment_method'], 'cc_type' => $order['cc_type'], 'cc_owner' => $order['cc_owner'], 'cc_number' => $order['cc_number'], 'cc_expires' => $order['cc_expires'], 'date_purchased' => $order['date_purchased'], 'delivery_date' => $order['delivery_date'], 'orders_status' => $order_status['orders_status_name'], 'last_modified' => $order['last_modified'], 'total' => strip_tags($order_total['text']), 'shipping_method' => substr($shipping_method['title'], -1) == ':' ? substr(strip_tags($shipping_method['title']), 0, -1) : strip_tags($shipping_method['title']));
$this->customer = array('id' => $order['customers_id'], 'name' => $order['customers_name'], 'company' => $order['customers_company'], 'street_address' => $order['customers_street_address'], 'suburb' => $order['customers_suburb'], 'city' => $order['customers_city'], 'postcode' => $order['customers_postcode'], 'state' => $order['customers_state'], 'country' => array('title' => $order['customers_country']), 'format_id' => $order['customers_address_format_id'], 'telephone' => $order['customers_telephone'], 'email_address' => $order['customers_email_address'], 'is_dummy_account' => $order['customers_dummy_account']);
// PWA EOF
$this->delivery = array('name' => trim($order['delivery_name']), 'company' => $order['delivery_company'], 'street_address' => $order['delivery_street_address'], 'suburb' => $order['delivery_suburb'], 'city' => $order['delivery_city'], 'postcode' => $order['delivery_postcode'], 'state' => $order['delivery_state'], 'country' => array('title' => $order['delivery_country']), 'format_id' => $order['delivery_address_format_id']);
if (empty($this->delivery['name']) && empty($this->delivery['street_address'])) {
$this->delivery = false;
}
$this->billing = array('name' => $order['billing_name'], 'company' => $order['billing_company'], 'street_address' => $order['billing_street_address'], 'suburb' => $order['billing_suburb'], 'city' => $order['billing_city'], 'postcode' => $order['billing_postcode'], 'state' => $order['billing_state'], 'country' => array('title' => $order['billing_country']), 'format_id' => $order['billing_address_format_id']);
$index = 0;
$orders_products_query = tep_db_query("select orders_products_id, products_id, products_name, products_model, products_code, products_price, products_tax, products_quantity, final_price from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int) $order_id . "'");
while ($orders_products = tep_db_fetch_array($orders_products_query)) {
$this->products[$index] = array('qty' => $orders_products['products_quantity'], 'id' => $orders_products['products_id'], 'name' => $orders_products['products_name'], 'model' => $orders_products['products_model'], 'code' => $orders_products['products_code'], 'tax' => $orders_products['products_tax'], 'price' => $orders_products['products_price'], 'final_price' => $orders_products['final_price']);
// BOF: MOD - Separate Pricing Per Customer
global $sppc_customer_group_id;
if (tep_session_is_registered('sppc_customer_group_id')) {
$customer_group_id = $sppc_customer_group_id;
} else {
$customer_group_id = '0';
}
if ($customer_group_id != '0') {
$orders_customers_price = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where customers_group_id = '" . $customer_group_id . "' and products_id = '" . $products[$i]['id'] . "'");
if ($orders_customers = tep_db_fetch_array($orders_customers_price)) {
$this->products[$index] = array('price' => $orders_customers['customers_group_price'], 'final_price' => $orders_customers['customers_group_price']);
}
}
// EOF: MOD - Separate Pricing Per Customer
$subindex = 0;
$attributes_query = tep_db_query("select products_options, products_options_values, options_values_price, price_prefix from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . (int) $order_id . "' and orders_products_id = '" . (int) $orders_products['orders_products_id'] . "'");
if (tep_db_num_rows($attributes_query)) {
while ($attributes = tep_db_fetch_array($attributes_query)) {
$this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options'], 'value' => $attributes['products_options_values'], 'prefix' => $attributes['price_prefix'], 'price' => $attributes['options_values_price']);
$subindex++;
}
}
$this->info['tax_groups']["{$this->products[$index]['tax']}"] = '1';
$index++;
}
}
示例8: print_address
function print_address($x, $y, $nums)
{
global $pdf, $num, $billing;
$pos = $y;
global $orders_query;
global $order;
global $orders;
global $languages_id;
global $_POST;
if ($order) {
if ($billing == true) {
$addressparts = explode("\n", tep_address_format($order->billing['format_id'], $order->billing, 1, '', " \n"));
} else {
$addressparts = explode("\n", tep_address_format($order->delivery['format_id'], $order->delivery, 1, '', " \n"));
}
foreach ($addressparts as $addresspart) {
$fontsize = GENERAL_FONT_SIZE;
while ($pdf->getTextWidth($fontsize, $addresspart) > LABEL_WIDTH) {
$fontsize--;
}
//$addresspart = preg_replace("%,[[:space:]]*$%", "", $addresspart);
$pdf->addText($x, $pos -= GENERAL_LINE_SPACING, $fontsize, $addresspart);
}
$pdf->addText($x + LABEL_WIDTH - ORDERIDXOFFSET - 22, $y + ORDERIDYOFFSET, ORDERIDFONTSIZE, $orders['orders_id']);
if ($_POST['status'] && $_POST['status'] != $order->info['orders_status']) {
$customer_notified = 0;
$status = tep_db_prepare_input($_POST['status']);
$notify_comments = sprintf(EMAIL_TEXT_COMMENTS_UPDATE, BATCH_COMMENTS) . "\n\n";
if ($_POST['notify']) {
$status_query = tep_db_query("select orders_status_name as name from " . TABLE_ORDERS_STATUS . " where language_id = " . $languages_id . " and orders_status_id = " . tep_db_input($status));
$status_name = tep_db_fetch_array($status_query);
$email = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $orders['orders_id'] . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . tep_date_long($order->info['date_purchased']) . "\n\n" . $notify_comments . sprintf(EMAIL_TEXT_STATUS_UPDATE, $status_name['name']);
tep_mail($order->customer['name'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, nl2br($email), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
$customer_notified = '1';
}
tep_db_query("update " . TABLE_ORDERS . " set orders_status = '" . tep_db_input($status) . "', last_modified = now() where orders_id = '" . $orders['orders_id'] . "'");
tep_db_query("insert into " . TABLE_ORDERS_STATUS_HISTORY . " (orders_id, orders_status_id, date_added, customer_notified, comments) \r\n values ('" . $orders['orders_id'] . "', '" . tep_db_input($status) . "', now(), '" . $customer_notified . "', '" . $notify_comments . "')");
}
if ($nums % NUM_LABELS_PER_PAGE == NUM_LABELS_PER_PAGE - 1) {
$order = false;
return false;
} else {
if ($orders = tep_db_fetch_array($orders_query)) {
$order = new order($orders['orders_id']);
return true;
} else {
$order = false;
return false;
}
}
} else {
return false;
}
}
示例9: send
function send($newsletter_id)
{
$mail_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_newsletter = '1'");
$mimemessage = new email(array('X-Mailer: osCommerce bulk mailer'));
$mimemessage->add_text($this->content);
$mimemessage->build_message();
while ($mail = tep_db_fetch_array($mail_query)) {
$mimemessage->send($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], '', EMAIL_FROM, $this->title);
}
$newsletter_id = tep_db_prepare_input($newsletter_id);
tep_db_query("update " . TABLE_NEWSLETTERS . " set date_sent = now(), status = '1' where newsletters_id = '" . tep_db_input($newsletter_id) . "'");
}
示例10: send
function send($affiliate_newsletter_id)
{
$mail_query = tep_db_query("select affiliate_firstname, affiliate_lastname, affiliate_email_address from " . TABLE_AFFILIATE . " where affiliate_newsletter = '1'");
$mimemessage = new email(array('X-Mailer: osCmax Mailer'));
$mimemessage->add_text($this->content);
$mimemessage->build_message();
while ($mail = tep_db_fetch_array($mail_query)) {
$mimemessage->send($mail['affiliate_firstname'] . ' ' . $mail['affiliate_lastname'], $mail['affiliate_email_address'], '', EMAIL_FROM, $this->title);
}
$affiliate_newsletter_id = tep_db_prepare_input($affiliate_newsletter_id);
tep_db_query("update " . TABLE_AFFILIATE_NEWSLETTERS . " set date_sent = now(), status = '1' where affiliate_newsletters_id = '" . tep_db_input($affiliate_newsletter_id) . "'");
}
示例11: objectInfo
function objectInfo($object_array)
{
reset($object_array);
while (list($key, $value) = each($object_array)) {
// Check if value is defined
if (defined($value) && constant($value) != null) {
$this->{$key} = constant($value);
} else {
$this->{$key} = tep_db_prepare_input($value);
}
}
}
示例12: recordFirstStep
public function recordFirstStep($orderId, $paramsSAR, $responseSAR)
{
$datetime = new DateTime('NOW');
if ($this->_getStep($orderId) == self::FIRST_STEP) {
$requestKey = $responseSAR['RequestKey'];
$publicRequestKey = $responseSAR['PublicRequestKey'];
$query = "UPDATE todopago_transaccion SET first_step = '" . $datetime->format('Y-m-d H:i:s') . "', params_SAR = '" . tep_db_input(tep_db_prepare_input(json_encode($paramsSAR))) . "', response_SAR = '" . tep_db_input(tep_db_prepare_input(json_encode($responseSAR))) . "', request_key = '" . tep_db_input(tep_db_prepare_input($requestKey)) . "', public_request_key = '" . tep_db_input(tep_db_prepare_input($publicRequestKey)) . "' WHERE id_orden = " . $orderId;
tep_db_query($query);
return $query;
} else {
return 0;
}
}
示例13: retrieveDetail
function retrieveDetail($products_linking_id, $prepared = false)
{
if (!$prepared) {
$products_linking_id = tep_db_prepare_input($products_linking_id);
}
$load_query = "SELECT pl.*, p.products_image";
$load_query .= " FROM products_linking pl";
$load_query .= " LEFT JOIN products p ON p.products_id=pl.links_id";
$load_query .= " WHERE pl.products_linking_id={$products_linking_id}";
$load_result = tep_db_query($load_query);
$pl = tep_db_fetch_array($load_result);
return $pl;
}
示例14: send
function send($newsletter_id)
{
$mail_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_newsletter = '1'");
while ($mail = tep_db_fetch_array($mail_query)) {
$mimemessage = new email(array('X-Mailer: osCommerce bulk mailer'));
// Préparation de l'envoie du mail en HTML
$mimemessage->add_html_newsletter($this->header . "\n\n" . $this->content . "\n\n" . $this->unsubscribea . " " . '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . FILENAME_UNSUBSCRIBE . "?email=" . $mail['customers_email_address'] . '">' . HTTP_SERVER . DIR_WS_CATALOG . FILENAME_UNSUBSCRIBE . "?email=" . $mail['customers_email_address'] . '</a>' . "\n\n" . $this->unsubscribeb);
$mimemessage->build_message();
// ################# END - Contribution Newsletter v050 ##############
$mimemessage->send($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], '', EMAIL_FROM, $this->title);
}
$newsletter_id = tep_db_prepare_input($newsletter_id);
tep_db_query("update " . TABLE_NEWSLETTERS . " set date_sent = now(), status = '1' where newsletters_id = '" . tep_db_input($newsletter_id) . "'");
}
示例15: create_update_list
function create_update_list($post_update_list, $db_update_list)
{
$set_update = '';
foreach ($post_update_list as $key => $value) {
if (postOK($value)) {
if (empty($set_update)) {
$set_update .= $db_update_list[$key] . ' = "' . tep_db_prepare_input($_POST[$value]) . '"';
} else {
$set_update .= ',' . $db_update_list[$key] . ' = "' . tep_db_prepare_input($_POST[$value]) . '"';
}
}
}
return $set_update;
}