本文整理汇总了PHP中osCommerce\OM\Core\OSCOM::getIPAddress方法的典型用法代码示例。如果您正苦于以下问题:PHP OSCOM::getIPAddress方法的具体用法?PHP OSCOM::getIPAddress怎么用?PHP OSCOM::getIPAddress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osCommerce\OM\Core\OSCOM
的用法示例。
在下文中一共展示了OSCOM::getIPAddress方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public static function execute(ApplicationAbstract $application)
{
$OSCOM_PDO = Registry::get('PDO');
$OSCOM_MessageStack = Registry::get('MessageStack');
$Qcheck = $OSCOM_PDO->prepare('select customers_id, customers_firstname, customers_lastname, customers_gender, customers_email_address, customers_password from :table_customers where customers_email_address = :customers_email_address limit 1');
$Qcheck->bindValue(':customers_email_address', $_POST['email_address']);
$Qcheck->execute();
if ($Qcheck->fetch() !== false) {
$password = Hash::getRandomString(ACCOUNT_PASSWORD);
if (Account::savePassword($password, $Qcheck->valueInt('customers_id'))) {
if (ACCOUNT_GENDER > -1) {
if ($Qcheck->value('customers_gender') == 'm') {
$email_text = sprintf(OSCOM::getDef('email_addressing_gender_male'), $Qcheck->valueProtected('customers_lastname')) . "\n\n";
} else {
$email_text = sprintf(OSCOM::getDef('email_addressing_gender_female'), $Qcheck->valueProtected('customers_lastname')) . "\n\n";
}
} else {
$email_text = sprintf(OSCOM::getDef('email_addressing_gender_unknown'), $Qcheck->valueProtected('customers_firstname') . ' ' . $Qcheck->valueProtected('customers_lastname')) . "\n\n";
}
$email_text .= sprintf(OSCOM::getDef('email_password_reminder_body'), OSCOM::getIPAddress(), STORE_NAME, $password, STORE_OWNER_EMAIL_ADDRESS);
$pEmail = new Mail($Qcheck->valueProtected('customers_firstname') . ' ' . $Qcheck->valueProtected('customers_lastname'), $Qcheck->valueProtected('customers_email_address'), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, sprintf(OSCOM::getDef('email_password_reminder_subject'), STORE_NAME));
$pEmail->setBodyPlain($email_text);
$pEmail->send();
$OSCOM_MessageStack->add('LogIn', OSCOM::getDef('success_password_forgotten_sent'), 'success');
}
OSCOM::redirect(OSCOM::getLink(null, null, 'LogIn', 'SSL'));
} else {
$OSCOM_MessageStack->add('PasswordForgotten', OSCOM::getDef('error_password_forgotten_no_email_address_found'));
}
}
示例2: execute
public static function execute()
{
// List of safe IP-Addresses found here:
// https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/howto_api_golivechecklist
$firewall = array('64.4.241.16', '64.4.241.32', '64.4.241.33', '64.4.241.34', '64.4.241.35', '64.4.241.36', '64.4.241.37', '64.4.241.38', '64.4.241.39', '216.113.188.32', '216.113.188.33', '216.113.188.34', '216.113.188.35', '216.113.188.64', '216.113.188.65', '216.113.188.66', '216.113.188.67', '66.211.169.2', '66.211.169.65', '216.113.188.39', '216.113.188.71', '66.211.168.91', '66.211.168.123', '216.113.188.52', '216.113.188.84', '66.211.168.92', '66.211.168.124', '216.113.188.10', '66.211.168.126', '216.113.188.11', '66.211.168.125', '216.113.188.202', '216.113.188.203', '216.113.188.204', '66.211.170.66', '66.135.197.163', '216.113.169.205', '66.135.197.160', '66.135.197.162', '66.135.197.141', '66.135.197.164');
if (!in_array(OSCOM::getIPAddress(), $firewall)) {
exit;
}
}
示例3: createEntry
/**
* Stores a new customer account entry in the database
*
* @param array $data An array containing the customers information
* @access public
* @return boolean
*/
public static function createEntry($data)
{
$OSCOM_PDO = Registry::get('PDO');
$OSCOM_Session = Registry::get('Session');
$OSCOM_Customer = Registry::get('Customer');
$OSCOM_ShoppingCart = Registry::get('ShoppingCart');
$OSCOM_NavigationHistory = Registry::get('NavigationHistory');
$Qcustomer = $OSCOM_PDO->prepare('insert into :table_customers (customers_firstname, customers_lastname, customers_email_address, customers_newsletter, customers_status, customers_ip_address, customers_password, customers_gender, customers_dob, number_of_logons, date_account_created) values (:customers_firstname, :customers_lastname, :customers_email_address, :customers_newsletter, :customers_status, :customers_ip_address, :customers_password, :customers_gender, :customers_dob, :number_of_logons, now())');
$Qcustomer->bindValue(':customers_firstname', $data['firstname']);
$Qcustomer->bindValue(':customers_lastname', $data['lastname']);
$Qcustomer->bindValue(':customers_email_address', $data['email_address']);
$Qcustomer->bindValue(':customers_newsletter', isset($data['newsletter']) && $data['newsletter'] == '1' ? '1' : '');
$Qcustomer->bindValue(':customers_status', '1');
$Qcustomer->bindValue(':customers_ip_address', OSCOM::getIPAddress());
$Qcustomer->bindValue(':customers_password', Hash::get($data['password']));
$Qcustomer->bindValue(':customers_gender', ACCOUNT_GENDER > -1 && isset($data['gender']) && ($data['gender'] == 'm' || $data['gender'] == 'f') ? $data['gender'] : '');
$Qcustomer->bindValue(':customers_dob', ACCOUNT_DATE_OF_BIRTH == '1' ? date('Ymd', $data['dob']) : '');
$Qcustomer->bindInt(':number_of_logons', 0);
$Qcustomer->execute();
if ($Qcustomer->rowCount() === 1) {
$customer_id = $OSCOM_PDO->lastInsertId();
if (SERVICE_SESSION_REGENERATE_ID == '1') {
$OSCOM_Session->recreate();
}
$OSCOM_Customer->setCustomerData($customer_id);
// restore cart contents
$OSCOM_ShoppingCart->synchronizeWithDatabase();
$OSCOM_NavigationHistory->removeCurrentPage();
// build the welcome email content
if (ACCOUNT_GENDER > -1 && isset($data['gender'])) {
if ($data['gender'] == 'm') {
$email_text = sprintf(OSCOM::getDef('email_addressing_gender_male'), $OSCOM_Customer->getLastName()) . "\n\n";
} else {
$email_text = sprintf(OSCOM::getDef('email_addressing_gender_female'), $OSCOM_Customer->getLastName()) . "\n\n";
}
} else {
$email_text = sprintf(OSCOM::getDef('email_addressing_gender_unknown'), $OSCOM_Customer->getName()) . "\n\n";
}
$email_text .= sprintf(OSCOM::getDef('email_create_account_body'), STORE_NAME, STORE_OWNER_EMAIL_ADDRESS);
$c_email = new Mail($OSCOM_Customer->getName(), $OSCOM_Customer->getEmailAddress(), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, sprintf(OSCOM::getDef('email_create_account_subject'), STORE_NAME));
$c_email->setBodyPlain($email_text);
$c_email->send();
return true;
}
return false;
}
示例4: start
public static function start()
{
$OSCOM_Customer = Registry::get('Customer');
$OSCOM_PDO = Registry::get('PDO');
if ($OSCOM_Customer->isLoggedOn()) {
$wo_customer_id = $OSCOM_Customer->getID();
$wo_full_name = $OSCOM_Customer->getName();
} else {
$wo_customer_id = null;
$wo_full_name = 'Guest';
if (SERVICE_WHOS_ONLINE_SPIDER_DETECTION == '1') {
$user_agent = strtolower($_SERVER['HTTP_USER_AGENT']);
if (!empty($user_agent)) {
$spiders = file(OSCOM::BASE_DIRECTORY . 'Core/Site/Shop/assets/spiders.txt');
foreach ($spiders as $spider) {
if (!empty($spider)) {
if (strpos($user_agent, trim($spider)) !== false) {
$wo_full_name = $spider;
break;
}
}
}
}
}
}
$wo_session_id = session_id();
$wo_ip_address = OSCOM::getIPAddress();
$wo_last_page_url = HTML::outputProtected(substr($_SERVER['REQUEST_URI'], 0, 255));
$current_time = time();
$xx_mins_ago = $current_time - 900;
// remove entries that have expired
$Qwhosonline = $OSCOM_PDO->prepare('delete from :table_whos_online where time_last_click < :time_last_click');
$Qwhosonline->bindValue(':time_last_click', $xx_mins_ago);
$Qwhosonline->execute();
$Qwhosonline = $OSCOM_PDO->prepare('select count(*) as count from :table_whos_online where session_id = :session_id');
$Qwhosonline->bindValue(':session_id', $wo_session_id);
$Qwhosonline->execute();
if ($Qwhosonline->valueInt('count') > 0) {
$Qwhosonline = $OSCOM_PDO->prepare('update :table_whos_online set customer_id = :customer_id, full_name = :full_name, ip_address = :ip_address, time_last_click = :time_last_click, last_page_url = :last_page_url where session_id = :session_id');
if ($wo_customer_id > 0) {
$Qwhosonline->bindInt(':customer_id', $wo_customer_id);
} else {
$Qwhosonline->bindNull(':customer_id');
}
$Qwhosonline->bindValue(':full_name', $wo_full_name);
$Qwhosonline->bindValue(':ip_address', $wo_ip_address);
$Qwhosonline->bindValue(':time_last_click', $current_time);
$Qwhosonline->bindValue(':last_page_url', $wo_last_page_url);
$Qwhosonline->bindValue(':session_id', $wo_session_id);
$Qwhosonline->execute();
} else {
$Qwhosonline = $OSCOM_PDO->prepare('insert into :table_whos_online (customer_id, full_name, session_id, ip_address, time_entry, time_last_click, last_page_url) values (:customer_id, :full_name, :session_id, :ip_address, :time_entry, :time_last_click, :last_page_url)');
if ($wo_customer_id > 0) {
$Qwhosonline->bindInt(':customer_id', $wo_customer_id);
} else {
$Qwhosonline->bindNull(':customer_id');
}
$Qwhosonline->bindValue(':full_name', $wo_full_name);
$Qwhosonline->bindValue(':session_id', $wo_session_id);
$Qwhosonline->bindValue(':ip_address', $wo_ip_address);
$Qwhosonline->bindValue(':time_entry', $current_time);
$Qwhosonline->bindValue(':time_last_click', $current_time);
$Qwhosonline->bindValue(':last_page_url', $wo_last_page_url);
$Qwhosonline->execute();
}
return true;
}
示例5: start
public static function start()
{
Registry::set('Session', SessionClass::load());
$OSCOM_Session = Registry::get('Session');
$OSCOM_Session->setLifeTime(SERVICE_SESSION_EXPIRATION_TIME * 60);
if (SERVICE_SESSION_FORCE_COOKIE_USAGE == '1' || (bool) ini_get('session.use_only_cookies') === true) {
OSCOM::setCookie('cookie_test', 'please_accept_for_session', time() + 60 * 60 * 24 * 90);
if (isset($_COOKIE['cookie_test'])) {
$OSCOM_Session->start();
}
} elseif (SERVICE_SESSION_BLOCK_SPIDERS == '1') {
$user_agent = strtolower($_SERVER['HTTP_USER_AGENT']);
$spider_flag = false;
if (!empty($user_agent)) {
$spiders = file(OSCOM::BASE_DIRECTORY . 'Core/Site/Shop/assets/spiders.txt');
foreach ($spiders as $spider) {
if (!empty($spider)) {
if (strpos($user_agent, trim($spider)) !== false) {
$spider_flag = true;
break;
}
}
}
}
if ($spider_flag === false) {
$OSCOM_Session->start();
}
} else {
$OSCOM_Session->start();
}
// verify the ssl_session_id
if (OSCOM::getRequestType() == 'SSL' && SERVICE_SESSION_CHECK_SSL_SESSION_ID == '1' && OSCOM::getConfig('enable_ssl') == 'true') {
if (isset($_SERVER['SSL_SESSION_ID']) && ctype_xdigit($_SERVER['SSL_SESSION_ID'])) {
if (!isset($_SESSION['SESSION_SSL_ID'])) {
$_SESSION['SESSION_SSL_ID'] = $_SERVER['SSL_SESSION_ID'];
}
if ($_SESSION['SESSION_SSL_ID'] != $_SERVER['SSL_SESSION_ID']) {
$OSCOM_Session->destroy();
OSCOM::redirect(OSCOM::getLink(null, 'Info', 'SSLcheck', 'AUTO'));
}
}
}
// verify the browser user agent
if (SERVICE_SESSION_CHECK_USER_AGENT == '1') {
$http_user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
if (!isset($_SESSION['SESSION_USER_AGENT'])) {
$_SESSION['SESSION_USER_AGENT'] = $http_user_agent;
}
if ($_SESSION['SESSION_USER_AGENT'] != $http_user_agent) {
$OSCOM_Session->destroy();
OSCOM::redirect(OSCOM::getLink(null, 'Account', 'LogIn', 'SSL'));
}
}
// verify the IP address
if (SERVICE_SESSION_CHECK_IP_ADDRESS == '1') {
if (!isset($_SESSION['SESSION_IP_ADDRESS'])) {
$_SESSION['SESSION_IP_ADDRESS'] = OSCOM::getIPAddress();
}
if ($_SESSION['SESSION_IP_ADDRESS'] != OSCOM::getIPAddress()) {
$OSCOM_Session->destroy();
OSCOM::redirect(OSCOM::getLink(null, 'Account', 'LogIn', 'SSL'));
}
}
Registry::get('MessageStack')->loadFromSession();
return true;
}
示例6: insert
public static function insert()
{
$OSCOM_ShoppingCart = Registry::get('ShoppingCart');
$OSCOM_Customer = Registry::get('Customer');
$OSCOM_Currencies = Registry::get('Currencies');
$OSCOM_PDO = Registry::get('PDO');
$OSCOM_Tax = Registry::get('Tax');
if (isset($_SESSION['prepOrderID'])) {
$_prep = explode('-', $_SESSION['prepOrderID']);
if ($_prep[0] == $OSCOM_ShoppingCart->getCartID()) {
return $_prep[1];
// order_id
} else {
if (self::getStatusID($_prep[1]) === 4) {
self::remove($_prep[1]);
}
}
}
if ($OSCOM_Customer->isLoggedOn()) {
$customer_address = AddressBook::getEntry($OSCOM_Customer->getDefaultAddressID());
} else {
$customer_address = array('company' => $OSCOM_ShoppingCart->getShippingAddress('company'), 'street_address' => $OSCOM_ShoppingCart->getShippingAddress('street_address'), 'suburb' => $OSCOM_ShoppingCart->getShippingAddress('suburb'), 'city' => $OSCOM_ShoppingCart->getShippingAddress('city'), 'postcode' => $OSCOM_ShoppingCart->getShippingAddress('postcode'), 'state' => $OSCOM_ShoppingCart->getShippingAddress('state'), 'zone_id' => $OSCOM_ShoppingCart->getShippingAddress('zone_id'), 'country_id' => $OSCOM_ShoppingCart->getShippingAddress('country_id'), 'telephone' => $OSCOM_ShoppingCart->getShippingAddress('telephone'));
}
$Qorder = $OSCOM_PDO->prepare('insert into :table_orders (customers_id, customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_state_code, customers_country, customers_country_iso2, customers_country_iso3, customers_telephone, customers_email_address, customers_address_format, customers_ip_address, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_state_code, delivery_country, delivery_country_iso2, delivery_country_iso3, delivery_address_format, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_state_code, billing_country, billing_country_iso2, billing_country_iso3, billing_address_format, payment_method, payment_module, date_purchased, orders_status, currency, currency_value) values (:customers_id, :customers_name, :customers_company, :customers_street_address, :customers_suburb, :customers_city, :customers_postcode, :customers_state, :customers_state_code, :customers_country, :customers_country_iso2, :customers_country_iso3, :customers_telephone, :customers_email_address, :customers_address_format, :customers_ip_address, :delivery_name, :delivery_company, :delivery_street_address, :delivery_suburb, :delivery_city, :delivery_postcode, :delivery_state, :delivery_state_code, :delivery_country, :delivery_country_iso2, :delivery_country_iso3, :delivery_address_format, :billing_name, :billing_company, :billing_street_address, :billing_suburb, :billing_city, :billing_postcode, :billing_state, :billing_state_code, :billing_country, :billing_country_iso2, :billing_country_iso3, :billing_address_format, :payment_method, :payment_module, now(), :orders_status, :currency, :currency_value)');
$Qorder->bindInt(':customers_id', $OSCOM_Customer->getID());
$Qorder->bindValue(':customers_name', $OSCOM_Customer->getName());
$Qorder->bindValue(':customers_company', $customer_address['company']);
$Qorder->bindValue(':customers_street_address', $customer_address['street_address']);
$Qorder->bindValue(':customers_suburb', $customer_address['suburb']);
$Qorder->bindValue(':customers_city', $customer_address['city']);
$Qorder->bindValue(':customers_postcode', $customer_address['postcode']);
$Qorder->bindValue(':customers_state', $customer_address['state']);
$Qorder->bindValue(':customers_state_code', Address::getZoneCode($customer_address['zone_id']));
$Qorder->bindValue(':customers_country', Address::getCountryName($customer_address['country_id']));
$Qorder->bindValue(':customers_country_iso2', Address::getCountryIsoCode2($customer_address['country_id']));
$Qorder->bindValue(':customers_country_iso3', Address::getCountryIsoCode3($customer_address['country_id']));
$Qorder->bindValue(':customers_telephone', $customer_address['telephone']);
$Qorder->bindValue(':customers_email_address', $OSCOM_Customer->getEmailAddress());
$Qorder->bindValue(':customers_address_format', Address::getFormat($customer_address['country_id']));
$Qorder->bindValue(':customers_ip_address', OSCOM::getIPAddress());
$Qorder->bindValue(':delivery_name', $OSCOM_ShoppingCart->getShippingAddress('firstname') . ' ' . $OSCOM_ShoppingCart->getShippingAddress('lastname'));
$Qorder->bindValue(':delivery_company', $OSCOM_ShoppingCart->getShippingAddress('company'));
$Qorder->bindValue(':delivery_street_address', $OSCOM_ShoppingCart->getShippingAddress('street_address'));
$Qorder->bindValue(':delivery_suburb', $OSCOM_ShoppingCart->getShippingAddress('suburb'));
$Qorder->bindValue(':delivery_city', $OSCOM_ShoppingCart->getShippingAddress('city'));
$Qorder->bindValue(':delivery_postcode', $OSCOM_ShoppingCart->getShippingAddress('postcode'));
$Qorder->bindValue(':delivery_state', $OSCOM_ShoppingCart->getShippingAddress('state'));
$Qorder->bindValue(':delivery_state_code', $OSCOM_ShoppingCart->getShippingAddress('zone_code'));
$Qorder->bindValue(':delivery_country', $OSCOM_ShoppingCart->getShippingAddress('country_title'));
$Qorder->bindValue(':delivery_country_iso2', $OSCOM_ShoppingCart->getShippingAddress('country_iso_code_2'));
$Qorder->bindValue(':delivery_country_iso3', $OSCOM_ShoppingCart->getShippingAddress('country_iso_code_3'));
$Qorder->bindValue(':delivery_address_format', $OSCOM_ShoppingCart->getShippingAddress('format'));
$Qorder->bindValue(':billing_name', $OSCOM_ShoppingCart->getBillingAddress('firstname') . ' ' . $OSCOM_ShoppingCart->getBillingAddress('lastname'));
$Qorder->bindValue(':billing_company', $OSCOM_ShoppingCart->getBillingAddress('company'));
$Qorder->bindValue(':billing_street_address', $OSCOM_ShoppingCart->getBillingAddress('street_address'));
$Qorder->bindValue(':billing_suburb', $OSCOM_ShoppingCart->getBillingAddress('suburb'));
$Qorder->bindValue(':billing_city', $OSCOM_ShoppingCart->getBillingAddress('city'));
$Qorder->bindValue(':billing_postcode', $OSCOM_ShoppingCart->getBillingAddress('postcode'));
$Qorder->bindValue(':billing_state', $OSCOM_ShoppingCart->getBillingAddress('state'));
$Qorder->bindValue(':billing_state_code', $OSCOM_ShoppingCart->getBillingAddress('zone_code'));
$Qorder->bindValue(':billing_country', $OSCOM_ShoppingCart->getBillingAddress('country_title'));
$Qorder->bindValue(':billing_country_iso2', $OSCOM_ShoppingCart->getBillingAddress('country_iso_code_2'));
$Qorder->bindValue(':billing_country_iso3', $OSCOM_ShoppingCart->getBillingAddress('country_iso_code_3'));
$Qorder->bindValue(':billing_address_format', $OSCOM_ShoppingCart->getBillingAddress('format'));
$Qorder->bindValue(':payment_method', $OSCOM_ShoppingCart->getBillingMethod('title'));
// HPDL verify payment module class
$Qorder->bindValue(':payment_module', $OSCOM_ShoppingCart->getBillingMethod('id'));
$Qorder->bindInt(':orders_status', 4);
// HPDL move currencies to the products level
$Qorder->bindValue(':currency', $OSCOM_Currencies->getCode());
$Qorder->bindValue(':currency_value', $OSCOM_Currencies->value($OSCOM_Currencies->getCode()));
$Qorder->execute();
$insert_id = $OSCOM_PDO->lastInsertId();
foreach ($OSCOM_ShoppingCart->getOrderTotals() as $module) {
$Qtotals = $OSCOM_PDO->prepare('insert into :table_orders_total (orders_id, title, text, value, class, sort_order) values (:orders_id, :title, :text, :value, :class, :sort_order)');
$Qtotals->bindInt(':orders_id', $insert_id);
$Qtotals->bindValue(':title', $module['title']);
$Qtotals->bindValue(':text', $module['text']);
$Qtotals->bindValue(':value', $module['value']);
$Qtotals->bindValue(':class', $module['code']);
$Qtotals->bindInt(':sort_order', $module['sort_order']);
$Qtotals->execute();
}
$Qstatus = $OSCOM_PDO->prepare('insert into :table_orders_status_history (orders_id, orders_status_id, date_added, customer_notified, comments) values (:orders_id, :orders_status_id, now(), :customer_notified, :comments)');
$Qstatus->bindInt(':orders_id', $insert_id);
$Qstatus->bindInt(':orders_status_id', 4);
$Qstatus->bindInt(':customer_notified', '0');
$Qstatus->bindValue(':comments', isset($_SESSION['comments']) ? $_SESSION['comments'] : '');
$Qstatus->execute();
foreach ($OSCOM_ShoppingCart->getProducts() as $products) {
$Qproducts = $OSCOM_PDO->prepare('insert into :table_orders_products (orders_id, products_id, products_model, products_name, products_price, products_tax, products_quantity) values (:orders_id, :products_id, :products_model, :products_name, :products_price, :products_tax, :products_quantity)');
$Qproducts->bindInt(':orders_id', $insert_id);
$Qproducts->bindInt(':products_id', Products::getProductID($products['id']));
$Qproducts->bindValue(':products_model', $products['model']);
$Qproducts->bindValue(':products_name', $products['name']);
$Qproducts->bindValue(':products_price', $products['price']);
$Qproducts->bindValue(':products_tax', $OSCOM_Tax->getTaxRate($products['tax_class_id']));
$Qproducts->bindInt(':products_quantity', $products['quantity']);
$Qproducts->execute();
$order_products_id = $OSCOM_PDO->lastInsertId();
//.........这里部分代码省略.........