Commit a7c58670 authored by zhangjun's avatar zhangjun

修改

parent 42916212
......@@ -388,11 +388,13 @@ define('GB_SEND_SMS_URL','http://user.house365.com/');
// 提交忘记密码接口地址
define('GB_FORGET_SMS_URL','http://user.house365.com/');
// 修改手机页面地址
define('GB_EDIT_PHONE_URL','http://newrent.house365.com/user-center/edit-phone');
define('GB_EDIT_PHONE_URL','http://newrenttest.house365.com/user-center/edit-phone');
// 修改密码页面地址
define('GB_EDIT_PWD_URL','http://newrent.house365.com/user-center/edit-pwd');
define('GB_EDIT_PWD_URL','http://newrenttest.house365.com/user-center/edit-pwd');
// 基于个人用户ID获取用户数据
define('GB_GET_USER_INFO_BY_USER_ID_URL', 'http://newrenttest.house365.com/api/tf-app/get-user-info-by-personal-id');
// 基于sso_token获取用户数据
define('GB_GET_USER_INFO_BY_SSO_URL', 'http://ucentertest.house365.com/index/user/info');
if($_SERVER['SERVER_ADDR'] == '192.168.105.106')
......
......@@ -2,7 +2,7 @@
/**
* sendsms($mobile,$msg)
*
* 发送短信
* ���Ͷ���
* @param none
* @global none
* @return void
......@@ -16,7 +16,7 @@ function sendsms($mobile,$msg,$type='ad',$yzm="")
/**
* get_api($url, $nocache = 0)
*
* 接口函数 Fisher 2013-1-12
* �ӿں��� Fisher 2013-1-12
*/
if(!function_exists('get_api'))
{
......@@ -40,10 +40,28 @@ function curl_get_contents($str,$t_url="")
return $str;
}
function curl_get_contents_new($str,$t_url="", $cookie = '')
{
$ch = curl_init();
$t_url = $t_url ? $t_url : "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
curl_setopt($ch, CURLOPT_URL, $str);
curl_setopt($ch, CURLOPT_COOKIE, $cookie);
curl_setopt($ch, CURLOPT_REFERER, $t_url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, 1);
$str = curl_exec($ch);
curl_close($ch);
if ( empty( $str ) ) {
return array();
}
return json_decode( $str, 1 );
}
/**
* random($length)
*
* 产生随机数函数
* �������������
* @param none
* @global none
* @return void
......@@ -72,14 +90,14 @@ if(!function_exists('jumpto'))
if(!function_exists('jumptotk'))
{
function jumptotk($url, $message = "执行完毕!", $sec = 3000, $template = "tips")
function jumptotk($url, $message = ����ϣ�", $sec = 3000, $template = "tips")
{
if($template == 'tips')
{
echo '<div class="pop" style="width:390px;height:160px; position:absolute;left:50%;top:50%;margin-left:-200px;margin-top:-120px;-moz-box-shadow: 0 0 34px #cacaca;-webkit-box-shadow: 0 0 34px #cacaca;box-shadow: 0 0 34px #cacaca;border:1px solid #ccc;">
<div class="hd" style="height:40px;background:#FF8400">
<h2 style="font-size:14px;color:#fff;font-weight:800; position:absolute;left:10px;top:10px">示</h2>
<a href="javascript:void(0)" class="close-pop" style="display:block;width:30px;height:30px;background:url('.USER_CENTER.'images/pop-ico.gif) 0 -80px no-repeat; position:absolute;right:10px;top:6px; text-indent:-999px; overflow:hidden" onclick="location.href=\''.$url.'\'">关闭</a>
<h2 style="font-size:14px;color:#fff;font-weight:800; position:absolute;left:10px;top:10px">��ʾ</h2>
<a href="javascript:void(0)" class="close-pop" style="display:block;width:30px;height:30px;background:url('.USER_CENTER.'images/pop-ico.gif) 0 -80px no-repeat; position:absolute;right:10px;top:6px; text-indent:-999px; overflow:hidden" onclick="location.href=\''.$url.'\'">�ر�</a>
</div>
<div class="bd" style="background:#fff;height:120px">
<div style="width:70px;height:80px;background:url('.USER_CENTER.'images/pop-ico.gif) no-repeat; position:absolute;left:70px;top:60px"></div>
......@@ -89,8 +107,8 @@ if(!function_exists('jumptotk'))
}elseif($template == 'tipswaring'){
echo '<div class="pop" style="width:390px;height:160px;border:1px solid #ccc; position:absolute;left:50%;top:50%;margin-left:-200px;margin-top:-120px;-moz-box-shadow: 0 0 34px #cacaca;-webkit-box-shadow: 0 0 34px #cacaca;box-shadow: 0 0 34px #cacaca;">
<div class="hd" style="height:40px;background:#FF8400">
<h2 style="font-size:14px;color:#fff;font-weight:800; position:absolute;left:10px;top:10px">示</h2>
<a href="javascript:void(0)" class="close-pop" style="display:block;width:30px;height:30px;background:url('.USER_CENTER.'images/pop-ico.gif) 0 -80px no-repeat; position:absolute;right:10px;top:6px; text-indent:-999px; overflow:hidden" onclick="location.href=\''.$url.'\'">关闭</a>
<h2 style="font-size:14px;color:#fff;font-weight:800; position:absolute;left:10px;top:10px">��ʾ</h2>
<a href="javascript:void(0)" class="close-pop" style="display:block;width:30px;height:30px;background:url('.USER_CENTER.'images/pop-ico.gif) 0 -80px no-repeat; position:absolute;right:10px;top:6px; text-indent:-999px; overflow:hidden" onclick="location.href=\''.$url.'\'">�ر�</a>
</div>
<div style="width:70px;height:80px;background:url('.USER_CENTER.'images/pop-ico.gif) no-repeat -2px -113px; position:absolute;left:70px;top:60px"></div>
<p style="position:absolute;left:160px;top:85px;font-size:14px">'.$message.'</p>
......@@ -105,7 +123,7 @@ if(!function_exists('jumptotk'))
function tel_yc($tel)
{
//隐藏手机号部分数字
//�����ֻ��Ų�������
$pattern = "/(1\d{1,2})\d\d(\d{0,3})/";
$replacement = "\$1****\$3";
......@@ -113,7 +131,7 @@ function tel_yc($tel)
}
/*设置登录cookie*/
/*���õ�¼cookie*/
function vbsetcookie($name,$value="",$permanent=1) {
$cookiedomain=".house365.com";
......@@ -129,7 +147,7 @@ function vbsetcookie($name,$value="",$permanent=1) {
}
/*设置cookie,session*/
/*����cookie,session*/
function setcoandsess($name,$value="",$permanent=1) {
$cookiedomain=".house365.com";
......@@ -161,11 +179,11 @@ function StrCode($string,$action='ENCODE'){
/**
* GetIP - 获取客户端IP地
* GetIP - ��ȡ�ͻ���IP��ַ
*
* @access public
* @param none
* @return string IP
* @return string IP��ַ
*/
if ( ! function_exists('get_ip'))
{
......@@ -187,7 +205,7 @@ if ( ! function_exists('get_ip'))
//南京站根据表名和房源ID获取房源图片存储的表名称
//�Ͼ�վ���ݱ����ͷ�ԴID��ȡ��ԴͼƬ�洢�ı�����
if ( ! function_exists('get_upload_tblname'))
{
function get_upload_tblname($tbl,$id){
......@@ -338,8 +356,8 @@ if ( ! function_exists('get_upload_tblname'))
/**
* 获取二手房的房源地
* @param array $row 房源信息,必须含有id
* ��ȡ���ַ��ķ�Դ��ַ
* @param array $row ��Դ��Ϣ,���뺬��id
* @return stirng
*/
if(!function_exists('get_sellinfo_url'))
......@@ -359,8 +377,8 @@ if(!function_exists('get_sellinfo_url'))
/**
* 获取求购地
* @param array $row 房源信息,必须含有id
* ��ȡ�󹺵�ַ
* @param array $row ��Դ��Ϣ,���뺬��id
* @return stirng
*/
if(!function_exists('get_buyinfo_url'))
......@@ -378,13 +396,13 @@ if(!function_exists('get_buyinfo_url'))
}
/**
* 获取租房的房源地
* @param array $row 房源信息,必须含有id
* ��ȡ�ⷿ�ķ�Դ��ַ
* @param array $row ��Դ��Ϣ,���뺬��id
* @return stirng
*/
if(!function_exists('get_rentinfo_url'))
{
function get_rentinfo_url($row,$pre = 'r') //房源地
function get_rentinfo_url($row,$pre = 'r') //��Դ��ַ
{
if(is_array($row)) {
if(!empty($row['ID'])) $id = $row['ID'];
......@@ -400,13 +418,13 @@ if(!function_exists('get_rentinfo_url'))
}
/**
* 获取问答地址
* ��ȡ�ʴ��ַ
* @param array $qid
* @return stirng
*/
if(!function_exists('get_questioninfo_url'))
{
function get_questioninfo_url($qid) //房源地
function get_questioninfo_url($qid) //��Դ��ַ
{
$ss = GB_SELL_URL."/ask_".$qid.".html";
return $ss;
......@@ -416,7 +434,7 @@ if(!function_exists('get_questioninfo_url'))
/**
* 获取小区地
* ��ȡС����ַ
* @param array $id
* @return stirng
*/
......@@ -428,7 +446,7 @@ if(!function_exists('get_questioninfo_url'))
}
/**
*获取学校地
*��ȡѧУ��ַ
*@param int $id
*@return string
*/
......@@ -439,7 +457,7 @@ if(!function_exists('get_questioninfo_url'))
/**
*获取学校小区地
*��ȡѧУС����ַ
*@param int $id
*@return string
*/
......@@ -449,7 +467,7 @@ if(!function_exists('get_questioninfo_url'))
}
/**
*获取学校二手房地
*��ȡѧУ���ַ���ַ
*@param int $id
*@return string
*/
......@@ -459,7 +477,7 @@ if(!function_exists('get_questioninfo_url'))
}
/**
*获取学校租房地
*��ȡѧУ�ⷿ��ַ
*@param int $id
*@return string
*/
......@@ -471,7 +489,7 @@ if(!function_exists('get_questioninfo_url'))
/**
* 判断值是否为数组
* �ж�ֵ�Ƿ�Ϊ����
* @param array $arrValue
* @return bool true or false
* @author sun
......@@ -481,10 +499,10 @@ function isFullArray($arrValue) {
}
/**
* time_tran 距离现在时间多久
* time_tran ��������ʱ����
*
* @param string $the_time 时间参数
* @return string 描述字符串
* @param string $the_time ʱ�����
* @return string �����ַ���
*/
function time_tran ($the_time) {
......@@ -495,13 +513,13 @@ function time_tran ($the_time) {
$str = $the_time;
}else{
if($dur < 60){
$str = $dur.'前';
$str = $dur.'��ǰ';
}else if($dur < 3600){
$str = floor($dur/60).'分钟前';
$str = floor($dur/60).'����ǰ';
}else if($dur < 86400){
$str = floor($dur/3600).'Сʱǰ';
}else if($dur < 259200){
$str = floor($dur/86400).'前';
$str = floor($dur/86400).'��ǰ';
}else if($dur > 259200){
$str = date('Y-m-d H:i',$the_time);
}
......@@ -510,7 +528,7 @@ function time_tran ($the_time) {
return $str;
}
//加密,解密函数 FISHER 2014-3-5
//���ܣ����ܺ��� FISHER 2014-3-5
function passport_encrypt($txt, $key='fisher.house365.com') {
srand((double)microtime() * 1000000);
$encrypt_key = md5(rand(0, 32000));
......@@ -545,12 +563,12 @@ function passport_key($txt, $encrypt_key) {
function check_input($value)
{
// 去除斜杠
// ȥ��б��
if (get_magic_quotes_gpc())
{
$value = stripslashes($value);
}
// 如果不是数字则加引号
// ������������������
if (!is_numeric($value))
{
$value = "'" . mysql_real_escape_string($value) . "'";
......@@ -560,9 +578,9 @@ return $value;
/**
* jsonNew 对数据进行gbk转utf8后json编码 json($data)
* @param mixed $data 需要编码的数据
* @return mixed $data_json 编码后的数据
* jsonNew �����ݽ���gbkתutf8��json���� json($data)
* @param mixed $data ��Ҫ���������
* @return mixed $data_json ����������
* @ 2012-10-16 xz
**/
function jsonNew($data,$inChar="GBK",$outChar="UTF-8") {
......@@ -574,7 +592,7 @@ function jsonNew($data,$inChar="GBK",$outChar="UTF-8") {
/**
* 替换数组编码(支持字符串和多维数组)
* �滻�������(֧���ַ����Ͷ�ά����)
* @param mixed $strInput
* @param string $inChar
* @param string $outChar
......@@ -599,25 +617,25 @@ function strIconv($strInput,$inChar="GBK",$outChar="UTF-8"){
}
//通过curl模拟post的请求;
//ͨ��curlģ��post������
function SendDataByCurl($url,$data=array()){
//对空格进行转义
//�Կո����ת��
$url = str_replace(' ','+',$url);
$ch = curl_init();
//设置选项,包括URL
//����ѡ�����URL
curl_setopt($ch, CURLOPT_URL, "$url");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch,CURLOPT_TIMEOUT,3); //定义超时3秒钟
// POST数据
curl_setopt($ch,CURLOPT_TIMEOUT,3); //���峬ʱ3����
// POST����
curl_setopt($ch, CURLOPT_POST, 1);
// 把post的变量加上
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data)); //所需传的数组用http_bulid_query()函数处理一下,就ok了
// ��post�ı�������
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data)); //���贫��������http_bulid_query()��������һ�£���ok��
//执行并获取url地址的内容
//ִ�в���ȡurl��ַ������
$output = curl_exec($ch);
$errorCode = curl_errno($ch);
//释放curl句柄
//�ͷ�curl���
curl_close($ch);
if(0 !== $errorCode) {
return false;
......
......@@ -9,7 +9,7 @@
$ci->load->model('user_model');
getLoginInfoBySSO();
getLoginInfoBySSOUcenter();
if(!empty($_COOKIE['esfuserid']) && !empty($_COOKIE['esfpassword']))
{
......@@ -67,6 +67,35 @@
return $info;
}
function getLoginInfoBySSOUcenter(){
if(empty($_COOKIE['sso_token'])){
return false;
}
$ci = & get_instance();
if(empty($_COOKIE['esfuserid']) || empty($_COOKIE['esfpassword'])){
$url = GB_GET_USER_INFO_BY_SSO_URL;
$cookieStr = "sso_token=" . $_COOKIE['sso_token'];
$info = curl_get_contents_new($url, '', $cookieStr);
if(is_array($info) && !empty($info)){
if (isset($info['data']['id']) && $info['data']['id']) {
$passport_uid = $info['data']['id'];
$ci->load->model('user_model');
$user = $ci->user_model->get_data(array('form_name' => 'personal_user','where'=>array('passport_uid'=>$passport_uid),'select'=>array('id','telno','password')),'dbuser');
if($user){
$esfuserid = $user[0]['id'];
$esfpassword = $user[0]['password'];
setcookie('esfuserid',$esfuserid,time() + 3600 * 24 * 7,'/','.house365.com');
setcookie('esfpassword',$esfpassword,time() + 3600 * 24 * 7,'/','.house365.com');
}
}
}else{
return false;
}
}
return $info;
}
function getmesnumbyuidwd()
{
......
......@@ -26,7 +26,7 @@ class User_class
if($telno=='')
{
$temp = $CI->user_model->getuserdetail($result);
$temp = $CI->user_model->getuserdetailUcenter($result);
$telno = $temp['telno'];
}
$password_encrypt = passport_encrypt($password);
......@@ -71,7 +71,7 @@ class User_class
$CI->load->model('user_model');
//查询上次登录时间
$last_logintime = $CI->user_model->getuserdetail($result);
$last_logintime = $CI->user_model->getuserdetailUcenter($result);
if(date("Y-m-d",$last_logintime['lastlogintime']) != date("Y-m-d"))
{
......
......@@ -557,7 +557,7 @@ class User_model extends MY_Model
if( $check_login > 0 )
{
$_SESSION['esfuserid']=$check_login;
$user = $this->getuserdetail($check_login);
$user = $this->getuserdetailUcenter($check_login);
//赋值SESSION
$array = array( 'esfuserid'=>$user['id'] , 'esfpassword'=>$user['password'] ,'esfusername'=>$user['username'] , 'esfusertelno'=>$user['telno'] ,'esfusercity'=>GB_CITY,'esfshowname'=>$_COOKIE['esfshowname']);
......@@ -795,6 +795,24 @@ class User_model extends MY_Model
}
}
/**
* 验证是否该用户已注册过手机号
* @param type $uid
* @return string
*/
function getuserdetailUcenter($uid)
{
$url = GB_GET_USER_INFO_BY_USER_ID_URL . '?uid=' . $uid;
$userRes = curl_get_contents( $url );
$userInfo = !empty( $userRes ) ? json_decode( $userRes, 1 ) : array();
if(isset($userInfo['data']) && !empty($userInfo['data']))
{
return $userInfo['data'];
}else{
return array();
}
}
/**
* 获取所有的房源特色标签
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment