本文整理汇总了PHP中set_affiliate函数的典型用法代码示例。如果您正苦于以下问题:PHP set_affiliate函数的具体用法?PHP set_affiliate怎么用?PHP set_affiliate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_affiliate函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: ecshop_init
protected function ecshop_init()
{
header('Cache-control: private');
header('Content-type: text/html; charset=utf-8');
$shop_closed = C('shop_closed');
if (!empty($shop_closed)) {
$close_comment = C('close_comment');
$close_comment = empty($close_comment) ? 'closed.' : $close_comment;
exit($close_comment);
}
//NULL
// 初始化session
self::$sess = new EcsSession(self::$db, self::$ecs->table('sessions'), self::$ecs->table('sessions_data'), 'ecsid');
define('SESS_ID', self::$sess->get_session_id());
// 创建 Smarty 对象
self::$view = new EcsTemplate();
self::$view->cache_lifetime = C('cache_time');
self::$view->template_dir = ROOT_PATH . 'themes/' . C('template');
self::$view->cache_dir = ROOT_PATH . 'data/cache/caches';
self::$view->compile_dir = ROOT_PATH . 'data/cache/compiled';
if ((DEBUG_MODE & 2) == 2) {
self::$view->direct_output = true;
self::$view->force_compile = true;
} else {
self::$view->direct_output = false;
self::$view->force_compile = false;
}
self::$view->caching = true;
// 会员信息
self::$user = init_users();
if (empty($_SESSION['user_id'])) {
if (self::$user->get_cookie()) {
// 如果会员已经登录并且还没有获得会员的帐户余额、积分以及优惠券
if ($_SESSION['user_id'] > 0 && !isset($_SESSION['user_money'])) {
model('Users')->update_user_info();
}
} else {
$_SESSION['user_id'] = 0;
$_SESSION['user_name'] = '';
$_SESSION['email'] = '';
$_SESSION['user_rank'] = 0;
$_SESSION['discount'] = 1.0;
}
}
// 判断是否支持gzip模式
if (gzip_enabled()) {
ob_start('ob_gzhandler');
}
// 设置推荐会员
if (isset($_GET['u'])) {
set_affiliate();
}
// session不存在,检查cookie
if (!empty($_COOKIE['ECS']['user_id']) && !empty($_COOKIE['ECS']['password'])) {
// 找到cookie,验证信息
$where['user_id'] = $_COOKIE['ECS']['user_id'];
$where['password'] = $_COOKIE['ECS']['password'];
$row = $this->model->table('users')->field('user_id, user_name, password')->where($where)->find();
if ($row) {
$_SESSION['user_id'] = $row['user_id'];
$_SESSION['user_name'] = $row['user_name'];
model('Users')->update_user_info();
} else {
// 没有找到这个记录
$time = time() - 3600;
setcookie("ECS[user_id]", '', $time, '/');
setcookie("ECS[password]", '', $time, '/');
}
}
// search 关键词
$search_keywords = C('search_keywords');
if (!empty($search_keywords) && is_string($search_keywords)) {
$keywords = explode(',', $search_keywords);
$this->assign('hot_search_keywords', $keywords);
}
// 模板替换
defined('__TPL__') or define('__TPL__', __ROOT__ . '/themes/' . C('template'));
$stylename = C('stylename');
if (!empty($stylename)) {
$this->assign('ectouch_css_path', __ROOT__ . '/themes/' . C('template') . '/css/ectouch_' . C('stylename') . '.css');
} else {
$this->assign('ectouch_css_path', __ROOT__ . '/themes/' . C('template') . '/css/ectouch.css');
}
}
开发者ID:ChanHarold,项目名称:ecshop,代码行数:84,代码来源:CommonController.class.php
示例2: update_user_info
update_user_info();
}
} else {
$_SESSION['user_id'] = 0;
$_SESSION['user_name'] = '';
$_SESSION['email'] = '';
$_SESSION['user_rank'] = 0;
$_SESSION['discount'] = 1.0;
if (!isset($_SESSION['login_fail'])) {
$_SESSION['login_fail'] = 0;
}
}
}
/* 设置推荐会员 */
if (isset($_GET['u'])) {
set_affiliate();
}
/* session 不存在,检查cookie */
if (!empty($_COOKIE['ECS']['user_id']) && !empty($_COOKIE['ECS']['password'])) {
// 找到了cookie, 验证cookie信息
$sql = 'SELECT user_id, user_name, password ' . ' FROM ' . $ecs->table('users') . " WHERE user_id = '" . intval($_COOKIE['ECS']['user_id']) . "' AND password = '" . $_COOKIE['ECS']['password'] . "'";
$row = $db->GetRow($sql);
if (!$row) {
// 没有找到这个记录
$time = time() - 3600;
setcookie("ECS[user_id]", '', $time, '/');
setcookie("ECS[password]", '', $time, '/');
} else {
$_SESSION['user_id'] = $row['user_id'];
$_SESSION['user_name'] = $row['user_name'];
update_user_info();
开发者ID:fromzyy2ann,项目名称:mescake,代码行数:31,代码来源:init.php
示例3: add_new_merchant
function add_new_merchant($companyInfo, $sendmail = true, $getmail = false)
{
$returnInfo = array('status' => true, 'msg' => 'Company Created Successfully');
//foreach($companyInfo as $key=>$data)
// $companyInfo[$key] = quote_smart($data);
$res = check_merchant_conflict($companyInfo);
if (!$res['status']) {
return $res;
}
if ($res['res']['ref']) {
$companyInfo['en_ref'] = substr(strtoupper(md5(time() + rand(1, 1000000))), 0, 8);
}
$qry_insert_user = " insert into cs_companydetails (username,password,companyname,ReferenceNumber,email,volumenumber,activeuser,transaction_type,how_about_us,date_added,phonenumber,contact_phone,cd_contact_im,gateway_id,url1,cd_timezone)";
$qry_insert_user .= " values('" . $companyInfo['en_username'] . "','" . $companyInfo['en_password'] . "','" . $companyInfo['en_company'] . "','" . $companyInfo['en_ref'] . "','" . $companyInfo['en_email'] . "','" . $companyInfo['volumenumber'] . "',0,'" . $companyInfo['transaction_type'] . "','" . $companyInfo['how_about_us'] . "',NOW(),'" . $companyInfo['phonenumber'] . "','" . $companyInfo['contact_phone'] . "','" . $companyInfo['cd_contact_im'] . "','" . $companyInfo['en_gateway_ID'] . "','" . $companyInfo['url1'] . "','" . $companyInfo['cd_timezone'] . "')";
$show_sql = sql_query_write($qry_insert_user) or dieLog(mysql_error() . " ~ {$str_qry}");
$is_success = 0;
$user_id = mysql_insert_id();
$user_reference_num = func_User_Ref_No($user_id);
$is_success = func_update_single_field('cs_companydetails', 'ReferenceNumber', $user_reference_num, false, 'userId', $user_id);
$sql = "Insert into cs_entities\r\n\t\t\tset \r\n\t\t\t\ten_username = '" . $companyInfo['en_username'] . "',\r\n\t\t\t\ten_password = MD5('" . ($companyInfo['en_username'] . $companyInfo['en_password']) . "'),\r\n\t\t\t\ten_ref = '" . $companyInfo['en_ref'] . "',\r\n\t\t\t\ten_email = '" . $companyInfo['en_email'] . "',\r\n\t\t\t\ten_company = '" . $companyInfo['en_company'] . "',\r\n\t\t\t\ten_gateway_ID = '" . $companyInfo['en_gateway_ID'] . "',\r\n\t\t\t\ten_signup = NOW(),\r\n\t\t\t\ten_type = 'merchant',\r\n\t\t\t\ten_type_id = '" . quote_smart($user_id) . "'\r\n\t\t\t";
sql_query_write($sql) or dieLog(mysql_error() . " ~ {$str_qry}");
$en_ID = mysql_insert_id();
$returnInfo['en_ID'] = $en_ID;
$sql = "insert into cs_company_banks set cb_en_ID = '{$en_ID}',bank_id=0;";
$result = sql_query_write($sql) or dieLog(mysql_error() . " ~ {$sql}");
$cb_ID = mysql_insert_id();
if ($companyInfo['etel_reseller_ref']) {
$sql = "SELECT \r\n\t\t\t\ten_ID,en_info from cs_entities where\r\n\t\t\t\ten_ref = '" . $companyInfo['etel_reseller_ref'] . "'";
$result = sql_query_read($sql) or dieLog(mysql_error() . " ~ {$sql}");
$resellerInfo = mysql_fetch_assoc($result);
$resellerInfo['en_info'] = etel_unserialize($resellerInfo['en_info']);
$returnInfo['ea_affiliate_ID'] = $resellerInfo['en_ID'];
set_affiliate($en_ID, $resellerInfo['en_ID'], 'Reseller', array('Disc_Markup' => $resellerInfo['en_info']['Reseller']['Default_Disc_Markup'], 'Trans_Markup' => $resellerInfo['en_info']['Reseller']['Default_Trans_Markup']));
}
if ($companyInfo['etel_affiliate_ref']) {
$sql = "SELECT \r\n\t\t\t\ten_ID from cs_entities where\r\n\t\t\t\ten_ref = '" . $companyInfo['etel_affiliate_ref'] . "'";
$result = sql_query_read($sql) or dieLog(mysql_error() . " ~ {$sql}");
$affiliateMerchantInfo = mysql_fetch_assoc($result);
set_affiliate($affiliateMerchantInfo['en_ID'], $en_ID, 'Affiliate', array('Disc_Markup' => $companyInfo['discount_markup'], 'Trans_Markup' => $companyInfo['transaction_markup']));
}
if ($sendmail || $getmail) {
$emailData["email"] = $companyInfo['en_email'];
$emailData["full_name"] = "Merchant";
$emailData["companyname"] = $companyInfo['en_company'];
$emailData["username"] = $companyInfo['en_username'];
$emailData["password"] = $companyInfo['en_password'];
$emailData["Reference_ID"] = $companyInfo['en_ref'];
$emailData["gateway_select"] = $companyInfo['en_gateway_ID'];
$emailData['tmpl_custom_id'] = $companyInfo['en_gateway_ID'];
$letterTempate = 'merchant_welcome_letter';
}
if ($sendmail) {
send_email_template($letterTempate, $emailData);
}
if ($getmail) {
$returnInfo['email_info'] = get_email_template($letterTempate, $emailData);
}
return $returnInfo;
}
开发者ID:juliogallardo1326,项目名称:proc,代码行数:59,代码来源:db.merchant.php
注:本文中的set_affiliate函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论