本文整理匯總了PHP中Import::ip方法的典型用法代碼示例。如果您正苦於以下問題:PHP Import::ip方法的具體用法?PHP Import::ip怎麽用?PHP Import::ip使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Import
的用法示例。
在下文中一共展示了Import::ip方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: ajax_feedback
function ajax_feedback($data = array())
{
$err = 0;
$result = array('error' => $err, 'message' => '');
$json = Import::json();
if (empty($data)) {
$result['error'] = 2;
$result['message'] = '傳送的數據為空!';
die($json->encode($result));
}
$mesobj = $json->decode($data);
//反json ,返回值為對象
//以下字段對應評論的表單頁麵 一定要一致
$datas['comment_title'] = $mesobj->comment_title;
$datas['goods_id'] = $mesobj->goods_id;
$goods_id = $datas['goods_id'];
$uid = $this->Session->read('User.uid');
$datas['user_id'] = !empty($uid) ? $uid : 0;
$datas['status'] = 2;
if (strlen($datas['comment_title']) < 12) {
$result['error'] = 2;
$result['message'] = '評論內容不能太少!';
die($json->encode($result));
}
$datas['addtime'] = mktime();
$ip = Import::basic()->getip();
$datas['ip_address'] = $ip ? $ip : '0.0.0.0';
$datas['ip_from'] = Import::ip()->ipCity($ip);
if ($this->App->insert('message', $datas)) {
$result['error'] = 0;
$result['message'] = '提問成功!我們會很快回答你的問題!';
} else {
$result['error'] = 1;
$result['message'] = '提問失敗,請通過在線聯係客服吧!';
}
unset($datas, $data);
$page = 1;
$list = 2;
//每頁顯示多少個
$start = ($page - 1) * $list;
$tt = $this->App->findvar("SELECT COUNT(mes_id) FROM `{$this->App->prefix()}message` WHERE user_id='{$uid}' AND (goods_id IS NULL OR goods_id='')");
$rt['notgoodmespage'] = Import::basic()->ajax_page($tt, $list, $page, 'get_myquestion_notgoods_page_list');
$sql = "SELECT distinct tb1.*,tb2.avatar,tb2.nickname,tb2.user_name AS dbusername FROM `{$this->App->prefix()}message` AS tb1 LEFT JOIN `{$this->App->prefix()}user` AS tb2 ON tb1.user_id=tb2.user_id WHERE tb1.user_id='{$uid}' AND (tb1.goods_id IS NULL OR tb1.goods_id='') ORDER BY tb1.addtime DESC LIMIT {$start},{$list}";
$rt['notgoodsmeslist'] = $this->App->find($sql);
$this->set('rt', $rt);
$result['error'] = 0;
$result['message'] = $this->fetch('ajax_userquestion_nogoods', true);
die($json->encode($result));
}
示例2: date
</li>
<li>
<p>最後登錄:
</p>
<span class="s_shuru_1">
<?php
echo date('Y-m-d H:i:s', $rt['last_login']);
?>
</span>
</li>
<li>
<p>登錄區域:
</p>
<span class="s_shuru_1">
<?php
echo Import::ip()->ipCity($rt['last_ip']);
?>
</span>
</li>
<li>
<p>登錄次數:
</p>
<span class="s_shuru_1">
<?php
echo $rt['visit_count'];
?>
</span>
</li>
</ul>
</div>
示例3: getcount
function getcount()
{
//新聞
/*$sql = "SELECT COUNT(article_id) FROM `{$this->App->prefix()}article` AS tb1";
$sql .=" LEFT JOIN `{$this->App->prefix()}article_cate` AS tb2 ON tb1.cat_id = tb2.cat_id";
$sql .=" WHERE tb2.type='new'";
$rt['newcount'] = $this->App->findvar($sql);
//客戶列表
$sql = "SELECT COUNT(article_id) FROM `{$this->App->prefix()}article` AS tb1";
$sql .=" LEFT JOIN `{$this->App->prefix()}article_cate` AS tb2 ON tb1.cat_id = tb2.cat_id";
$sql .=" WHERE tb2.type='customer'";
$rt['customercount'] = $this->App->findvar($sql);
//模板
$sql = "SELECT COUNT(article_id) FROM `{$this->App->prefix()}article` AS tb1";
$sql .=" LEFT JOIN `{$this->App->prefix()}article_cate` AS tb2 ON tb1.cat_id = tb2.cat_id";
$sql .=" WHERE tb2.type='case'";
$rt['casecount'] = $this->App->findvar($sql);
//網站建設文章
$sql = "SELECT COUNT(article_id) FROM `{$this->App->prefix()}article` AS tb1";
$sql .=" LEFT JOIN `{$this->App->prefix()}article_cate` AS tb2 ON tb1.cat_id = tb2.cat_id";
$sql .=" WHERE tb2.type='web'";
$rt['webcount'] = $this->App->findvar($sql);
*/
//會員數量
$sql = "SELECT COUNT(user_id) FROM `{$this->App->prefix()}user`";
$rt['usercount']['zcount'] = $this->App->findvar($sql);
$sql = "SELECT COUNT(user_id) FROM `{$this->App->prefix()}user` WHERE active='1'";
$rt['usercount']['yescount'] = $this->App->findvar($sql);
$sql = "SELECT COUNT(user_id) FROM `{$this->App->prefix()}user` WHERE active='0'";
$rt['usercount']['nocount'] = $this->App->findvar($sql);
//留言數
$sql = "SELECT COUNT(mes_id) AS mescount FROM `{$this->App->prefix()}message` WHERE parent_id='0' GROUP BY status ORDER BY status DESC";
$rt['mescount'] = $this->App->findcol($sql);
//評論數
$sql = "SELECT COUNT(comment_id) AS comcount FROM `{$this->App->prefix()}comment` WHERE parent_id='0' GROUP BY status ORDER BY status DESC";
$rt['commentcount'] = $this->App->findcol($sql);
//商品數
$sql = "SELECT COUNT(goods_id) FROM `{$this->App->prefix()}goods`";
$rt['goods']['zcount'] = $this->App->findvar($sql);
$sql = "SELECT COUNT(goods_id) FROM `{$this->App->prefix()}goods` WHERE is_on_sale='1'";
$rt['goods']['sale'] = $this->App->findvar($sql);
$sql = "SELECT COUNT(goods_id) FROM `{$this->App->prefix()}goods` WHERE is_on_sale='0'";
$rt['goods']['no_sale'] = $this->App->findvar($sql);
$sql = "SELECT COUNT(goods_id) FROM `{$this->App->prefix()}goods` WHERE is_best='1' OR is_hot='1' OR is_new='1'";
$rt['goods']['promote'] = $this->App->findvar($sql);
//訂單數量
$sql = "SELECT COUNT(order_id) FROM `{$this->App->prefix()}goods_order_info`";
$rt['order']['zcount'] = $this->App->findvar($sql);
$sql = "SELECT COUNT(order_id) FROM `{$this->App->prefix()}goods_order_info` WHERE pay_status='1'";
$rt['order']['yescount'] = $this->App->findvar($sql);
$rt['os'] = Import::basic()->get_os();
$rt['browser'] = Import::basic()->get_user_browser();
$rt['bsip'] = Import::basic()->getip();
$rt['ip_from'] = Import::ip()->ipCity($rt['bsip']);
$rt['csip'] = Import::basic()->serverIP();
return $rt;
}
示例4: date
<td><img src="<?php
echo $this->img($row['active'] == 1 ? 'yes.gif' : 'no.gif');
?>
" alt="<?php
echo $row['active'] == 1 ? '0' : '1';
?>
" class="activeop" lang="active" id="<?php
echo $row['user_id'];
?>
"/></td>
<td><?php
echo !empty($row['reg_time']) ? date('Y-m-d H:i:s', $row['reg_time']) : '無知';
?>
</td>
<td><?php
echo !empty($row['last_login']) ? date('Y-m-d H:i:s', $row['last_login']) . '<br /><font color="#FF0000">[' . Import::ip()->ipCity($row['last_ip']) . ']</font>' : '無知';
?>
</td>
<td><?php
echo $row['reg_ip'];
?>
<br /><font color="#FF0000">[<?php
echo $row['reg_from'] ? $row['reg_from'] : '無知';
?>
]</font></td>
<td>
<a href="user.php?type=dailiapplyinfo&id=<?php
echo $row['user_id'];
?>
&goto=suppliers" title="編輯"><img src="<?php
echo $this->img('icon_edit.gif');
示例5: goods_comment_info
function goods_comment_info($id = 0)
{
if (empty($id)) {
$this->jump('goods.php?type=comment_list');
exit;
}
$manager_mes = $this->action('manager', 'getuserinfo');
$rts['email'] = isset($manager_mes['email']) ? $manager_mes['email'] : "";
$rts['adminname'] = isset($manager_mes['adminname']) ? $manager_mes['adminname'] : "";
$rts['adminid'] = isset($manager_mes['adminid']) ? $manager_mes['adminid'] : "";
//管理員回複
if (!empty($_POST)) {
if (isset($_POST['comment_id']) && !empty($_POST['comment_id'])) {
//修改回複
$_POST['email'] = !empty($_POST['email']) ? $_POST['email'] : $rts['email'];
if ($_POST['comment_id'] > 0) {
$_POST['up_time'] = mktime();
$this->App->update('comment', $_POST, 'comment_id', $_POST['comment_id']);
//更新狀態
}
$this->action('system', 'add_admin_log', '修改商品評論回複-商品ID:' . $_POST['id_value']);
$this->action('common', 'showdiv', $this->getthisurl());
} else {
//添加回複
$_POST['add_time'] = mktime();
$ip = Import::basic()->getip();
$_POST['ip_address'] = $ip ? $ip : '0.0.0.0';
$_POST['ip_form'] = Import::ip()->ipCity($ip);
$_POST['parent_id'] = isset($_GET['id']) ? $_GET['id'] : 0;
$_POST['user_id'] = $rts['adminid'] ? $rts['adminid'] : 0;
$_POST['email'] = !empty($_POST['email']) ? $_POST['email'] : $rts['email'];
$_POST['user_name'] = $rts['adminname'] ? $rts['adminname'] : "";
$this->App->insert('comment', $_POST);
if ($_POST['parent_id'] > 0) {
$this->App->update('comment', array('status' => 1), 'comment_id', $_POST['parent_id']);
//更新狀態
}
$this->action('system', 'add_admin_log', '添加商品評論回複-商品ID:' . $_POST['id_value']);
$this->action('common', 'showdiv', $this->getthisurl());
}
}
$sql = "SELECT c.content,c.comment_id, c.comment_rank,c.email,c.goods_rand,c.shopping_rand,c.saleafter_rand, c.add_time,c.status, c.id_value AS goods_id, g.goods_name, c.ip_address AS ip, c.ip_form, u.nickname AS user_name,rc.add_time AS rp_addtime, rc.content AS rp_conent,rc.ip_address AS rp_ip,rc.up_time, ad.adminname AS adname,ad.adminid, rc.comment_id AS rp_com_id FROM `{$this->App->prefix()}comment` AS c";
$sql .= " LEFT JOIN `{$this->App->prefix()}comment` AS rc ON rc.parent_id=c.comment_id AND rc.parent_id>0";
$sql .= " LEFT JOIN `{$this->App->prefix()}user` AS u ON c.user_id = u.user_id AND c.user_id>0";
$sql .= " LEFT JOIN `{$this->App->prefix()}goods` AS g ON g.goods_id = c.id_value";
$sql .= " LEFT JOIN `{$this->App->prefix()}admin` AS ad ON ad.adminid=rc.user_id AND rc.user_id>0";
$sql .= " WHERE c.comment_id='{$id}'";
$this->set('rt', $this->App->findrow($sql));
$this->set('rp_mes', $rts);
unset($rts, $manager_mes);
$this->template('goods_comment_info');
}
示例6: ajax_comment
function ajax_comment($data = array(), $page = 0)
{
$err = 0;
$result = array('error' => $err, 'message' => '');
$json = Import::json();
if (!($page > 0)) {
$page = 1;
if (empty($data['comments'])) {
$result['error'] = 1;
$result['message'] = '意外錯誤,傳送的數據為空!';
die($json->encode($result));
}
$comments = $json->decode($data['comments']);
//反json ,返回值為對象
$goods_id = $comments->goods_id;
if (!(intval($goods_id) > 0)) {
$result['error'] = 1;
$result['message'] = '意外錯誤,傳送的數據為空!';
die($json->encode($result));
}
//以下字段對應評論的表單頁麵 一定要一致
$datas['id_value'] = $goods_id;
//$datas['email'] = $comments->email;
$username = $this->Session->read('User.username');
$uid = $this->Session->read('User.uid');
$error2 = false;
$datas['user_name'] = !empty($username) ? $username : "";
if (empty($datas['user_name']) || !($uid > 0)) {
//需要登錄
$result['error'] = 4;
$result['message'] = '你還沒有登錄!請你先登錄!';
die($json->encode($result));
}
//檢查是否已經存在購買商品
$sql = "SELECT tb1.rec_id FROM `{$this->App->prefix()}goods_order` AS tb1";
$sql .= " LEFT JOIN `{$this->App->prefix()}goods_order_info` AS tb2 ON tb1.order_id=tb2.order_id";
$sql .= " WHERE tb1.goods_id='{$goods_id}' AND tb2.user_id='{$uid}' AND tb2.order_status='2' AND tb2.pay_status='1'";
$re_id = $this->App->findvar($sql);
if (!($re_id > 0)) {
//不存在該記錄!
$result['error'] = 1;
$result['message'] = '抱歉,你還沒有購買當前商品,不能評論哦!';
die($json->encode($result));
}
//檢查該商品是否已經評論過
$sql = "SELECT comment_id FROM `{$this->App->prefix()}comment` WHERE id_value='{$goods_id}' AND user_id='{$uid}' LIMIT 1";
$comment_id = $this->App->findvar($sql);
if ($comment_id > 0) {
//存在該記錄!
$result['error'] = 1;
$result['message'] = '抱歉,你已經評論過該商品,不能再評論哦!';
die($json->encode($result));
}
$datas['content'] = $comments->comment;
if (empty($datas['content'])) {
$result['error'] = 1;
$result['message'] = '請填寫評論內容!';
die($json->encode($result));
}
if (strlen($datas['content']) < 12) {
$result['error'] = 1;
$result['message'] = '評論內容不能太少!';
die($json->encode($result));
}
//限製用戶不能重複提交評論,需要等待三分鍾後才能評論
$read_time = $this->Session->read("Comment.{$goods_id}");
if (!empty($read_time)) {
if (mktime() - $read_time < 200) {
$result['error'] = 3;
$result['message'] = '你剛才已經發表了評論,請你稍等下再發表!';
die($json->encode($result));
}
}
$this->Session->write("Comment.{$goods_id}", mktime());
$datas['comment_rank'] = $comments->comment_rank;
$datas['goods_rand'] = $comments->goods_rand;
$datas['goods_rand'] = empty($datas['goods_rand']) ? 5 : $datas['goods_rand'];
$datas['shopping_rand'] = $comments->shopping_rand;
$datas['shopping_rand'] = empty($datas['shopping_rand']) ? 5 : $datas['shopping_rand'];
$datas['saleafter_rand'] = $comments->saleafter_rand;
$datas['saleafter_rand'] = empty($datas['saleafter_rand']) ? 5 : $datas['saleafter_rand'];
$datas['status'] = '1';
$datas['add_time'] = mktime();
$ip = Import::basic()->getip();
$datas['ip_address'] = $ip ? $ip : '0.0.0.0';
$datas['ip_form'] = Import::ip()->ipCity($ip);
$datas['user_id'] = intval($uid) > 0 ? intval($uid) : 0;
$this->App->insert('comment', $datas);
unset($datas, $data);
}
//查詢評論
$list = 2;
$start = ($page - 1) * $list;
$tt = $this->get_comment_count($goods_id);
$rt['comment_count'] = $tt;
$rt['commentlist'] = $this->get_comment_list($goods_id, $start, $list);
$rt['commentpage'] = Import::basic()->ajax_page($tt, $list, $page, 'get_comment_page', array($goods_id));
$this->set('rt', $rt);
$result['message'] = $this->fetch('ajax_comment', true);
die($json->encode($result));
//.........這裏部分代碼省略.........
示例7: ajax_user_register
function ajax_user_register($data = array())
{
$json = Import::json();
$result = array('error' => 2, 'message' => '傳送的數據為空!');
if (empty($data['fromAttr'])) {
die($json->encode($result));
}
$fromAttr = $json->decode($data['fromAttr']);
//反json ,返回值為對象
unset($data);
//以下字段對應評論的表單頁麵 一定要一致
$datas['user_rank'] = $fromAttr->user_rank;
//用戶級別
/* $datas['user_name'] = $fromAttr->mobile_phone; //用戶名
if(empty($datas['user_name'])){
$result = array('error' => 2, 'message' => '請填入登錄賬戶!');
if(empty($data['fromAttr'])) die($json->encode($result));
}*/
$datas['password'] = $fromAttr->password;
if (empty($datas['password'])) {
$result = array('error' => 2, 'message' => '用戶密碼不能為空!');
if (empty($data['fromAttr'])) {
die($json->encode($result));
}
}
$rp_pass = $fromAttr->rp_pass;
if ($rp_pass != $datas['password']) {
$result = array('error' => 2, 'message' => '兩次密碼不相同!');
if (empty($data['fromAttr'])) {
die($json->encode($result));
}
}
$datas['password'] = md5($datas['password']);
$datas['mobile_phone'] = $fromAttr->mobile_phone;
if (empty($datas['mobile_phone'])) {
$result = array('error' => 2, 'message' => '請填上手機號碼!');
if (empty($data['fromAttr'])) {
die($json->encode($result));
}
}
if (preg_match("/1[3458]{1}\\d{9}\$/", $datas['mobile_phone'])) {
} else {
$result = array('error' => 2, 'message' => '手機號碼不合法,請重新輸入!');
if (empty($data['fromAttr'])) {
die($json->encode($result));
}
}
//檢查該手機是否已經使用了
$mobile_phone = $datas['mobile_phone'];
$sql = "SELECT user_id FROM `{$this->App->prefix()}user` WHERE mobile_phone='{$mobile_phone}'";
$uuid = $this->App->findvar($sql);
if ($uuid > 0) {
$result = array('error' => 2, 'message' => '抱歉,該手機號碼已經被使用了!');
if (empty($data['fromAttr'])) {
die($json->encode($result));
}
}
if (!($datas['user_rank'] > 0)) {
$datas['user_rank'] = 1;
}
$datas['user_name'] = $fromAttr->mobile_phone;
//用戶名
/* $yyy = $fromAttr->yyy;
$mmm = $fromAttr->mmm;
$ddd = $fromAttr->ddd;
$datas['birthday'] = $yyy.'-'.$mmm.'-'.$ddd;
$datas['sex'] = $fromAttr->sex;*/
//$regcode = $fromAttr->regcode;
$regcode = '';
if (!empty($regcode)) {
//檢查該注冊碼是否有效
$sql = "SELECT tb1.bonus_id FROM `{$this->App->prefix()}user_coupon_list` AS tb1 LEFT JOIN `{$this->App->prefix()}user_coupon_type` AS tb2 ON tb1.type_id = tb2.type_id WHERE tb1.bonus_sn='{$regcode}' AND tb1.is_used='0' LIMIT 1";
$uuid = $this->App->findvar($sql);
if ($uuid > 0) {
} else {
$result = array('error' => 2, 'message' => '請檢查該注冊碼是否有效!');
die($json->encode($result));
}
}
$uname = $datas['user_name'];
$sql = "SELECT user_name FROM `{$this->App->prefix()}user` WHERE user_name='{$uname}'";
$dbname = $this->App->findvar($sql);
if (!empty($dbname)) {
$result = array('error' => 2, 'message' => '該用戶名已經被注冊了!');
die($json->encode($result));
}
$emails = '';
if (!empty($emails)) {
$sql = "SELECT email FROM `{$this->App->prefix()}user` WHERE email='{$emails}'";
$dbemail = $this->App->findvar($sql);
if (!empty($dbemail)) {
$result = array('error' => 2, 'message' => '該電子郵箱已經被使用了!');
die($json->encode($result));
}
}
$ip = Import::basic()->getip();
$datas['reg_ip'] = $ip ? $ip : '0.0.0.0';
$datas['reg_time'] = mktime();
$datas['reg_from'] = Import::ip()->ipCity($ip);
$datas['last_login'] = mktime();
//.........這裏部分代碼省略.........
示例8: ajax_get_freecatalog
function ajax_get_freecatalog($data = array())
{
$err = 0;
$result = array('error' => $err, 'message' => '');
$json = Import::json();
if (empty($data)) {
$result['error'] = 2;
echo $result['message'] = '傳送的數據為空!';
exit;
//die($json->encode($result));
}
$mesobj = $json->decode($data);
//反json ,返回值為對象
$is_freecatalog_time = $this->Session->read("User.is_freecatalog_time");
if (!empty($is_freecatalog_time) && mktime() - $is_freecatalog_time < 1000) {
$result['error'] = 2;
echo $result['message'] = '你已經提交過了,請歇歇吧 !';
exit;
//die($json->encode($result));
}
//以下字段對應評論的表單頁麵 一定要一致
$dir_ids = $mesobj->dir_ids;
//$s = str_replace('++',"",$dir_ids);
if (empty($dir_ids)) {
$result['error'] = 2;
echo $result['message'] = '請選擇您想索取的目錄 !';
exit;
//die($json->encode($result));
}
$fn = SYS_PATH . 'data/freecatalogdata.php';
file_exists($fn) ? require_once $fn : ($freecatalog = array());
if (empty($freecatalog)) {
$result['error'] = 2;
echo $result['message'] = '管理需要現在後台設置好提取目錄在執行!';
exit;
//die($json->encode($result));
}
$dir_ids_rt = explode("--", $dir_ids);
$dbids = array();
foreach ($dir_ids_rt as $k => $hh) {
$hh = intval($hh) - 1;
$dbids[] = $freecatalog[$hh];
}
$datas['dir_ids'] = !empty($dbids) ? implode('、 ', $dbids) : "";
unset($dir_ids_rt, $dbids);
$datas['user_name'] = $mesobj->username;
if (empty($datas['user_name'])) {
$result['error'] = 2;
echo $result['message'] = '姓名不能為空 !';
exit;
//die($json->encode($result));
}
$datas['birthday'] = $mesobj->birthday;
$datas['user_id'] = $mesobj->user_no;
//顧客號
$datas['sex'] = $mesobj->sex;
$datas['province'] = $mesobj->province;
$datas['city'] = $mesobj->city;
$datas['district'] = $mesobj->district;
$datas['address'] = $mesobj->address;
if (empty($datas['province']) || empty($datas['city']) || empty($datas['district']) || empty($datas['address'])) {
$result['error'] = 2;
echo $result['message'] = '請填寫好完整的地址 !';
exit;
//die($json->encode($result));
}
$datas['postcode'] = $mesobj->postcode;
$datas['dayphone'] = $mesobj->dayphone;
$datas['nightphone'] = $mesobj->nightphone;
$datas['mobile'] = $mesobj->mobile;
if (empty($datas['mobile'])) {
$result['error'] = 2;
echo $result['message'] = '手機不能為空 !';
exit;
//die($json->encode($result));
}
$datas['email'] = $mesobj->email;
$datas['addtime'] = mktime();
$ip = Import::basic()->getip();
$datas['ip_address'] = $ip ? $ip : '0.0.0.0';
$datas['ip_from'] = Import::ip()->ipCity($ip);
if ($this->App->insert('freecatalog', $datas)) {
$result['error'] = 0;
$result['message'] = '你已經提交,我們很快會聯係你!';
$this->Session->write("User.is_freecatalog_time", mktime());
} else {
$result['error'] = 1;
$result['message'] = '提交失敗,請通過在線聯係客服吧!';
}
unset($datas, $data);
echo $result['message'];
exit;
die($json->encode($result));
}
示例9: user_auto_login
//.........這裏部分代碼省略.........
if (empty($headimgurl)) {
$headimgurl = $this->Session->read('User.headimgurl');
}
if (empty($subscribe_time)) {
$subscribe_time = $this->Session->read('User.subscribe_time');
}
$datas = array();
if (!empty($nickname)) {
$datas['nickname'] = $nickname;
}
if (!empty($city)) {
$datas['cityname'] = $city;
}
if (!empty($province)) {
$datas['provincename'] = $province;
}
if (!empty($headimgurl)) {
$datas['headimgurl'] = $headimgurl;
}
if ($sex > 0) {
$datas['sex'] = $sex;
}
$datas['user_name'] = !empty($wecha_id) ? $wecha_id : 'GZSH' . $tid . mktime();
$datas['wecha_id'] = $datas['user_name'];
$t = mktime();
$datas['password'] = md5('A123456');
//自動開通代理
if ($rrL['openfxauto'] == '1') {
$datas['user_rank'] = 12;
//普通分銷商
} else {
$datas['user_rank'] = 1;
}
$ip = Import::basic()->getip();
$datas['reg_ip'] = $ip ? $ip : '0.0.0.0';
$datas['reg_time'] = $t;
$datas['reg_from'] = Import::ip()->ipCity($ip);
$datas['last_login'] = mktime();
$datas['last_ip'] = $datas['reg_ip'];
$datas['active'] = 1;
$issubscribe = $this->Session->read('User.subscribe');
if (empty($issubscribe)) {
$issubscribe = isset($_COOKIE[CFGH . 'USER']['SUBSCRIBE']) ? $_COOKIE[CFGH . 'USER']['SUBSCRIBE'] : '0';
}
if ($issubscribe == '1') {
$datas['is_subscribe'] = 1;
}
$uid = $this->Session->read('User.uid');
if ($uid > 0) {
return true;
}
if ($this->App->insert('user', $datas)) {
//添加賬戶
$uid = $this->App->iid();
$this->Session->write('User.uid', $uid);
if ($tid != $uid) {
//加入分享表
$dd = array();
$dd['share_uid'] = $tid;
//分享者uid
$dd['parent_uid'] = $toid > 0 ? $toid : $tid;
//關注者分享ID
$dd['uid'] = $uid;
$puid = $dd['parent_uid'];
$duid = 0;
if ($puid > 0) {
示例10: reply
//.........這裏部分代碼省略.........
}
//檢查是否存在該用戶
$ukey = $this->Session->read('User.ukey');
if (empty($ukey)) {
$ukey = isset($_COOKIE[CFGH . 'USER']['UKEY']) ? $_COOKIE[CFGH . 'USER']['UKEY'] : '';
}
if (!empty($ukey) && $ukey != $wecha_id) {
$sql = "SELECT user_id FROM `{$this->App->prefix()}user` WHERE wecha_id='{$wecha_id}' LIMIT 1";
$uid = $this->App->findvar($sql);
} else {
$uid = $this->Session->read('User.uid');
if (!($uid > 0)) {
$uid = isset($_COOKIE[CFGH . 'USER']['UID']) ? $_COOKIE[CFGH . 'USER']['UID'] : '0';
if (!($uid > 0)) {
$sql = "SELECT user_id FROM `{$this->App->prefix()}user` WHERE wecha_id='{$wecha_id}' LIMIT 1";
$uid = $this->App->findvar($sql);
$this->Session->write('User.uid', $uid);
setcookie(CFGH . 'USER[UID]', $uid, mktime() + 2592000);
}
}
}
if ($uid > 0) {
$this->App->update('user', $dd, 'user_id', $uid);
$counts = $this->App->findvar("SELECT COUNT(user_id) FROM `{$this->App->prefix()}user` WHERE is_subscribe='1'");
$this->App->update('user', array('subscribe_rank' => $counts), 'user_id', $uid);
//更改排名
} else {
//添加用戶
$dd['user_name'] = $wecha_id;
$dd['wecha_id'] = $wecha_id;
$t = mktime();
$dd['password'] = md5('A123456');
$dd['user_rank'] = 1;
$ip = Import::basic()->getip();
$dd['reg_ip'] = $ip ? $ip : '0.0.0.0';
$dd['reg_time'] = $t;
$dd['reg_from'] = Import::ip()->ipCity($ip);
$dd['last_login'] = mktime();
$dd['last_ip'] = $dd['reg_ip'];
$dd['active'] = 1;
if ($this->App->insert('user', $dd)) {
$uid = $this->App->iid();
$counts = $this->App->findvar("SELECT COUNT(user_id) FROM `{$this->App->prefix()}user` WHERE is_subscribe='1'");
${$counts} = $counts + 1;
$this->App->update('user', array('subscribe_rank' => $counts), 'user_id', $uid);
//更改排名
$this->Session->write('User.username', $dd['user_name']);
$this->Session->write('User.uid', $uid);
$this->Session->write('User.active', '1');
$this->Session->write('User.rank', '1');
$this->Session->write('User.ukey', $dd['wecha_id']);
//$this->Session->write('User.pass',$dd['password']);
$this->Session->write('User.addtime', mktime());
//寫入cookie
setcookie(CFGH . 'USER[UKEY]', $dd['wecha_id'], mktime() + 2592000);
setcookie(CFGH . 'USER[UID]', $uid, mktime() + 2592000);
$tid = $this->Session->read('User.tid');
if (!($tid > 0)) {
$tid = isset($_COOKIE[CFGH . 'USER']['TID']) ? $_COOKIE[CFGH . 'USER']['TID'] : "0";
}
//分享的來源ID
$to_wecha_id = $this->Session->read('User.to_wecha_id');
//來源ID
if (!($to_wecha_id > 0)) {
$to_wecha_id = isset($_COOKIE[CFGH . 'USER']['TOOPENID']) ? $_COOKIE[CFGH . 'USER']['TOOPENID'] : "0";
}
示例11: ajax_feedback
function ajax_feedback($data = array())
{
$err = 0;
$result = array('error' => $err, 'message' => '');
$json = Import::json();
if (empty($data)) {
$result['error'] = 2;
$result['message'] = '傳送的數據為空!';
die($json->encode($result));
}
$mesobj = $json->decode($data);
//反json ,返回值為對象
//以下字段對應評論的表單頁麵 一定要一致
$datas['comment_title'] = $mesobj->comment_title;
$datas['goods_id'] = $mesobj->goods_id;
$goods_id = $datas['goods_id'];
$uid = $this->Session->read('User.uid');
$datas['user_id'] = !empty($uid) ? $uid : 0;
$datas['status'] = 2;
if (strlen($datas['comment_title']) < 12) {
$result['error'] = 2;
$result['message'] = '評論內容不能太少!';
die($json->encode($result));
}
//檢查需要超過24小時候才能再次提問
//if(!empty($goods_id)){
$t = mktime() + 24 * 3600;
$sql = "SELECT addtime FROM `{$this->App->prefix()}message` WHERE user_id='{$uid}' AND goods_id='{$goods_id}' ORDER BY addtime DESC LIMIT 1";
$dt = $this->App->findvar($sql);
if (!empty($dt)) {
if ($dt + 3600 * 24 > mktime()) {
$result['error'] = 1;
$result['message'] = '今天你已經發表過提問了,請你<font color=red>' . intval(($dt + 3600 * 24 - mktime()) / 3600) . '</font>小時之後再次提問吧!';
die($json->encode($result));
}
}
//}
/*$datas['content'] = $mesobj->content;goods_id
$datas['user_name'] = $mesobj->user_name;
$datas['sex'] = $mesobj->sex;
$datas['mobile'] = $mesobj->mobile;
$datas['telephone'] = $mesobj->telephone;
$datas['email'] = $mesobj->email;
$datas['companyname'] = $mesobj->companyname;
$datas['address'] = $mesobj->address;
$datas['companyurl'] = $mesobj->companyurl;
*/
$datas['addtime'] = mktime();
$ip = Import::basic()->getip();
$datas['ip_address'] = $ip ? $ip : '0.0.0.0';
$datas['ip_from'] = Import::ip()->ipCity($ip);
if ($this->App->insert('message', $datas)) {
$rl = $this->action('user', 'add_user_jifen', 'comment');
$result['error'] = 0;
$result['message'] = '提問成功,我們會很快回答你的問題!<br />恭喜你,本次提問所得積分:' . $rl['points'] . '分!';
} else {
$result['error'] = 1;
$result['message'] = '提問失敗,請通過在線聯係客服吧!';
}
unset($datas, $data);
//查詢評論
if (!$page) {
$page = 1;
}
$list = 2;
$start = ($page - 1) * $list;
$tt = $this->__get_message_count($goods_id);
$rt['message_count'] = $tt;
$rt['messagelist'] = $this->__get_message($goods_id, $start, $list);
$rt['messagepage'] = Import::basic()->ajax_page($tt, $list, $page, 'get_message_page', array($goods_id));
$rt['goodsinfo']['goods_id'] = $goods_id;
$this->set('rt', $rt);
$result['message'] = $this->fetch('ajax_message', true);
die($json->encode($result));
}
示例12: ajax_user_register
function ajax_user_register($data = array())
{
$json = Import::json();
$result = array('error' => 2, 'message' => '傳送的數據為空!');
if (empty($data['fromAttr'])) {
die($json->encode($result));
}
$fromAttr = $json->decode($data['fromAttr']);
//反json ,返回值為對象
unset($data);
//以下字段對應評論的表單頁麵 一定要一致
$datas['user_rank'] = $fromAttr->user_rank;
//用戶級別
$datas['user_name'] = $fromAttr->username;
//用戶名
$datas['email'] = $fromAttr->email;
$datas['password'] = md5($fromAttr->password);
if (!($datas['user_rank'] > 0)) {
$datas['user_rank'] = 1;
}
if ($datas['user_rank'] != '1') {
//供應商 || 配送店 || 企業會員
/**
* look修改注釋
$datass['consignee'] = $fromAttr->consignee;
if(empty($datass['consignee'])){
$result = array('error' => 2, 'message' => '聯係人姓名不能為空!');
if(empty($data['fromAttr'])) die($json->encode($result));
}
$datass['tel'] = $fromAttr->tel;
if(empty($datass['tel'])){
$result = array('error' => 2, 'message' => '固定電話不能為空!');
if(empty($data['fromAttr'])) die($json->encode($result));
}
$datass['mobile'] = $fromAttr->mobile;
$datass['province'] = $fromAttr->province;
if(empty($datass['province'])){
$result = array('error' => 2, 'message' => '必須選擇省份!');
if(empty($data['fromAttr'])) die($json->encode($result));
}
$datass['city'] = $fromAttr->city;
if(empty($datass['city'])){
$result = array('error' => 2, 'message' => '必須選擇城市!');
if(empty($data['fromAttr'])) die($json->encode($result));
}
$datass['district'] = $fromAttr->district;
if(empty($datass['district'])){
$result = array('error' => 2, 'message' => '必須選擇地區!');
if(empty($data['fromAttr'])) die($json->encode($result));
}
$datass['address'] = $fromAttr->address;
if(empty($datass['address'])){
$result = array('error' => 2, 'message' => '詳細地址不能為空!');
if(empty($data['fromAttr'])) die($json->encode($result));
}
*/
$datass['email'] = $datas['email'];
}
$uname = $datas['user_name'];
/****** look修改注釋 取消注冊時不能用戶名一樣的。 ************************
$sql = "SELECT user_name FROM `{$this->App->prefix()}user` WHERE user_name='$uname'";
$dbname = $this->App->findvar($sql);
if(!empty($dbname)){
$result = array('error' => 2, 'message' => '該用戶名已經被注冊了!');
die($json->encode($result));
}
*/
$emails = $datas['email'];
if (!empty($emails)) {
$sql = "SELECT email FROM `{$this->App->prefix()}user` WHERE email='{$emails}'";
$dbemail = $this->App->findvar($sql);
if (!empty($dbemail)) {
$result = array('error' => 2, 'message' => '該電子郵箱已經被使用了!');
die($json->encode($result));
}
}
$ip = Import::basic()->getip();
$datas['reg_ip'] = $ip ? $ip : '0.0.0.0';
$datas['reg_time'] = mktime();
$datas['reg_from'] = Import::ip()->ipCity($ip);
$datas['last_login'] = mktime();
$datas['last_ip'] = $datas['reg_ip'];
$datas['active'] = 0;
if ($this->App->insert('user', $datas)) {
$uid = $this->App->iid();
$this->Session->write('User.username', $uname);
$this->Session->write('User.uid', $uid);
$this->Session->write('User.active', $datas['active']);
$this->Session->write('User.rank', $datas['user_rank']);
$this->Session->write('User.lasttime', $datas['last_login']);
$this->Session->write('User.lastip', $datas['last_ip']);
$datass['user_id'] = $uid;
$datass['is_own'] = '1';
$this->App->insert('user_address', $datass);
$result = array('error' => 0, 'message' => '注冊成功!');
//注冊成功後,發送mail
if (!empty($emails) && $GLOBALS['LANG']['email_open_config']['register'] == '1') {
//.........這裏部分代碼省略.........
示例13: _create_user
//.........這裏部分代碼省略.........
}
}*/
$nickname = $this->Session->read('User.nickname');
$sex = $this->Session->read('User.sex');
$city = $this->Session->read('User.city');
$province = $this->Session->read('User.province');
$headimgurl = $this->Session->read('User.headimgurl');
$datas = array();
if(!empty($nickname)) $datas['nickname'] = $nickname;
if(!empty($city)) $datas['cityname'] = $city;
if(!empty($province)) $datas['provincename'] = $province;
if(!empty($headimgurl)) $datas['headimgurl'] = $headimgurl;
if($sex > 0) $datas['sex'] = $sex;
if(empty($wecha_id)) $wecha_id = isset($_COOKIE[CFGH.'USER']['UKEY']) ? $_COOKIE[CFGH.'USER']['UKEY'] : "";
if(empty($wecha_id)){ //跳轉首頁
$is_oauth = $this->App->findvar("SELECT is_oauth FROM `{$this->App->prefix()}wxuserset` WHERE id='1'");
if($is_oauth=='1'){ //授權跳轉首頁
$this->Session->write('User',null);
setcookie(CFGH.'USER[TOOPENID]', "", mktime()-3600);
setcookie(CFGH.'USER[UKEY]', "", mktime()-3600);
//setcookie('USER[PASS]', "", mktime()-3600);
setcookie(CFGH.'USER[TID]', "", mktime()-3600);
setcookie(CFGH.'USER[UID]', "", mktime()-3600);
$this->jump(ADMIN_URL); exit;
}
}
$datas['user_name'] = !empty($wecha_id) ? $wecha_id : 'GZSH'.$tid.mktime();
$datas['wecha_id'] = $datas['user_name'];
$t = mktime();
$datas['password'] = md5('A123456');
$datas['user_rank'] = 1;
$ip = Import::basic()->getip();
$datas['reg_ip'] = $ip ? $ip : '0.0.0.0';
$datas['reg_time'] = $t;
$datas['reg_from'] = Import::ip()->ipCity($ip);
$datas['last_login'] = mktime();
$datas['last_ip'] = $datas['reg_ip'];
$datas['active'] = 1;
$issubscribe = $this->Session->read('User.subscribe');
if(empty($issubscribe)) $isSUBSCRIBE = isset($_COOKIE[CFGH.'USER']['SUBSCRIBE']) ? $_COOKIE[CFGH.'USER']['SUBSCRIBE'] : '0';
if($issubscribe == '1'){ $datas['is_subscribe'] = 1; }
if($this->App->insert('user',$datas)){ //添加賬戶
$uid = $this->App->iid();
if(/*$tid > 0 &&*/ $tid!=$uid){//加入分享表
$dd = array();
$url = $this->Session->read('User.url');
$dd['share_uid'] = $tid; //分享者uid
$dd['parent_uid'] = $to_wecha_id > 0 ? $to_wecha_id : $tid; //關注者分享ID
$dd['uid'] = $uid;
$puid = $dd['parent_uid'];
$duid = 0;
if($puid > 0){
//檢查是否是代理
$rank = $this->App->findvar("SELECT user_rank FROM `{$this->App->prefix()}user` WHERE user_id = '$puid' LIMIT 1");
if($rank=='10'){
$duid = $puid;
}else{
//檢查推薦的代理ID
$duid = $this->App->findvar("SELECT daili_uid FROM `{$this->App->prefix()}user_tuijian` WHERE uid = '$puid' LIMIT 1");
}
}
$dd['daili_uid'] = $duid;
$dd['url'] = $url;
$dd['addtime'] = mktime();