当前位置: 首页>>代码示例>>PHP>>正文


PHP Import::ip方法代码示例

本文整理汇总了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));
 }
开发者ID:jasonhzy,项目名称:fx_demo,代码行数:49,代码来源:controller.php

示例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>
开发者ID:zhaoshengloveqingqing,项目名称:fenxiao,代码行数:31,代码来源:index.php

示例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;
 }
开发者ID:jasonhzy,项目名称:fx_demo,代码行数:60,代码来源:controller.php

示例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');
开发者ID:jasonhzy,项目名称:fx_demo,代码行数:31,代码来源:suppliers.php

示例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');
 }
开发者ID:zhaoshengloveqingqing,项目名称:fenxiao,代码行数:52,代码来源:controller.php

示例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));
//.........这里部分代码省略.........
开发者ID:jasonhzy,项目名称:wxfx,代码行数:101,代码来源:controller.php

示例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();
//.........这里部分代码省略.........
开发者ID:jasonhzy,项目名称:wxfx,代码行数:101,代码来源:controller.php

示例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('、&nbsp;', $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));
 }
开发者ID:zhaoshengloveqingqing,项目名称:fenxiao,代码行数:94,代码来源:controller.php

示例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) {
开发者ID:zhaoshengloveqingqing,项目名称:fenxiao,代码行数:67,代码来源:controller.php

示例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";
                     }
开发者ID:jasonhzy,项目名称:fx_demo,代码行数:67,代码来源:controller.php

示例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));
 }
开发者ID:zhaoshengloveqingqing,项目名称:fenxiao,代码行数:75,代码来源:controller.php

示例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') {
//.........这里部分代码省略.........
开发者ID:jasonhzy,项目名称:fx_demo,代码行数:101,代码来源:controller.php

示例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();
开发者ID:jasonhzy,项目名称:fx_demo,代码行数:67,代码来源:复件+controller.php


注:本文中的Import::ip方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。