Esempio n. 1
0
function order_paid($order_id){
  
	$pay=get_pay_one($order_id);
	 //购买服务,0:钻石会员,1:高级会员,2:城市之星
	$serviceArr = array(0=>'钻石会员',1=>'高级会员',2=>'城市之星');
	 
	if($pay['status']=="1"){
		return false;
	}else {
		update_pay($order_id);//更新状态防止快速刷新
		update_user_rank($pay['uid'],$pay['pay_service']);//更新用户相应的等级
		
		$type_name = $serviceArr[$pay['pay_service']];
		$content="恭喜您,您已成功升级为真爱一生网{$type_name}!您的真爱一生单号".$order_id."请等待审核。[真爱一生网]";
		if(!empty($pay['telphone'])){
			if(SendMsg($pay['telphone'],$content)){
				$time=time();
				$_MooClass['MooMySQL']->query("INSERT INTO {$dbTablePre}smslog_sys (id,sid,uid,content,sendtime,type) values('','',".$pay['uid'].",'$content','$time','升级')");
				}
		}

		MooSendMail($pay['username'],"真爱一生网会员升级",$content.'您可以咨询客服您的会员办理进度!',$is_template = true,$pay['uid']);
		 
		return true;  		 
	   
	 } 
}
Esempio n. 2
0
File: ajax.php Progetto: noikiy/zays
function getVcode()
{
    global $_MooCookie, $_MooClass, $dbTablePre;
    $rand = rand(1621, 9699);
    //MooSetCookie( "mobilevcode_",$rand );
    MooSetCookie("mobilevcode", md5(md5($rand)));
    $telphone = MooGetGPC('telphone', 'string', 'G');
    $time = time();
    $time_cookie = isset($_MooCookie['vtime']) ? $_MooCookie['vtime'] : 0;
    if ($time - $time_cookie >= 60) {
        MooSetCookie('vtime', $time, time() + 3600 * 24 * 8);
        //手机短信接口
        SendMsg($telphone, "您的短信验证码:" . $rand, 1);
    }
}
Esempio n. 3
0
File: ajax.php Progetto: noikiy/zays
function telphone_code()
{
    global $_MooCookie, $userid, $_MooClass, $dbTablePre;
    if ($_MooCookie['sendtimes']) {
        return;
    }
    MooSetCookie("sendtimes", 1);
    $rand = rand(3621, 9654);
    MooSetCookie("rand", md5(md5($rand)));
    MooSetCookie("counts", $_MooCookie['counts'] + 1, 3600);
    $phone = MooGetGPC('phone', 'string', 'G');
    $content = "会员ID{$userid},您的手机验码:" . $rand;
    if (SendMsg($phone, $content, 1)) {
        $time = time();
        $_MooClass['MooMySQL']->query("INSERT INTO {$dbTablePre}smslog_sys (id,sid,uid,content,sendtime,type) values('','','{$userid}','{$content}','{$time}','验证码')");
    }
}
Esempio n. 4
0
File: ajax.php Progetto: noikiy/zays
function reg_truetelphone()
{
    global $_MooCookie, $_MooClass, $dbTablePre;
    $rand = rand(362144, 965421);
    MooSetCookie("rand", md5(md5($rand)));
    $truetelphone_val = MooGetGPC('truetelphone_val', 'string', 'G');
    $all_val = explode(',', $truetelphone_val);
    $uid = $all_val[0];
    $telphone = $all_val[1];
    $password2 = $all_val[2];
    $time = time();
    $time_cookie = isset($_MooCookie['time']) ? $_MooCookie['time'] : 0;
    if ($time - $time_cookie >= 60) {
        MooSetCookie('time', $time, time() + 3600 * 24 * 8);
        //希希奥信息发送手机短信接口
        if (SendMsg($telphone, "您已成功注册为真爱一生网会员ID:" . $uid . ",密码" . $password2 . ",手机认证码" . $rand . ",本认证码两小时内有效。")) {
            $_MooClass['MooMySQL']->query("INSERT INTO {$dbTablePre}smslog_sys (id,sid,uid,content,sendtime,type) values('','','{$uid}','注册验证码','{$time}','注册验证码')");
        }
    } else {
        echo 'Not login!';
    }
}
Esempio n. 5
0
function vipuser_upgrade_new()
{
    $pid = MooGetGPC('pid', 'string', 'G');
    $uid = MooGetGPC('uid', 'string', 'G');
    $add_money = MooGetGPC('add_money', 'string', 'G');
    $time = time();
    $sql = "SELECT uid,username , nickname, gender, birthyear, s_cid, bgtime, endtime,telphone,sid FROM {$GLOBALS['dbTablePre']}members_search WHERE uid = '{$uid}'";
    $user = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql, true);
    if (empty($user)) {
        echo '无此会员,请确认';
        exit;
    }
    $sql = "SELECT * FROM {$GLOBALS['dbTablePre']}payment_new WHERE id = '{$pid}' AND uid = '{$uid}' LIMIT 1";
    $pay = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql, true);
    if (empty($pay) || $pay['status'] == 3) {
        echo '操作失败!订单不存在或已经处理过了.';
        exit;
    }
    $bgtime = time();
    if ($pay['pay_service'] == 0) {
        // 升级为钻石会员
        if ($user['s_cid'] == 20 && $user['endtime'] > $bgtime) {
            $bgtime = $user['bgtime'];
            $endtime = strtotime("+6 month", $user['endtime']);
        } else {
            $endtime = strtotime("+6 month");
        }
        $s_cid = 20;
        $content = "尊敬的会员您好,恭喜您已成功升级为钻石会员。";
    } elseif ($pay['pay_service'] == -1) {
        // 升级为铂金会员
        if ($user['s_cid'] == 10 && $user['endtime'] > $bgtime) {
            $bgtime = $user['bgtime'];
            $endtime = strtotime("+6 month", $user['endtime']);
        } else {
            $endtime = strtotime("+6 month");
        }
        $s_cid = 10;
        $content = "尊敬的会员您好,恭喜您已成功升级为铂金会员。";
    } elseif ($pay['pay_service'] == 1 || $pay['pay_service'] == 4) {
        //高级会员
        $endtime = strtotime("+3 month");
        if ($pay['pay_service'] == 4) {
            //一个月的高级会员
            $endtime = strtotime("+1 month");
        }
        $s_cid = 30;
        $content = "尊敬的会员您好,恭喜您已成功升级为高级会员。";
    } elseif ($pay['pay_service'] == 2) {
        //城市之星
        $endtime = strtotime("+1 month");
        $content = "尊敬的会员您好,恭喜您已成功升级为城市之星。";
    } elseif ($pay['pay_service'] == 3) {
        //续费
        if ($user['s_cid'] == 40 && $user['endtime'] < 100) {
            exit('普通会员不存在续费。请重新确认!');
        }
        $s_cid = $user['s_cid'] == 40 ? $pay['old_scid'] : $user['s_cid'];
        if ($pay['plus_time'] > 0) {
            $endtime = $user['endtime'] > $bgtime ? strtotime("+{$pay['plus_time']} month", $user['endtime']) : strtotime("+{$pay['plus_time']} month");
        } else {
            $endtime = $user['endtime'] > $bgtime ? strtotime("+3 month", $user['endtime']) : strtotime("+3 month");
        }
        $content = "尊敬的会员您好,恭喜您续费成功。";
    } elseif ($pay['pay_service'] == 5) {
        //高级升钻石
        $sql = "SELECT id,status FROM {$GLOBALS['dbTablePre']}payment_new WHERE status = 1 AND pay_type = 2 AND  pay_service=5 AND uid = '{$uid}' LIMIT 1";
        $old_pay = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql, true);
        if (empty($old_pay) && $user['s_cid'] != 30) {
            exit('操作失败!此会员没有成功支付过或者不是高级会员。');
        } elseif (!empty($old_pay) && $user['s_cid'] == 30) {
            //exit('操作失败!此会员已经支付过且为高级会员不能进行此操作。');
        }
        // 如果是已经支付过点击确定更新上一个订单的处理状态
        if (!empty($old_pay)) {
            $sql = "update {$GLOBALS['dbTablePre']}payment_new set status = 3 where id = {$old_pay['id']}";
            $GLOBALS['_MooClass']['MooMySQL']->query($sql);
            $bgtime = time();
            $endtime = strtotime("+6 month", time());
        } else {
            $bgtime = $user['bgtime'];
            $endtime = strtotime("+3 month", $user['endtime']);
        }
        /* if($GLOBALS['adminid'] != 312){ //不是447销售组长不能跳过此逻辑
                    // 如果已经是高级会员,但是升级时间已经超过一周
                    if($user['s_cid'] == 30 && $user['bgtime'] < time() - 60 * 24 * 3600){
                        exit('此高级会员已经升级超过60天,不能升级为钻石会员。');
        
                    }
                } */
        $s_cid = 20;
        $content = "尊敬的会员您好,恭喜您从高级会员升级为钻石会员成功。";
    } elseif ($pay['pay_service'] == 8) {
        //高级升铂金__halt_compiler
        if ($user['s_cid'] == 10 && $user['endtime'] > $bgtime) {
            $bgtime = $user['bgtime'];
            $endtime = strtotime("+6 month", $user['endtime']);
        } else {
            $endtime = strtotime("+6 month");
        }
        $s_cid = 10;
        $content = "尊敬的会员您好,恭喜您已成功升级为铂金会员。";
    } elseif ($pay['pay_service'] == 9) {
        //钻石升铂金
        if ($user['s_cid'] == 10 && $user['endtime'] > $bgtime) {
            $bgtime = $user['bgtime'];
            $endtime = strtotime("+6 month", $user['endtime']);
        } else {
            $endtime = strtotime("+6 month");
        }
        $s_cid = 10;
        $content = "尊敬的会员您好,恭喜您已成功升级为铂金会员。";
    } else {
        echo "操作失败!payment_new表id={$pid} 记录的 字段 pay_service = {$pay['pay_service']} 数据错误,请联系管理员";
        exit;
    }
    //修改 members 表
    if ($pay['pay_service'] == 2) {
        //城市之星,fanglin
        $sql = " update {$GLOBALS['dbTablePre']}members_search   set bgtime='{$bgtime}',endtime='{$endtime}',city_star='{$time}',updatetime={$time}  where uid={$uid}";
        $value['bgtime'] = $bgtime;
        $value['endtime'] = $endtime;
        $value['city_star'] = $time;
        $str_arr = array($uid => array($bgtime, $endtime, $time));
        $field = array('bgtime', 'endtime', 'city_star');
    } elseif ($pay['pay_service'] == 3) {
        $sql = " update {$GLOBALS['dbTablePre']}members_search set s_cid={$s_cid},endtime='{$endtime}',updatetime={$time} where uid={$uid}";
        $value['s_cid'] = $s_cid;
        $value['endtime'] = $endtime;
        $str_arr = array($uid => array($s_cid, $endtime));
        $field = array('s_cid', 'endtime');
    } else {
        //高级会员或钻石会员
        $update_sql = $update_rosenumber_sql = '';
        $update_rosenumber = array();
        if ($pay['give_city_star'] == 1) {
            $city_star_time = strtotime("+1 month");
            $update_sql = ",city_star='{$city_star_time}'";
            $value['city_star'] = $city_star_time;
        }
        if ($pay['pay_service'] == -1) {
            $update_rosenumber_sql = "`rosenumber`=299";
            //铂金会员升级后赠送299朵鲜花
            $update_rosenumber['rosenumber'] = 299;
        } elseif ($pay['pay_service'] == 0) {
            $update_rosenumber_sql = "`rosenumber`=88";
            //钻石会员升级后赠送88朵鲜花
            $update_rosenumber['rosenumber'] = 88;
        }
        $sql = " update {$GLOBALS['dbTablePre']}members_search set updatetime={$time}, s_cid={$s_cid},bgtime='{$bgtime}' ,endtime='{$endtime}' {$update_sql}  where uid={$uid}";
        $value['s_cid'] = $s_cid;
        $value['bgtime'] = $bgtime;
        $value['endtime'] = $endtime;
        if ($pay['give_city_star'] == 1) {
            $str_arr = array($uid => array($s_cid, $bgtime, $endtime, $city_star_time));
            $field = array('s_cid', 'bgtime', 'endtime', 'city_star');
        } else {
            $str_arr = array($uid => array($s_cid, $bgtime, $endtime));
            $field = array('s_cid', 'bgtime', 'endtime');
        }
    }
    searchApi('members_man members_women')->updateAttr($field, $str_arr);
    if (!$GLOBALS['_MooClass']['MooMySQL']->query($sql)) {
        echo "操作失败!无法修改用户信息.请联系管理员...";
        exit;
    }
    if (!empty($update_rosenumber_sql)) {
        $GLOBALS['_MooClass']['MooMySQL']->query('UPDATE `' . $GLOBALS['dbTablePre'] . 'members_base` SET ' . $update_rosenumber_sql . ' WHERE `uid`=' . $uid);
    }
    //短信提醒
    if (!empty($content) && !empty($user['telphone'])) {
        if (SendMsg($user['telphone'], $content)) {
            $GLOBALS['_MooClass']['MooMySQL']->query("INSERT INTO {$GLOBALS['dbTablePre']}smslog(sid,uid,content,sendtime) VALUES('{$GLOBALS['adminid']}','{$uid}','{$content}','{$GLOBALS['timestamp']}')");
        }
    }
    if (MOOPHP_ALLOW_FASTDB) {
        MooFastdbUpdate('members_search', 'uid', $uid, $value);
        if (!empty($update_rosenumber)) {
            MooFastdbUpdate('members_base', 'uid', $uid, $update_rosenumber);
        }
    }
    serverlog(3, $GLOBALS['dbTablePre'] . "members_search", "{$GLOBALS['username']}改变用户{$uid}的等级", $GLOBALS['adminid'], $uid);
    //更新诚信值
    $get_certi_sql = "select certification from {$GLOBALS['dbTablePre']}members_search where uid='{$uid}'";
    $certi_arr = $GLOBALS['_MooClass']['MooMySQL']->getOne($get_certi_sql, true);
    $num_certi = $certi_arr['certification'] + 6;
    //诚信值加6
    //修改支付信息
    $sql = "update {$GLOBALS['dbTablePre']}payment_new set check_sid='{$GLOBALS['adminid']}',check_time='{$time}',status=3 where id='{$pid}'";
    if (!$GLOBALS['_MooClass']['MooMySQL']->query($sql)) {
        echo "操作失败!无法修改订单状态.请联系管理员...";
        exit;
    }
    //note 写入成功订单表中
    $sql = "select * from {$GLOBALS['dbTablePre']}payment_new where id='{$pid}'";
    $payment_arr = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql, true);
    $payment_data = array();
    $payment_data['uid'] = $payment_arr['apply_sid'];
    //客服id
    $payment_data['orderoknum'] = 1;
    //成功订单数
    $payment_data['dateline'] = $time;
    //成功订单时间
    $payment_data['paymentid'] = $pid;
    //申请支付订单id
    inserttable('financial_orderok', $payment_data);
    serverlog(3, $GLOBALS['dbTablePre'] . "payment_new", "{$GLOBALS['username']}改变{$uid}支付状态", $GLOBALS['adminid']);
    //插入数据 web_diamond 表(钻石会员)
    if ($s_cid == 20) {
        //d. = m.nickname,d. = m.gender,d. = m.birthyear,d.=m.bgtime,d.=m.endtime
        if ($user['endtime'] > $bgtime) {
            //钻石会员续费
            $status = 1;
        } else {
            $status = 1;
        }
        $sql = "REPLACE INTO {$GLOBALS['dbTablePre']}diamond (uid ,username ,skin ,status, nickname, gender, birthyear,bgtime,endtime)\n                VALUES ( '{$uid}', '{$user['username']}', '" . ($user['gender'] == 0 ? 'cyan' : 'red') . "', '{$status}', '{$user['nickname']}','{$user['gender']}','{$user['birthyear']}','{$bgtime}','{$endtime}')";
        if (!$GLOBALS['_MooClass']['MooMySQL']->query($sql)) {
            echo "操作失败!无法添加钻石会员数据.请联系管理员...";
            exit;
        }
    }
    //对应的客服会员总数减1
    $sql = "UPDATE {$GLOBALS['dbTablePre']}admin_user SET member_count=member_count-1 WHERE uid='{$user['sid']}'";
    $GLOBALS['_MooClass']['MooMySQL']->query($sql);
    //对应的后台扩展表保留其原归属客服id
    $sql = "UPDATE {$GLOBALS['dbTablePre']}member_admininfo SET effect_grade=9,old_sid='{$user['sid']}' WHERE uid='{$uid}'";
    $GLOBALS['_MooClass']['MooMySQL']->query($sql);
    //会员sid清0,售后重新分配,更新诚信
    //$sql = "UPDATE {$GLOBALS['dbTablePre']}members SET sid=0 WHERE uid='{$uid}'";
    $sql = "UPDATE {$GLOBALS['dbTablePre']}members_search SET sid=13 ,certification=" . $num_certi . " WHERE uid='{$uid}'";
    $GLOBALS['_MooClass']['MooMySQL']->query($sql);
    searchApi('members_man members_women')->updateAttr(array('sid'), array($uid => array(13)));
    $sql = "UPDATE {$GLOBALS['dbTablePre']}admin_user SET member_count=member_count+1 WHERE uid='13'";
    $GLOBALS['_MooClass']['MooMySQL']->query($sql);
    //在线客服列表,arr
    $online_service = congratulate_success_upgrade();
    $sql = "INSERT INTO {$GLOBALS['dbTablePre']}congratulate_remark(online_sid,sid,uid,dateline) VALUES";
    $sql_value = array();
    foreach ($online_service as $service) {
        $sql_value[] = "({$service['uid']},'{$user['sid']}','{$uid}',{$time})";
    }
    if (!empty($sql_value)) {
        $GLOBALS['_MooClass']['MooMySQL']->query($sql . implode(',', $sql_value));
    }
    //  error_log($sql);
    /*  
        //售后客服组长右下角提醒
        $sql2 = "INSERT INTO {$GLOBALS['dbTablePre']}admin_remark(groupid,title,content,awoketime,dateline) VALUES";
        foreach($GLOBALS['admin_aftersales_service'] as $sale_service){
            $dateline = time();
            $awoketime = $dateline+120;
            $sql_value2 .= "('{$sale_service}','有新的vip会员分配','{$uid}升级为vip会员了,需要分配','{$awoketime}','{$dateline}'),";
        }
        $sql_value2 = substr($sql_value2,0,-1);
        $sql2 .= $sql_value2;
    
        $GLOBALS['_MooClass']['MooMySQL']->query($sql2);
    */
    //统计系统的接口begin
    $payKey = 'zaysvipchannel';
    //单独接口验证
    //$uidmd5 = md5($uid.MOOPHP_AUTHKEY);
    $uidmd5 = md5($uid . $payKey);
    $apiurl = "http://tg.zhenaiyisheng.cc/hongniang/hongniang_super_import.php?uid=" . $uid . "&md5=" . $uidmd5;
    //error_log(file_get_contents($apiurl));
    if (file_get_contents($apiurl) != "ok") {
        $dateline = time();
        $sql = "INSERT INTO {$GLOBALS['dbTablePre']}do_url VALUES('','{$apiurl}','{$dateline}',0,0)";
        $GLOBALS['_MooClass']['MooMySQL']->query($sql);
    }
    //统计系统的接口end
    serverlog(3, $GLOBALS['dbTablePre'] . 'payment_new', "{$GLOBALS['username']}确定升级", $GLOBALS['adminid'], $uid);
    //htotal
    //@file_get_contents("http://222.73.4.240/tj/index/reg?act=pay&w=1&u=".$uid);
    $sql = "INSERT INTO web_test(n,v) VALUES('pay2'," . $uid . ")";
    $GLOBALS['_MooClass']['MooMySQL']->query($sql);
    echo "ok";
    exit;
}
Esempio n. 6
0
function siooSendMsg($phone, $content)
{
    SendMsg($phone, $content);
}
Esempio n. 7
0
function service_bind()
{
    global $_MooClass, $dbTablePre, $userid, $user_arr, $user_pic, $serverid;
    $bindMsg = '';
    $time = time();
    $b_uid = MooGetGPC('buid', 'integer', 'P');
    $sendid = MooGetGPC('sendid', 'integer', 'G');
    if ($sendid == 0) {
        $sendid = MooGetGPC('sendtoid', 'integer', 'G');
    }
    $sendid = $sendid ? $sendid : $b_uid;
    if (MOOPHP_ALLOW_FASTDB) {
        $user_s = MooFastdbGet('members_search', 'uid', $sendid);
        $user_b = MooFastdbGet('members_base', 'uid', $sendid);
        $user_s = array_merge($user_s, $user_b);
    } else {
        $user_s = $_MooClass['MooMySQL']->getOne("SELECT * FROM {$dbTablePre}members_search,{$dbTablePre}members_base WHERE uid = '{$sendid}' and {$dbTablePre}members_search.uid={$dbTablePre}members_base.uid");
    }
    /*if($hzn == "hongniangwang"){
          MooMessage('对不起您不能模拟操作','javascript:history.go(-1);','04');
          exit;
      }*/
    $result = $_MooClass['MooMySQL']->getOne("select groupid from web_admin_user where uid='{$serverid}'");
    $groupid = $result['groupid'];
    //系统管理员权限
    $GLOBALS['system_admin'] = array(60);
    if (in_array($groupid, $GLOBALS['system_admin'])) {
        $serverid = null;
    }
    if ($serverid) {
        MooMessage('对不起您不能模拟操作', 'javascript:history.go(-1);', '04');
        exit;
    }
    if ($user_s['gender'] == $user_arr['gender']) {
        MooMessage("同性之间不能绑定。", 'javascript:history.go(-1);', '02');
    }
    if ($user_arr['bind_id'] > 0) {
        if ($user_arr['isbind'] != 0) {
            $bindMsg = '您已经在绑定状态了。';
        } else {
            $bindMsg = '您的绑定正在申请中。';
        }
    } else {
        $tmp_bind = $_MooClass['MooMySQL']->getOne("SELECT start_time,length_time FROM {$dbTablePre}members_bind WHERE (a_uid={$user_arr['uid']} OR b_uid={$user_arr['uid']}) AND bind=2 ORDER BY id DESC LIMIT 1", true);
        //echo $sql;
        if ($time - $tmp_bind['start_time'] + $tmp_bind['length_time'] < 86400) {
            $bindMsg = "绑定解除后的24小时内不能再次申请绑定。";
        }
    }
    if ($bindMsg == '') {
        if ($b_uid > 0 && $user_s['isbind'] == 0) {
            $apply_con = safeFilter(MooGetGPC('content1', 'string', 'P'));
            $ltime = MooGetGPC('ltime', 'integer', 'P');
            $sql = "INSERT INTO {$dbTablePre}members_bind SET a_uid={$user_arr['uid']},b_uid={$b_uid},apply_con='{$apply_con}',dateline='" . $time . "',apply_ltime=" . $ltime;
            $query = $_MooClass['MooMySQL']->query($sql);
            $bind_id = $_MooClass['MooMySQL']->insertId();
            @$_MooClass['MooMySQL']->query("UPDATE {$dbTablePre}members_base SET bind_id=" . $bind_id . " WHERE uid=" . $user_arr['uid']);
            //预先更新申请人的bind_id,
            if (MOOPHP_ALLOW_FASTDB) {
                $value = array();
                $value['bind_id'] = $bind_id;
                MooFastdbUpdate("members_base", 'uid', $user_arr['uid'], $value);
            }
            if ($user_s['is_phone']) {
                $gender = $user_arr['gender'] ? '女' : '男';
                //发送短信
                SendMsg($user_s['telphone'], "真爱一生网 用户ID:" . $user_arr['uid'] . "," . $gender . ",已给委托真爱一生绑定您,请及时把握您的缘分!4006780405");
                //Push_message_intab($sendid,$user_s['telphone'],"绑定","真爱一生网 用户ID:".$user_arr['uid'].",".$gender.",已给委托真爱一生绑定您,请及时把握您的缘分!4006780405",$user_arr['uid']);
            }
            MooMessage("申请成功!请等待真爱一生的联系与确定。", 'javascript:history.go(-2);', '05');
        } elseif ($user_s['isbind'] > 0 || $user_s['bind_id'] > 0) {
            $statue = 1;
            //得到与TA绑定的user信息
            $sql = "SELECT a_uid,b_uid,length_time FROM {$dbTablePre}members_bind WHERE id=" . $user_s['bind_id'];
            $m_bind = $_MooClass['MooMySQL']->getOne($sql);
            if ($user_s['bind_id'] > 0 && $m_bind['isbind'] == 0) {
                //MooMessage("会员{$user_s['uid']}正在申请与其他会员绑定中...",'javascript:history.go(-2);');
            }
            $f_uid = $m_bind['a_uid'] == $sendid ? $m_bind['b_uid'] : $m_bind['a_uid'];
            //echo $f_uid,'|',$m_bind['a_uid'],'|',$m_bind['b_uid'];
            if (MOOPHP_ALLOW_FASTDB) {
                $user_bind = MooFastdbGet('members_base', 'uid', $f_uid);
            } else {
                $user_bind = $_MooClass['MooMySQL']->getOne("SELECT * FROM {$dbTablePre}members_base WHERE uid = '{$f_uid}'");
            }
            require MooTemplate('public/service_contact_binding', 'module');
            exit;
        }
    }
    require MooTemplate('public/service_contact_bind', 'module');
}
Esempio n. 8
0
function other_sendmsm_most()
{
    $ispost = MooGetGPC('post', 'integer', 'G');
    if ($ispost) {
        $uid_list = MooGetGPC('uid_list', 'string', 'P');
        $content = MooGetGPC('content', 'string', 'P');
        $sql = "SELECT uid,telphone FROM {$GLOBALS['dbTablePre']}members_search where uid in ({$uid_list}) and telphone!=''";
        $tel_more_arr = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql);
        foreach ($tel_more_arr as $tel) {
            $tel_arr[] = $tel['telphone'];
            $dateline = time();
            $sql = "INSERT INTO {$GLOBALS['dbTablePre']}smslog(sid,uid,content,sendtime) VALUES('{$GLOBALS['adminid']}','{$tel['uid']}','{$content}','{$dateline}')";
            $GLOBALS['_MooClass']['MooMySQL']->query($sql);
        }
        //$tel_list=implode(',',$tel_arr);
        if ($ret = SendMsg($tel_arr, $content, 1)) {
            salert("群发送短信成功!", "index.php?action=activity");
        } else {
            salert("群发送短信失败!", "index.php?action=activity");
        }
    }
    header("Location: index.php?action=activity");
}
Esempio n. 9
0
                        case "never":
                            SendMsg("call.ringing");
                            break;
                    }
                    /* Prevent a warning if trying to ACK this message again */
                    $ev = false;
                    break;
                case "chan.notify":
                    Yate::Uninstall("chan.notify");
                    $m = new Yate("chan.attach");
                    $m->params["id"] = $ourcallid;
                    $m->params["source"] = $newsource;
                    $m->Dispatch();
                    $newsource = "";
                    if ($answermode == "late") {
                        SendMsg("call.answered");
                    }
                    break;
            }
            /* This is extremely important.
               We MUST let messages return, handled or not */
            if ($ev) {
                $ev->Acknowledge();
            }
            break;
        default:
            Yate::Debug("PHP Event: " . $ev->type);
    }
}
Yate::Debug("PHP: bye!");
/* vi: set ts=8 sw=4 sts=4 noet: */
Esempio n. 10
0
     MooAddRose($puid, 3);
 }
 //暂时测试屏蔽
 $is_phone = !empty($telphone) ? 1 : 0;
 $md5 = md5($uid . $puid . 2 . $website . $ip . $where_from . MOOPHP_AUTHKEY);
 $apiurl = "http://tg.zhenaiyisheng.cc/hongniang/hongniang_import.php?ip=" . $ip . "&uid=" . $uid . "&puid=" . $puid . "&s_cid=2&website=" . $website . "&keyurl=" . $where_from . "&md5=" . $md5 . "&gender=" . $gender . "&phone=" . $telphone . "&is_phone=" . $is_phone . "&birthyear=" . $birthyear;
 if (file_get_contents($apiurl) != "ok") {
     $dateline = time();
     $sql = "INSERT INTO {$GLOBALS['dbTablePre']}do_url VALUES('','{$apiurl}','{$dateline}',0,0)";
     $GLOBALS['_MooClass']['MooMySQL']->query($sql);
 }
 $rand = rand(1621, 9654);
 MooSetCookie("rand_", $rand, 3600);
 MooSetCookie("rand", md5(md5($rand)), 3600);
 // 希希奥信息发送手机短信接口
 $re = SendMsg($telphone, "注册成功,您的ID" . $uid . ",密码:" . $password_ . ",验证码:" . $rand, 1);
 if ($re) {
     //if( trim($re) == '100' ){
     $time = time();
     $content = "注册成功提醒";
     $sql_res[] = $_MooClass['MooMySQL']->query("INSERT INTO {$dbTablePre}smslog_sys (id,sid,uid,content,sendtime,type) values('','','{$uid}','{$content}','{$time}','注册成功提醒')");
 }
 MooSetCookie('uid', $uid, 3600);
 MooSetCookie('password', $password, 3600);
 MooSetCookie('telphone', $telphone, 3600);
 //MooSetCookie ( 'auth', MooAuthCode ( "$uid\t$password", 'ENCODE' ), 86400 * 7 );
 MooSetCookie("where_from", "");
 MooSetCookie("puid", "");
 MooSetCookie("website", "");
 MooSetCookie('password2', $password_, 3600);
 echo "<script>location.href='index.php?n=register&h=steptel'</script>";
Esempio n. 11
0
<?php

header('Content-Type:text/html;charset=utf-8');
if (!isset($_GET['p']) || $_GET['p'] != 'i7651') {
    echo 'auth failure';
    exit;
}
$api_xml = @file_get_contents("http://ws.montnets.com:9002/MWGate/wmgw.asmx/MongateQueryBalance?userId=J30087&password=070003");
if ($api_xml) {
    // 短信剩余条数
    preg_match('/\\>(\\-?\\d+)\\</', $api_xml, $count);
    $sms_left_count = intval($count[1]);
    // 短信提醒内容
    $content = "提醒:短信剩余{$sms_left_count}条。" . date('Y-m-d H:i:s');
    // 发送提醒
    SendMsg(array('18756916443', '18656509722'), $content, 'array');
}
function SendMsg($tel, $content, $type = '')
{
    $uid = 'J30087';
    $pwd = '070003';
    $content = urlencode($content);
    if ($type) {
        $iMobiCount = count($tel);
        $phone = implode(',', $tel);
    } else {
        $iMobiCount = 1;
        $phone = $tel;
    }
    $httpstr = "http://ws.montnets.com:9002/MWGate/wmgw.asmx/MongateCsSpSendSmsNew?userId={$uid}&password={$pwd}&pszMobis={$phone}&pszMsg={$content}&iMobiCount={$iMobiCount}&pszSubPort=*";
    return @file_get_contents($httpstr);
Esempio n. 12
0
function findPwd($method)
{
    global $_MooClass, $dbTablePre, $_MooCookie, $userid;
    //note 只给用户3次机会
    if ($method) {
        $_MooCookie['backpwdnum'] = $_MooCookie['backpwdnum'] ? $_MooCookie['backpwdnum'] : '';
        MooSetCookie('backpwdnum', $_MooCookie['backpwdnum'] + 1, 85400);
        if ($_MooCookie['backpwdnum'] >= 3) {
            MooMessage('您今天操作次数过多,请明天再试', 'index.php', '02');
        }
    }
    switch ($method) {
        case 1:
            $ToAddress = trim(MooGetGPC('email', 'string', 'P'));
            //查找用户表,enky修改表名
            $userMsg = $_MooClass['MooMySQL']->getOne("select uid,username,password from {$dbTablePre}members_search where username='******'", true);
            if ($userMsg) {
                //有此用户
                //是否邮箱认证
                //$ifmail = $_MooClass['MooMySQL']->$_MooClass['MooMySQL']->getOne("select telphone from {$dbTablePre}certification where uid='{$userMsg['uid']}'");
                //没认证
                //if(!$ifmail['telphone']){
                $email = $userMsg['username'];
                $password = $userMsg['password'];
                $ToAddressMd5 = md5($ToAddress . '+' . $password);
                //email和密码的md5
                $QueryString = base64_encode($ToAddress . '|' . $ToAddressMd5 . '|' . time());
                //url后的查询字符串
                //$sql = "insert into ". $dbTablePre ."reset_password set username = '******'";
                $sql = "insert into " . $dbTablePre . "reset_password set username = '******'";
                $_MooClass['MooMySQL']->query($sql);
                //记录数据库
                $ToSubject = '真爱一生网提示:修改您的密码';
                //note 发送邮件
                if ($userMsg['nickname']) {
                    $ToBody = $userMsg['nickname'] . ':您好!<br>';
                } else {
                    $ToBody = 'ID为' . $userMsg['uid'] . '会员:您好!<br>';
                }
                $ToBody .= "&nbsp;&nbsp;&nbsp;&nbsp;因您在真爱一生网使用了找回密码功能,如果您忘记密码,请点击以下链接到真爱一生网,修改您的密码。";
                $ToBody .= '<br>&nbsp;&nbsp;&nbsp;&nbsp;提示:请在24小时内登陆真爱一生网,并在登陆后将密码修改为您容易记住的密码,如果您没有操作,无需理会此邮件。';
                $ToBody .= "点击此链接修改密码:<a href='http://" . MOOPHP_HOST . "/index.php?n=myaccount&h=resetpwd&p=" . $QueryString . "'>http://" . MOOPHP_HOST . "/index.php?n=myaccount&h=resetpwd&p=" . $QueryString . "</a>";
                if (sendMailByNow($ToAddress, $ToSubject, $ToBody)) {
                    MooMessage('修改密码地址已发送至邮箱,请尽快登录邮箱操作。', 'index.php');
                } else {
                    MooMessage('数据操作失败,请重新找回密码', 'index.php?n=login&h=backpassword', '01');
                }
                //}
            } else {
                MooMessage('无此邮箱的会员', 'index.php?n=login&h=backpassword', '01');
            }
            break;
        case 2:
            //$umail = MooGetGPC('umail','string','P');
            $phone = MooGetGPC('phone', 'string', 'P');
            //判断手机号码是否符合规范
            if (!preg_match('/^((1[35][\\d]{9})|(18[4689][\\d]{8}))$/', $phone)) {
                MooMessage('您的手机号码不正确', 'index.php?n=login&h=backpassword', '01');
            } else {
                //查找用户表
                $userMsg = $_MooClass['MooMySQL']->getOne("select m.telphone,m.uid,m.nickname from {$dbTablePre}members_search as m left join {$dbTablePre}certification as c on m.uid=c.uid where m.telphone='{$phone}' and m.is_lock = 1 limit 1", true);
                if (!$userMsg) {
                    MooMessage('无使用此手机号码或绑定不正确', 'index.php?n=login&h=backpassword', '01');
                } elseif ($userMsg['telphone'] == $phone) {
                    //改为新密码
                    $newpwd = changePWD($userMsg['uid']);
                    //发手机消息
                    if ($newpwd) {
                        $content = "您的新密码是:" . $newpwd . ",请妥善保管好您的帐号和密码!";
                        //$re = siooSendMsg($phone,$content);//希希奥信息发送手机短信接口
                        if (SendMsg($phone, $content, 1)) {
                            $time = time();
                            $_MooClass['MooMySQL']->query("INSERT INTO {$dbTablePre}smslog_sys (id,sid,uid,content,sendtime,type) values('','','{$userid}','重置密码','{$time}','重置密码')");
                        }
                        MooMessage('您好!新密码已发送至您的手机,转到登陆页面', 'index.php?n=login');
                    } else {
                        MooMessage('找回密码失败', 'index.php?n=login&h=backpassword', '01');
                    }
                } else {
                    MooMessage('您的手机号码未通过验证,请用邮件方式取回密码', 'index.php?n=login&h=backpassword', '01');
                }
            }
            break;
    }
}
Esempio n. 13
0
function sendmes()
{
    global $_MooClass, $dbTablePre, $memcached;
    //$telphone = MoogetGPC ( 'tel', 'string', 'G' );
    if ($_GET['tel']) {
        $telphone = $_GET['tel'];
        $tele = $telphone % 1000000000;
    } else {
        $return = "未填写手机号码";
        echo return_data($return, false);
        exit;
    }
    $sql = "select sendtime from {$dbTablePre}smslog_sys where uid = '{$tele}' ";
    $r = $_MooClass['MooMySQL']->getOne($sql, true);
    $time = time();
    if ($r['sendtime']) {
        if ($time < $r['sendtime'] + 60) {
            $return = "1分钟内只能发送1次验证码,请稍后再试!";
            exit(return_data($return, false));
        }
    }
    $rand = rand(362144, 965421);
    if (SendMsg($telphone, "欢迎您注册真爱一生网!您本次注册的手机认证码为:" . $rand . ",本认证码1小时内有效。")) {
        $sql = "select count(*) as a from {$dbTablePre}smslog_sys where uid = '{$tele}' ";
        $r1 = $_MooClass['MooMySQL']->getOne($sql, true);
        if ($r1[a] == 0) {
            $sql = "INSERT INTO {$dbTablePre}smslog_sys (id,sid,uid,content,sendtime,type) values('','','{$tele}','{$rand}','{$time}','注册验证码')";
        } else {
            $sql = "UPDATE {$dbTablePre}smslog_sys set content='{$rand}' , sendtime = '{$time}' where uid='{$tele}' ";
        }
        //$sql = "REPLACE INTO {$dbTablePre}smslog_sys set content='$rand' where uid='$telphone' ";
        //$sql = "REPLACE INTO {$dbTablePre}smslog_sys (id,sid,uid,content,sendtime,type) values('','','$tele','$rand','$time','注册验证码')";
        $_MooClass['MooMySQL']->query($sql);
        $sql = "select content,sendtime from {$dbTablePre}smslog_sys where uid = '{$tele}' ";
        $r2 = $_MooClass['MooMySQL']->getOne($sql, true);
        $return = "验证码已发送";
        //echo $r2['content'].' '.$r2['sendtime'];
        echo return_data($return, true);
        exit;
    } else {
        $return = "发送短信验证码失败";
        echo return_data($return, false);
        exit;
    }
}
Esempio n. 14
0
 public function __construct()
 {
     //------------------------------------------
     $newFile = isset($_REQUEST["newfile"]) ? $_REQUEST["newfile"] : '';
     //------------------------------------------
     static $tmpUploadDir = NULL;
     if ($tmpUploadDir === NULL) {
         $tmpUploadDir = $this->get_temp_dir();
     }
     // Create tmpUploadDir
     if (!file_exists($tmpUploadDir)) {
         if (@mkdir($tmpUploadDir, 0755)) {
             @chmod($tmpUploadDir, 0755);
         }
     }
     //------------------------------------------
     //检查暂时目录是否有权限
     if (@is_writable($tmpUploadDir) === false) {
         SendMsg('101.暂时目录没有写权限!' . $tmpUploadDir);
         exit;
     }
     //------------------------------------------
     //检查目录写权限
     $saveDirAll = ROOT_PATH . $this->saveDir;
     // Create saveDir
     if (!file_exists($saveDirAll)) {
         if (@mkdir($saveDirAll, 0755)) {
             @chmod($saveDirAll, 0755);
         }
     }
     if (@is_writable($saveDirAll) === false) {
         SendMsg('102.上传目录没有写权限!') . $saveDirAll;
         exit;
     }
     //------------------------------------------
     //是否有上传文件
     if (!(isset($_FILES[$this->filePostName]) && !is_null($_FILES[$this->filePostName]['tmp_name']) && $_FILES[$this->filePostName]['name'] != '')) {
         SendMsg('103.缺少上传文件');
         exit;
     }
     if ($_FILES["file"]["error"] || !is_uploaded_file($_FILES["file"]["tmp_name"])) {
         SendMsg('104.未能将上传的文件移动。');
         exit;
     }
     //------------------------------------------
     //文件大小
     $fileSize = $_FILES[$this->filePostName]['size'];
     if ($fileSize < 10) {
         SendMsg('103.缺少上传文件.');
         exit;
     }
     if ($fileSize > $this->maxSize * 1024) {
         SendMsg('105.上传文件大小超过了限制.最多上传(' . $this->maxSize . 'KB).');
         exit;
     }
     //$fileSize = round($fileSize/1024,0);
     //------------------------------------------
     //服务器上临时文件名
     //原始文件名称
     if (isset($_REQUEST["name"])) {
         $srcName = $_REQUEST["name"];
     } elseif (!empty($_FILES)) {
         $srcName = $_FILES["file"]["name"];
     } else {
         $srcName = uniqid("file_");
     }
     $fileExt = strtolower(substr($srcName, strrpos($srcName, '.') + 1));
     if (!in_array($fileExt, $this->allowedExt)) {
         SendMsg('106.不支持该文件格式.,只支持以下格式:(' . join(',', $this->allowedExt) . ').');
         exit;
     }
     //新的文件名
     if ($newFile == '') {
         $newFile = date('ymdHis', time()) . sprintf('%03d', mt_rand(0, 999)) . '.' . $fileExt;
     }
     $newPath = $this->saveDir . $newFile;
     $newPathAll = $saveDirAll . $newFile;
     $filePath = $tmpUploadDir . DIRECTORY_SEPARATOR . $newFile;
     //------------------------------------------
     // Remove old temp files
     if ($this->cleanupTargetDir) {
         if (!is_dir($tmpUploadDir) || !($dir = opendir($tmpUploadDir))) {
             SendMsg('101.暂时目录没有写权限!');
             exit;
         }
         while (($file = readdir($dir)) !== false) {
             $tmpPath = $tmpUploadDir . DIRECTORY_SEPARATOR . $file;
             // If temp file is current file proceed to the next
             //如果是当前上传的将跳过,不删除
             if ($tmpPath == "{$filePath}.part") {
                 continue;
             }
             /*
             // Remove temp file if it is older than the max age and is not the current file
             if (preg_match('/\.part$/', $file) && (filemtime($tmpPath) < time() - $this->maxFileAge)) {
             	@unlink($tmpPath);
             }
             */
             //从暂时文件夹中删除超过2天的上传文件
             if (filemtime($tmpPath) < time() - $this->maxFileAge) {
                 @unlink($tmpPath);
             }
         }
         closedir($dir);
     }
     //------------------------------------------
     // Chunking might be enabled
     $chunk = isset($_REQUEST["chunk"]) ? intval($_REQUEST["chunk"]) : 0;
     $chunks = isset($_REQUEST["chunks"]) ? intval($_REQUEST["chunks"]) : 0;
     // Open temp file
     if (!($out = @fopen("{$filePath}.part", $chunks ? "ab" : "wb"))) {
         SendMsg('107.未能打开输出流.' . "{$filePath}.part");
         exit;
     }
     // Read binary input stream and append it to temp file
     if (!($in = @fopen($_FILES["file"]["tmp_name"], "rb"))) {
         SendMsg('108.未能打开输入的流。');
         exit;
     }
     while ($buff = fread($in, 4096)) {
         fwrite($out, $buff);
     }
     @fclose($out);
     @fclose($in);
     // Check if file has been uploaded
     if (!$chunks || $chunk == $chunks - 1) {
         // Strip the temp .part suffix off
         rename("{$filePath}.part", $filePath);
         /*
         * 保存后再移动,这里不移动
         if (move_uploaded_file($filePath, $newPathAll)){
         	
         } else if (copy($filePath, $newPathAll)) {
         	@unlink($filePath);
         }else{
         	SendMsg('109.上传后,移动出错!');
         	exit();
         }
         */
     }
     //上传成功,返回新路径和原始名称
     SendMsg('', $newFile, $newPath, $srcName);
 }
Esempio n. 15
0
File: rose.php Progetto: noikiy/zays
function send_rose()
{
    global $_MooClass, $dbTablePre, $timestamp, $user_arr, $serverid;
    $sendtoid = MooGetGPC('sendtoid', 'integer');
    $userid = $user_arr['uid'];
    //note 分配客服
    //allotserver($userid);
    //note 获得照片总数
    $query = $_MooClass['MooMySQL']->query("SELECT imgid FROM {$dbTablePre}pic WHERE uid = '{$sendtoid}'");
    $pic_total = $_MooClass['MooMySQL']->numRows($query);
    //note 自己不能给自己发送玫瑰,直接转到玫瑰列表页面
    if ($userid == $sendtoid) {
        MooMessage('自己不可以给自己送鲜花', "index.php?n=service&h=rose&t=getmorerose");
        exit;
    }
    //客服不能模拟操作
    $result = $_MooClass['MooMySQL']->getOne("select groupid from web_admin_user where uid='{$serverid}'");
    $groupid = $result['groupid'];
    //系统管理员权限
    $GLOBALS['system_admin'] = array(60);
    if (in_array($groupid, $GLOBALS['system_admin'])) {
        $serverid = null;
    }
    if ($serverid) {
        MooMessage('对不起您不能模拟操作', 'javascript:history.go(-1);', '04');
        exit;
    }
    //note 双方屏蔽不给操作
    if (MooGetScreen($userid, $sendtoid)) {
        MooMessage('因特殊原因,送鲜花失败', "index.php?n=service&h=rose&t=getmorerose");
        exit;
    }
    //note 要做性别过滤,异性的发送玫瑰,直接转到玫瑰列表页面
    $send_user1 = leer_send_user1($sendtoid);
    $user = leer_send_user1($userid);
    if ($send_user1['gender'] == $user['gender']) {
        MooMessage('不可给同性发送鲜花', 'javascript:history.go(-1);');
        exit;
    }
    //note 如果自己没有玫瑰花了,就提示没有玫瑰花了
    if ($user['rosenumber'] <= 0) {
        MooMessage('您没有鲜花了,获取更多鲜花', "index.php?n=service&h=rose&t=getmorerose");
        exit;
    }
    //发送短信和邮件
    include_once "./module/crontab/crontab_config.php";
    if (MOOPHP_ALLOW_FASTDB) {
        $res = MooFastdbGet('members_search', 'uid', $sendtoid);
        $res_b = MooFastdbGet('members_base', 'uid', $sendtoid);
        $res = array_merge($res, $res_b);
    } else {
        $res = $_MooClass['MooMySQL']->getOne("select s.telphone,b.is_phone,s.username from {$dbTablePre}members_search s left join {$dbTablePre}members_base b on s.uid=b.uid  where s.uid='{$sendtoid}'");
    }
    $send_user_info = $_MooClass['MooMySQL']->getAll("select b.*,c.*,a.* from `{$dbTablePre}members_search` a left join {$dbTablePre}members_base c on a.uid=c.uid  left join  {$dbTablePre}members_choice b  on a.uid=b.uid  where a.uid = '{$userid}'");
    $send_user_info = $send_user_info[0];
    //头像路径
    $path = thumbImgPath(2, $send_user_info[pic_date], $send_user_info[pic_name], $send_user_info['gender']);
    if (file_exists($path)) {
        $img_path = $path;
    } else {
        if ($send_user_info['gender'] == 1) {
            $img_path = "/public/images/service_nopic_woman.gif";
        } else {
            $img_path = "/public/images/service_nopic_man.gif";
        }
    }
    $send_username = $send_user_info['nickname'] ? $send_user_info['nickname'] : $send_user_info['uid'];
    //发送者用户名
    $send_user_grade = $send_user_info['gender'] == 1 ? "女" : "男";
    //发送者性别
    $province = $provice_list[$send_user_info['province']];
    //省
    $city = $city_list[$send_user_info['city']];
    //市
    $height = $send_user_info['height'] ? $height_list[$send_user_info['height']] : "未知";
    //身高
    ob_start();
    require_once MooTemplate('public/mail_space_rosetpl', 'module');
    //模板
    $body = ob_get_clean();
    MooSendMail($res['username'], "真爱一生网系统温馨提示", $body, "", false, $sendtoid);
    if (empty($GLOBALS['MooUid'])) {
        list($uid, $password) = explode("\t", MooAuthCode($_MooCookie['auth'], 'DECODE'));
        $uid = intval($uid);
    } else {
        $uid = $GLOBALS['MooUid'];
    }
    if (empty($uid)) {
        MooMessage('您还没有登录', 'index.php?n=login');
    }
    $leer = $_MooClass['MooMySQL']->getOne("SELECT * FROM {$dbTablePre}service_rose WHERE receiveuid = '{$sendtoid}' AND senduid = '{$userid}' ORDER BY rid DESC LIMIT 1");
    if ($user['rosenumber'] > 0) {
        if ($leer['rid']) {
            $rid = $leer['rid'];
            //note 如果已经发送过玫瑰,就增加发送玫瑰的次数
            $_MooClass['MooMySQL']->query("UPDATE {$dbTablePre}service_rose SET num = num + 1, receivenum = receivenum + 1,sendtime = '{$timestamp}',receivetime='{$timestamp}',receive_del=0,send_del=0 WHERE rid = '{$rid}'");
        } else {
            //note 发送新的玫瑰,写入数据库 发送者,接受者,发送时间
            $_MooClass['MooMySQL']->query("INSERT INTO {$dbTablePre}service_rose SET num = 1, receivenum = 1, sendtime = '{$timestamp}',receivetime='{$timestamp}',senduid  = '{$uid}',receiveuid = '{$sendtoid}' ");
        }
        //note 发送一朵玫瑰,自己就要减少一朵玫瑰
        //enkytest
        //enkytestend
        $_MooClass['MooMySQL']->query("UPDATE {$dbTablePre}members_base SET rosenumber = rosenumber - 1 WHERE uid = '{$uid}'");
        if (MOOPHP_ALLOW_FASTDB) {
            $user_rosenum = $GLOBALS['_MooClass']['MooMySQL']->getOne("SELECT rosenumber FROM {$GLOBALS['dbTablePre']}members_base  WHERE `uid`='{$uid}'  LIMIT 1");
            $value['rosenumber'] = $user_rosenum['rosenumber'];
            MooFastdbUpdate('members_base', 'uid', $userid, $value);
        }
    }
    //将新注册的会员更新为优质会员
    if (in_array($user_arr['sid'], array(0, 52, 123)) && $user_arr['is_well_user'] != 1) {
        update_iswell_user($user_arr['uid']);
    }
    //每天向同一用户发送多次,短信记录数表只记一次
    $send_rose_date = isset($leer['sendtime']) ? date("Y-m-d", $leer['sendtime']) : date("Y-m-d");
    //
    $today_rose_count = isset($leer['rid']) ? $leer['num'] + 1 : 1;
    if (date("Y-m-d") > $send_rose_date) {
        $today_rose_count = 1;
    }
    if ($res['is_phone']) {
        SendMsg($res['telphone'], "真爱一生网 用户ID:" . $userid . "," . $send_user_grade . ",已给您发送鲜花,请及时把握您的缘分!4006780405");
    }
    //提醒所属客服
    $sid = $user_arr['sid'];
    $title = '您的会员 ' . $user_arr['uid'] . ' 向 ' . $sendtoid . ' 发送了鲜花';
    $awoketime = $timestamp + 3600;
    $sql_remark = "insert into {$dbTablePre}admin_remark set sid='{$sid}',title='{$title}',content='{$title}',awoketime='{$awoketime}',dateline='{$timestamp}'";
    $res = $_MooClass['MooMySQL']->query($sql_remark);
    MooMessage('发送鲜花成功' . $note, "index.php?n=service&h=rose&t=isendrose", "05");
    require MooTemplate('public/service_rose_sendrose', 'module');
}
Esempio n. 16
0
function sendmsg_crontab()
{
    global $_MooClass, $dbTablePre;
    $lim_count = 300;
    $smslog_array = array();
    $time = time();
    $two_month_befor = $time - 3600 * 24 * 60;
    //两个月未登录的会员不发短信
    $sql = "SELECT * FROM web_sendmsg_tmp ORDER BY id ASC limit {$lim_count} ";
    $msg = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql);
    foreach ($msg as $key => $v) {
        if (empty($v['sid'])) {
            /*修正可能会员ID=0 发送的信息*/
            $sql = "DELETE  FROM web_sendmsg_tmp where id = '" . $v['id'] . "'";
            $GLOBALS['_MooClass']['MooMySQL']->query($sql);
            continue;
        }
        if ($v['dateline'] > $time) {
            continue;
        }
        if ($v['telphone']) {
            $sql = "SELECT uid from {$dbTablePre}members_login WHERE lastvisit>'{$two_month_befor}' and uid='" . $v['uid'] . "'";
            //$sql1="SELECT uid from {$dbTablePre}member_admininfo WHERE real_lastvisit>'$two_month_befor' and uid='".$v['uid']."'";
            $exp_id = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql);
            if ($exp_id['uid']) {
                if (SendMsg($v['telphone'], $v['message'])) {
                    echo "发送成功会员:";
                    echo $v['uid'];
                    $sql = "DELETE  FROM web_sendmsg_tmp where id = '" . $v['id'] . "'";
                    $GLOBALS['_MooClass']['MooMySQL']->query($sql);
                    //$need_del[]="'$v[uid]'";
                    //发送成功删除数据
                    $smslog_array[$key]['sid'] = $v['sid'];
                    $smslog_array[$key]['uid'] = $v['uid'];
                    $smslog_array[$key]['content'] = $v['message'];
                    $smslog_array[$key]['sendtime'] = time();
                    $smslog_array[$key]['type'] = $v['type'];
                } else {
                    if ($v['count'] > 2) {
                        //$need_del[]="'$v[uid]'";
                        $sql = "DELETE  FROM web_sendmsg_tmp where id = '" . $v['id'] . "'";
                        $GLOBALS['_MooClass']['MooMySQL']->query($sql);
                        echo "该会员:" . $v['uid'];
                        echo "发送失败2次,数据已经删除" . $v['count'];
                    } else {
                        $count = $v['count'] + 1;
                        return update_msg_count($v['id'], $count);
                        echo "删除失败!" . $count;
                    }
                }
            } else {
                //$need_del[]="'$v[uid]'";
                $sql = "DELETE  FROM web_sendmsg_tmp where id = '" . $v['id'] . "'";
                $GLOBALS['_MooClass']['MooMySQL']->query($sql);
                echo "长时间未登录会员";
                echo $v['uid'];
                echo "删除";
            }
        } else {
            //$need_del[]="'$v[uid]'";
            $sql = "DELETE  FROM web_sendmsg_tmp where id = '" . $v['id'] . "'";
            $GLOBALS['_MooClass']['MooMySQL']->query($sql);
            echo "没有电话号码的会员";
            echo $v['uid'];
            echo "删除";
        }
    }
    write_log($smslog_array);
}
Esempio n. 17
0
function other_sendmsm()
{
    $dateline = time();
    $ispost = MooGetGPC('post', 'integer', 'G');
    $tel_arr = array();
    if ($ispost) {
        $tel_list = MooGetGPC('tel_list', 'string', 'P');
        $content = MooGetGPC('content', 'string', 'P');
        $content .= '【真爱一生网】';
        $tel_arr = explode(',', $tel_list);
        if ($ret = SendMsg($tel_arr, $content, 1)) {
            foreach ($tel_arr as $tel) {
                $sql = "INSERT INTO {$GLOBALS['dbTablePre']}resource_sendmsg(tel,content,dateline) VALUES('{$tel}','{$content}','{$dateline}')";
                $GLOBALS['_MooClass']['MooMySQL']->query($sql);
            }
            salert("群发送短信成功!", "index.php?action=other&h=sendmsm");
        } else {
            salert("群发送短信失败!", "index.php?action=other&h=sendmsm");
        }
    }
    require_once adminTemplate('other_sendmsm');
}
Esempio n. 18
0
function allmember_sellafter()
{
    global $reprating;
    $ispost = MooGetGPC('ispost', 'integer', 'P');
    if ($ispost) {
        $adminid = $GLOBALS['adminid'];
        $manager = $GLOBALS['username'];
        $effect = MooGetGPC('effect', 'integer', 'P');
        $isdanger = MooGetGPC('isdanger', 'integer', 'P');
        $awoketime = strtotime(MooGetGPC('time', 'string', 'P'));
        $comment = MooGetGPC('sellcomment', 'string', 'P');
        $uid = MooGetGPC('uid', 'integer', 'P');
        $fromid = MooGetGPC('chathavenum', 'integer', 'P');
        $renewals_status = MooGetGPC('renewals_status', 'integer', 'P');
        $member_progress = MooGetGPC('member_progress', 'integer', 'P');
        $phonecall = MooGetGPC('phonecall', 'integer', 'P');
        //note 手机号码
        $telphone = MooGetGPC('telphone', 'string', 'P');
        //采集会员使用手册
        $usertype = MooGetGPC('usertype', 'string', 'P');
        //if($usertype == 3){
        //			$sql = "select mid from {$GLOBALS['dbTablePre']}member_admininfo where uid={$uid}";
        //			$user_member = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql);
        //			if($user_member){
        //				if(!empty($user_member['mid']) && $user_member['mid'] != $adminid){
        //					salert('此会员其他客服正在使用!','index.php?action=allmember&h=view_info&uid='.$uid);
        //				}elseif($user_member['mid'] == 999999999){
        //					salert('此会员以被封锁!','index.php?action=allmember&h=view_info&uid='.$uid);
        //				}elseif(empty($user_member['mid'])){
        //					$sql = "update {$GLOBALS['dbTablePre']}member_admininfo set mid={$adminid} where uid={$uid}";
        //					$GLOBALS['_MooClass']['MooMySQL']->query($sql);
        //				}
        //			}//else{
        ////				$sql = "insert into {$GLOBALS['dbTablePre']}member_admininfo set uid='{$uid}',mid='{$adminid}',effect_grade=1";
        ////				$GLOBALS['_MooClass']['MooMySQL']->query($sql);
        ////			}
        //		}
        if ($fromid != 0) {
            $sql = "SELECT max(s_time) s_time FROM {$GLOBALS['dbTablePre']}service_chat WHERE s_uid='{$uid}' AND s_fromid='{$fromid}'";
            $res = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql, true);
            $s_time = $res['s_time'];
            $time = time();
            $comtime = strtotime('-2 hours', $time);
            if ($s_time == '' || $s_time < $comtime) {
                //添加操作日志
                serverlog(4, $GLOBALS['dbTablePre'] . "members_backinfo", "{$GLOBALS['username']}保存{$uid}的售后信息", $GLOBALS['adminid'], $uid);
                salert("你没有聊天,售后信息保存失败!", "index.php?action=allmember&h=view_info&uid={$uid}");
                exit;
            } else {
                //聊天的数量
                $sql_chat = "SELECT chat FROM {$GLOBALS['dbTablePre']}member_admininfo WHERE uid='{$uid}'";
                $res_chat = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql_chat, true);
                //note 聊天
                $chat = intval($res_chat['chat']) + 1;
            }
        } else {
            //聊天的数量
            $sql_chat = "SELECT chat FROM {$GLOBALS['dbTablePre']}member_admininfo WHERE uid='{$uid}'";
            $res_chat = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql_chat, true);
            //note 聊天
            $chat = intval($res_chat['chat']);
        }
        //后台统计
        //推荐的数量
        $sql_recommend = "SELECT count(*) count FROM {$GLOBALS['dbTablePre']}member_sellinfo WHERE uid='{$uid}' AND effect_grade='1'";
        $res_recommend = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql_recommend, true);
        //邮件的数量
        $sql_email = "SELECT count(*) as count FROM {$GLOBALS['dbTablePre']}services s WHERE s.s_uid='{$uid}' AND s.s_cid in(1,2) AND s.is_server='1'";
        $res_email = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql_email, true);
        //委托的数量
        $sql_commiss = "SELECT count(*) as count FROM {$GLOBALS['dbTablePre']}service_contact s WHERE s.you_contact_other = '{$uid}'";
        $res_commiss = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql_commiss, true);
        //鲜花的数量
        $sql_rose = "SELECT SUM(fakenum) sum FROM {$GLOBALS['dbTablePre']}service_rose WHERE receiveuid = '{$uid}'";
        $res_rose = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql_rose, true);
        //秋波的数量
        $sql_leer = "SELECT SUM(fakenum) sum FROM {$GLOBALS['dbTablePre']}service_leer WHERE receiveuid = '{$uid}'";
        $res_leer = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql_leer, true);
        //note 邮件
        $email = intval($res_email['count']);
        //note 委托
        $commiss = intval($res_commiss['count']);
        //note 鲜花
        $rose = intval($res_rose['sum']);
        //note 秋波
        $leer = intval($res_leer['sum']);
        //note 推荐
        $recommend = $effect == '1' ? intval($res_recommend['count']) + 1 : intval($res_recommend['count']);
        //		echo '推荐:'.$recommend.'聊天:'.$chat.'邮件:'.$email.'委托:'.$commiss.'鲜花:'.$rose.'秋波:'.$leer;die;
        //note 查找所属客服id
        $sql_id = "SELECT sid,bgtime FROM {$GLOBALS['dbTablePre']}members_search WHERE uid='{$uid}'";
        $res_id = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql_id, true);
        $sid = '';
        if (!empty($res_id)) {
            $sid = $res_id['sid'];
        } else {
            $groupid = $GLOBALS['admin_aftersales_service'][0];
            $sql_sid = "SELECT uid FROM {$GLOBALS['dbTablePre']}admin_user WHERE groupid='{$groupid}'";
            $res_sid = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql_sid, 0, 0, 0, true);
            $sid = $res_sid[0]['uid'];
        }
        $dateline = time();
        $sql = "INSERT INTO {$GLOBALS['dbTablePre']}member_sellinfo SET mid='{$adminid}',manager='{$manager}',sid='{$sid}',uid='{$uid}',effect_grade='{$effect}',next_contact_time='{$awoketime}',comment='{$comment}',dateline='{$dateline}',phonecall='{$phonecall}'";
        //	echo $sql;die;
        $res = $GLOBALS['_MooClass']['MooMySQL']->query($sql);
        //note 更新危险等级
        $sql_danger = "UPDATE {$GLOBALS['dbTablePre']}member_admininfo SET dateline='{$dateline}',renewalstatus='{$renewals_status}',memberprogress='{$member_progress}',danger_leval='{$isdanger}',recommend='{$recommend}',chat='{$chat}',email='{$email}',rose='{$rose}',mandate='{$commiss}',leer='{$leer}' WHERE uid='{$uid}'";
        $res_danger = $GLOBALS['_MooClass']['MooMySQL']->query($sql_danger);
        //note 插入时间段
        $timenow = time();
        $period = $timenow - $res_id['bgtime'];
        //note 更新admininfo表的finished
        $pre_finish = "UPDATE {$GLOBALS['dbTablePre']}member_admininfo SET finished=";
        $where_finish = " WHERE uid='{$uid}'";
        //note 查找admininfo表的finished完成的状态
        $res_finished = $GLOBALS['_MooClass']['MooMySQL']->getOne("SELECT finished FROM {$GLOBALS['dbTablePre']}member_admininfo" . $where_finish, true);
        $res_admininfo = $res_finished['finished'];
        //note 此会员的升级后三大步骤 完成的
        //note 模拟
        $simulated_count_all = $chat + $email;
        //note 关注
        $oncern_count_all = $commiss + $rose + $leer;
        //			echo $count_recommend,$simulated_count_all,$oncern_count_all;
        if ($res_admininfo == '0') {
            if ($recommend >= 1 && $simulated_count_all >= 2 && $oncern_count_all >= 3) {
                $sql_finish = $pre_finish . "'1',period='{$period}'" . $where_finish;
                $res_finish = $GLOBALS['_MooClass']['MooMySQL']->query($sql_finish);
            }
        }
        //查找管理员所属组
        $sql_adminid = "SELECT sid FROM {$GLOBALS['dbTablePre']}members_search WHERE uid={$uid}";
        $res_adminid = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql_adminid, true);
        $adminid = $res_adminid['sid'];
        $sql_admin = "SELECT groupid FROM {$GLOBALS['dbTablePre']}admin_user WHERE uid='{$adminid}'";
        $res_admin = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql_admin, true);
        $groupid = $res_admin['groupid'];
        if ($awoketime > $dateline) {
            //note 记录下次联系时间
            $title = '与' . $uid . '的下次联系时间是' . date("Y-m-d H:i:s", $awoketime);
            $sql_atime = "INSERT INTO {$GLOBALS['dbTablePre']}admin_remark SET sid='{$adminid}',groupid='{$groupid}',title='{$title}',content='{$title}',awoketime='{$awoketime}',send_id='{$adminid}'";
            //			echo $sql_atime;die;
            $res_atime = $GLOBALS['_MooClass']['MooMySQL']->query($sql_atime);
        }
        //		$phonecall = 1;
        //发送短信评价
        if ($phonecall == '1') {
            if ($telphone != '0') {
                $arrtxt = implode(" ", $reprating);
                $mes = "回复数字对专属红娘进行评价:" . $arrtxt . " 。谢谢!回复免费。";
                $ret = SendMsg($telphone, $mes);
                if ($ret !== false) {
                    $sql = "INSERT INTO {$GLOBALS['dbTablePre']}smslog(sid,uid,content,sendtime) VALUES('{$GLOBALS['adminid']}','{$uid}','{$mes}','{$dateline}')";
                    $sid = $GLOBALS['_MooClass']['MooMySQL']->query($sql);
                } else {
                    $sql = "INSERT INTO {$GLOBALS['dbTablePre']}smslog(sid,uid,content,sendtime) VALUES('{$GLOBALS['adminid']}','{$uid}','短信发送失败','{$dateline}')";
                    $sid = $GLOBALS['_MooClass']['MooMySQL']->query($sql);
                }
            }
        }
        //添加操作日志
        serverlog(4, $GLOBALS['dbTablePre'] . "members_backinfo", "{$GLOBALS['username']}保存{$uid}的售后信息", $GLOBALS['adminid'], $uid);
        salert("售后信息保存成功!", "index.php?action=allmember&h=view_info&uid={$uid}");
    }
}
Esempio n. 19
0
function ajax_contact()
{
    $uid = MooGetGPC('uid', 'integer', 'G');
    $tel = MooGetGPC('tel', 'string', 'G');
    $tel2 = MooGetGPC('tel2', 'string', 'G');
    $type = MooGetGPC('type', 'integer', 'G');
    $from = MooGetGPC('from', 'string');
    $to = MooGetGPC('to', 'string');
    $ispost = MooGetGPC('ispost', 'integer', 'P');
    //拨打电话
    if ($type == 1) {
    }
    //note 发短信
    if ($type == 2) {
        $page = max(1, MooGetGPC('page', 'integer', 'G'));
        $limit = 10;
        $offset = ($page - 1) * $limit;
        $gopage = MooGetGPC('gopage', 'integer', 'G');
        if ($ispost) {
            $mes = MooGetGPC('tel_message', 'string', 'P');
            $dateline = time();
            $dateline2 = $dateline + 300;
            //$sql1="SELECT * FROM {$GLOBALS['dbTablePre']}smslog where uid='$uid' and content='$mes' and sendtime<'$dateline2'";
            //error_log($sql1);
            // $msg_inf = $GLOBALS['_MooClass']['MooMySQL']->query($sql1);
            // $msg_num = $GLOBALS['_MooClass']['MooMySQL']->numRows($msg_inf);
            //$msg_inf = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql1);
            //$msg_num = sizeof($msg_inf);
            $mes_ = $mes;
            //error_log($msg_num);
            //if($msg_num<1){
            $ret = SendMsg($tel, $mes_);
            if ($ret !== false) {
                $sql = "INSERT INTO {$GLOBALS['dbTablePre']}smslog(sid,uid,content,sendtime) VALUES('{$GLOBALS['adminid']}','{$uid}','{$mes}','{$dateline}')";
                $sid = $GLOBALS['_MooClass']['MooMySQL']->query($sql);
                echo 1;
            } else {
                echo 0;
            }
            //写日志
            serverlog(3, $GLOBALS['dbTablePre'] . 'smslog', "{$GLOBALS['adminid']}号客服{$GLOBALS['username']}向会员{$uid}发送短信{$sid}", $GLOBALS['adminid'], $uid);
            exit;
            //}else echo "你已经发过两条同样的短信了!";
        }
        $sql = "SELECT * FROM {$GLOBALS['dbTablePre']}smspre WHERE target = {$GLOBALS['adminid']} OR target = 0 LIMIT {$offset},{$limit}";
        $sms = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql, 0, 0, 0, true);
        $total = getcount('smspre', "WHERE target = {$GLOBALS['adminid']} OR target = 0");
        $pages = ceil($total / $limit);
        if ($gopage) {
            foreach ($sms as $k => $v) {
                $content = str_replace('[adminid]', $GLOBALS['adminid'], $v['content']);
                preg_match("/\\[smstitle\\](.+?)\\[\\/smstitle\\]/isU", $content, $matche1);
                preg_match("/\\[\\/smstitle\\](.+?)/isU", $content, $matche2);
                if ($matche1[1]) {
                    echo '<div style="padding:3px; cursor:pointer;" onclick="selectThis(' . (($page - 1) * $limit + $k + 1) . ');">' . (($page - 1) * $limit + $k + 1) . '.<font color="#0033CC">' . $matche1[1] . '</font><span id="sms_content_' . (($page - 1) * $limit + $k + 1) . '">' . $matche2[1] . '</span></div>';
                } else {
                    echo '<div style="padding:3px; cursor:pointer;" onclick="selectThis(' . (($page - 1) * $limit + $k + 1) . ');">' . (($page - 1) * $limit + $k + 1) . '.<span id="sms_content_' . (($page - 1) * $limit + $k + 1) . '">' . $content . '</span></div>';
                }
            }
            exit;
        }
    }
    //note 发站内信
    if ($type == 3 && $ispost) {
        $from = MooGetGPC('from', 'string', 'P');
        $uid = $to ? $to : $uid;
        $title = MooGetGPC('title', 'string', 'P');
        $content = MooGetGPC('content', 'string', 'P');
        $filename = trim(MooGetGPC('filename', 'string', 'P'));
        $newfilename = trim(MooGetGPC('newfilename', 'string', 'P'));
        $filesize = trim(MooGetGPC('filesize', 'string', 'P'));
        $sendmsg = MooGetGPC('sendmsg', 'integer', 'P');
        //是否短信提醒
        $time = time();
        if ($from) {
            $sql = "SELECT s_cid FROM {$GLOBALS['dbTablePre']}members_search WHERE uid = '{$from}'";
            $ret = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql, true);
            if (empty($ret['s_cid'])) {
                $mlevel = 2;
            } else {
                $mlevel = $ret['s_cid'];
            }
        } else {
            $from = $GLOBALS['adminid'];
            $mlevel = 3;
        }
        //note 如果上传附件,做相应处理
        $file_sql1 = '';
        $file_sql2 = '';
        if ($filename && $newfilename && $filesize) {
            $file_sql1 = ",filename,newfilename,filesize";
            $file_sql2 = ",'{$filename}','{$newfilename}','{$filesize}'";
        }
        $sql = "INSERT INTO {$GLOBALS['dbTablePre']}services(s_cid,s_uid,s_fromid,s_title,s_content,s_time,is_server,sid,flag {$file_sql1})\n                VALUES({$mlevel},{$uid},'{$from}','{$title}','{$content}','{$time}','1','1','1' {$file_sql2})";
        $ret = $GLOBALS['_MooClass']['MooMySQL']->query($sql);
        $sql = "SELECT username,telphone,sid FROM {$GLOBALS['dbTablePre']}members_search WHERE uid='{$uid}'";
        $user = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql, true);
        //发站内信,勾选则短信提醒
        if ($sendmsg == 1) {
            if (!empty($user['telphone'])) {
                $mes = '真爱一生网 有人已给您发送电子邮件,请及时到真爱一生网www.zhenaiyisheng.cc查看!4008787920(免长途)';
                //fangin暂时屏蔽
                Push_message_intab($uid, $tel['telphone'], "邮件", $mes, "system");
                //$sendmsg_ret = siooSendMsg($tel['telphone'], $mes);
                /*$dateline = time();
                  if( $sendmsg_ret ){
                      $sql = "INSERT INTO {$GLOBALS['dbTablePre']}smslog(sid,uid,content,sendtime) VALUES('{$GLOBALS['adminid']}','{$uid}','{$mes}','{$dateline}')";
                      $GLOBALS['_MooClass']['MooMySQL']->query($sql);
                  }*/
            }
        }
        //发e-mail提醒(站内信)-------开始////////////////////////////////////////////?????????
        include_once "./include/crontab_config.php";
        //$members_search = MooMembersData($from);
        //$members_choice = MooGetData('members_choice', 'uid', $from);
        $send_user_info = array_merge((array) MooGetData('members_choice', 'uid', $from), (array) MooMembersData($from));
        /*$send_user_info = $GLOBALS['_MooClass']['MooMySQL']->getAll("select * from `{$GLOBALS['dbTablePre']}members_search` a  left join  {$GLOBALS['dbTablePre']}members_choice b  on a.uid=b.uid  where a.uid = '$from'");
          $send_user_info = $send_user_info[0];*/
        //头像路径
        $path = thumbImgPath(2, $send_user_info['pic_date'], $send_user_info['pic_name'], $send_user_info['gender']);
        if (file_exists($path)) {
            $img_path = $path;
        } else {
            if ($send_user_info['gender'] == 1) {
                $img_path = "/public/images/service_nopic_woman.gif";
            } else {
                $img_path = "/public/images/service_nopic_man.gif";
            }
        }
        $send_username = $send_user_info['nickname'] ? $send_user_info['nickname'] : $send_user_info['uid'];
        //发送者用户名
        $send_user_grade = $send_user_info['gender'] == 1 ? "女" : "男";
        //发送者性别
        $province = isset($provice_list[$send_user_info['province']]) ? $provice_list[$send_user_info['province']] : '';
        //省
        $city = isset($city_list[$send_user_info['city']]) ? $city_list[$send_user_info['city']] : '';
        //市
        $height = $send_user_info['height'] ? $height_list[$send_user_info['height']] : "未知";
        //身高
        ob_start();
        require_once adminTemplate('mail/mail_space_commissiontpl');
        $body = ob_get_clean();
        MooSendMail($user['username'], "真爱一生网系统温馨提示", $body, "", false, $uid);
        //--------->发送邮件提醒  结束///////////////////////////////////////////
        if ($ret) {
            echo 1;
        } else {
            echo 0;
        }
        //写日志
        serverlog(3, $GLOBALS['dbTablePre'] . 'services', "{$GLOBALS['adminid']}号客服{$GLOBALS['username']}向会员{$uid}发送站内信", $GLOBALS['adminid'], $uid);
        exit;
    }
    //note 会员认证
    if ($type == 4) {
        $change = MooGetGPC('change', 'string', 'G');
        $a = MooGetGPC('a', 'integer', 'G');
        $str = $a ? '已通过' : '未通过';
        //note 下面判断的作用是防止certification表中无该会员的记录,导致认证失败
        $sql = "SELECT uid FROM {$GLOBALS['dbTablePre']}certification WHERE uid = {$uid}";
        $ret = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql, true);
        if (empty($ret)) {
            $sql = "INSERT INTO {$GLOBALS['dbTablePre']}certification(uid) VALUE({$uid})";
            $GLOBALS['_MooClass']['MooMySQL']->query($sql);
            if (MOOPHP_ALLOW_FASTDB) {
                $value['lastvisit'] = $GLOBALS['timestamp'];
                MooFastdbUpdate('members_login', 'uid', $sendid, $value);
            }
        }
        switch ($change) {
            case 'telphone':
                if ($a) {
                    $sql = "SELECT telphone FROM {$GLOBALS['dbTablePre']}members_search WHERE uid = {$uid}";
                    $user = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql, true);
                    if (empty($user['telphone'])) {
                        $telphone = '12345678900';
                    } else {
                        $telphone = $user['telphone'];
                    }
                } else {
                    $telphone = '';
                }
                $sql = "UPDATE {$GLOBALS['dbTablePre']}certification SET telphone = '{$telphone}' WHERE uid = {$uid}";
                $ret = $GLOBALS['_MooClass']['MooMySQL']->query($sql);
                //if(MOOPHP_ALLOW_FASTDB){MooFastdbUpdate('certification','uid',$uid);}
                if (MOOPHP_ALLOW_FASTDB) {
                    //$value =  $GLOBALS['_MooClass']['MooMySQL']->getOne("SELECT * FROM {$GLOBALS['dbTablePre']}certification  WHERE `uid`='{$uid}'  LIMIT 1");
                    $value = array();
                    $value['telphone'] = $telphone;
                    MooFastdbUpdate("certification", 'uid', $uid, $value);
                }
                reset_integrity($uid);
                //写日志
                serverlog(2, $GLOBALS['dbTablePre'] . 'certification', "{$GLOBALS['adminid']}号客服{$GLOBALS['username']}将会员{$uid}的手机认证修改为{$str}", $GLOBALS['adminid'], $uid);
                echo $ret ? 'ok' : 'error';
                exit;
                break;
            case 'sms':
                $sql = "UPDATE {$GLOBALS['dbTablePre']}certification SET sms = {$a} WHERE uid = {$uid}";
                $ret = $GLOBALS['_MooClass']['MooMySQL']->query($sql);
                //if(MOOPHP_ALLOW_FASTDB){MooFastdbUpdate('certification','uid',$uid);}
                if (MOOPHP_ALLOW_FASTDB) {
                    //$value =  $GLOBALS['_MooClass']['MooMySQL']->getOne("SELECT * FROM {$GLOBALS['dbTablePre']}certification  WHERE `uid`='{$uid}'  LIMIT 1");
                    $value = array();
                    $value['sms'] = $a;
                    MooFastdbUpdate("certification", 'uid', $uid, $value);
                }
                reset_integrity($uid);
                //写日志
                serverlog(2, $GLOBALS['dbTablePre'] . 'certification', "{$GLOBALS['adminid']}号客服{$GLOBALS['username']}将会员{$uid}的身份通认证修改为{$str}", $GLOBALS['adminid'], $uid);
                echo $ret ? 'ok' : 'error';
                exit;
                break;
            case 'email':
                $e = $a ? 'yes' : '';
                $sql = "UPDATE {$GLOBALS['dbTablePre']}certification SET email = '{$e}' WHERE uid = {$uid}";
                $ret = $GLOBALS['_MooClass']['MooMySQL']->query($sql);
                //if(MOOPHP_ALLOW_FASTDB){MooFastdbUpdate('certification','uid',$uid);}
                if (MOOPHP_ALLOW_FASTDB) {
                    //$value =  $GLOBALS['_MooClass']['MooMySQL']->getOne("SELECT * FROM {$GLOBALS['dbTablePre']}certification  WHERE `uid`='{$uid}'  LIMIT 1");
                    $value = array();
                    $value['email'] = $e;
                    MooFastdbUpdate("certification", 'uid', $uid, $value);
                }
                reset_integrity($uid);
                //写日志
                serverlog(2, $GLOBALS['dbTablePre'] . 'certification', "{$GLOBALS['adminid']}号客服{$GLOBALS['username']}将会员{$uid}的邮箱认证修改为{$str}", $GLOBALS['adminid'], $uid);
                echo $ret ? 'ok' : 'error';
                exit;
                break;
            default:
                if (empty($change)) {
                    break;
                }
                $v = $a ? 3 : 1;
                if ($change == 'video') {
                    $change2 = '视频';
                } elseif ($change == 'house') {
                    $change2 = '房产';
                } elseif ($change == 'salary') {
                    $change2 = '工资';
                } elseif ($change == 'occupation') {
                    $change2 = '工作';
                } elseif ($change == 'education') {
                    $change2 = '学历';
                } elseif ($change == 'marriage') {
                    $change2 = '婚育';
                } elseif ($change == 'identity') {
                    $change2 = '身份证';
                }
                $sql = "UPDATE {$GLOBALS['dbTablePre']}certification SET {$change}_check = {$v} WHERE uid = {$uid}";
                $ret = $GLOBALS['_MooClass']['MooMySQL']->query($sql);
                //if(MOOPHP_ALLOW_FASTDB){MooFastdbUpdate('certification','uid',$uid);}
                if (MOOPHP_ALLOW_FASTDB) {
                    //$value = array();
                    $value[$change . "_check"] = $v;
                    MooFastdbUpdate("certification", 'uid', $uid, $value);
                }
                reset_integrity($uid);
                //写日志
                serverlog(2, $GLOBALS['dbTablePre'] . 'certification', "{$GLOBALS['adminid']}号客服{$GLOBALS['username']}将会员{$uid}的{$change2}认证修改为{$str}", $GLOBALS['adminid'], $uid);
                echo $ret ? 'ok' : 'error';
                exit;
                break;
        }
        $sql = "SELECT * FROM {$GLOBALS['dbTablePre']}certification WHERE uid = {$uid}";
        $cert = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql, true);
    }
    //note 发彩信北京易速彩信
    /*if($type ==5){
          //header("Content-Type: text/html; charset=utf-8");
          $page = max(1,MooGetGPC('page','integer','G'));
          $limit = 10;
          $offset = ($page-1)*$limit;
          $gopage = MooGetGPC('gopage','integer','G');
          if($ispost){
              $mes = MooGetGPC('tel_message','string','P');
              $title = MooGetGPC('title','string','P');           
              
              $pic_id=MooGetGPC('pic_id','string','P');
              $pic_name=($pic_id*3)."_medium.jpg";
              $pic_path="./../data/upload/userimg/";
              $user_pic=$pic_path.$pic_name;
              
              $dateline = time();
              $dateline2=$dateline+300;
              
              $sql1="SELECT * FROM {$GLOBALS['dbTablePre']}mmslog where uid='$uid' and title='$title' and content='$mes' and sendtime<'$dateline2'";
              //error_log($sql1);
              $msg_inf = $GLOBALS['_MooClass']['MooMySQL']->query($sql1);
              $msg_num=$GLOBALS['_MooClass']['MooMySQL']->numRows($msg_inf);
              //error_log($msg_num);
              if($msg_num<2){ 
                  $mes_64=base64_encode($mes);
                  $pic_64=base64_encode(file_get_contents($user_pic));
                  $content="1,txt,$mes_64;2,jpg,$pic_64";
                  $ret = send_mms($title,$tel,$content);
                  
                  if( $ret == "ok"){
                      $sql = "INSERT INTO {$GLOBALS['dbTablePre']}mmslog(sid,uid,title,content,sendtime) VALUES('{$GLOBALS['adminid']}','{$uid}','{$title}','{$mes}','{$dateline}')";
                      $sid = $GLOBALS['_MooClass']['MooMySQL']->query($sql);
                      echo 1; 
                  }else{
                      echo 0;
                  }
                  //写日志
                  serverlog(3,$GLOBALS['dbTablePre'].'mmslog',"{$GLOBALS['adminid']}号客服{$GLOBALS['username']}向会员{$uid}发送彩信{$sid}",$GLOBALS['adminid'],$uid);
                  exit;   
              }else echo "你已经发过两条同样的彩信了!";
          }
          $sql = "SELECT * FROM {$GLOBALS['dbTablePre']}mmspre WHERE user = {$GLOBALS['adminid']} OR user = 0 LIMIT {$offset},{$limit}";
          $sms = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql);
                  
          $total = getcount('mmspre',"WHERE user = {$GLOBALS['adminid']} OR user = 0");
          $pages = ceil($total/$limit);
          if( $gopage ){
              foreach( $sms as $k=>$v){
                  $content = str_replace('[adminid]',$GLOBALS['adminid'],$v['content']);
                  
                  preg_match("/\[smstitle\](.+?)\[\/smstitle\]/isU",$content,$matche1);
                  preg_match("/\[\/smstitle\](.+?)/isU",$content,$matche2);
                  
                  if ($matche1[1]){
                      echo '<div style="padding:3px; cursor:pointer;" onclick="selectThis('.(($page-1)*$limit+$k+1).');">'.(($page-1)*$limit+$k+1).'.<font color="#0033CC">'.$matche1[1].'</font><span id="sms_content_'.(($page-1)*$limit+$k+1).'">'.$matche2[1].'</span></div>';
                  }else{
                      echo '<div style="padding:3px; cursor:pointer;" onclick="selectThis('.(($page-1)*$limit+$k+1).');">'.(($page-1)*$limit+$k+1).'.<span id="sms_content_'.(($page-1)*$limit+$k+1).'">'.$content.'</span></div>';
                  }
              }
              exit;
          }
      }*/
    if ($type == 5) {
        //上海亿美彩信
        //header("Content-Type: text/html; charset=GB2312");
        $page = max(1, MooGetGPC('page', 'integer', 'G'));
        $limit = 10;
        $offset = ($page - 1) * $limit;
        $gopage = MooGetGPC('gopage', 'integer', 'G');
        if ($ispost) {
            $dateline = time();
            $dateline2 = $dateline + 300;
            $today = mktime(0, 0, 0, date('m', time()), date('d', time()), date('Y', time()));
            $mes = MooGetGPC('tel_message', 'string', 'P');
            $title = MooGetGPC('title', 'string', 'P');
            $tel_message = $mes;
            $sql1 = "SELECT * FROM {$GLOBALS['dbTablePre']}mmslog where uid='{$uid}' and title='{$title}' and content='{$mes}' and sendtime<'{$dateline2}'";
            echo $sql1;
            $msg_inf = $GLOBALS['_MooClass']['MooMySQL']->query($sql1);
            $msg_num = $GLOBALS['_MooClass']['MooMySQL']->numRows($msg_inf);
            $sql2 = "SELECT count(1) as num from {$GLOBALS['dbTablePre']}mmslog where sid='{$GLOBALS['adminid']}' and sendtime<'{$dateline}' and sendtime>'{$today}'";
            $today_sendnum = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql2, true);
            if ($today_sendnum['num'] > 30) {
                echo "你今天已经发送30条了,不可以再发送彩信了!请节约使用。";
                exit;
            }
            //echo $msg_num;exit;
            if ($msg_num < 2) {
                include "include/crontab_config.php";
                $pic_path = "./../data/upload/userimg/";
                $file_path = "data/upload";
                $mes = iconv("UTF-8", "gb2312", "{$mes}");
                $mkdirs = MooAutoLoad('MooFiles');
                $image = MooAutoLoad('MooImage');
                $pic_id_list = MooGetGPC('pic_id', 'string', 'P') . "0";
                $user_image_list = MooGetGPC('image_list', 'string', 'P');
                $user_image_arr = explode(",", $user_image_list);
                $sql = "SELECT m.uid,m.nickname,m.province,m.city,m.gender,m.pic_name,m.birthyear,c.age1,c.age2,c.workprovince,c.workcity FROM {$GLOBALS['dbTablePre']}members_search m left join {$GLOBALS['dbTablePre']}members_choice c on m.uid=c.uid WHERE m.uid in ({$pic_id_list})";
                $userinfo_arr = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql, 0, 0, 0, true);
                $file_name_smil = 'temp' . time() . rand(10000, 99999);
                $file_array = $file_path . "/" . $file_name_smil . ".smil," . $file_path . "/" . $file_name_smil . ".txt";
                foreach ($userinfo_arr as $key => $userinfo) {
                    $file_name = 'temp' . time() . rand(10000, 99999) . $key;
                    $need_del_file[] = $file_name;
                    $nickname1 = "昵称:" . $userinfo['nickname'];
                    $nickname = iconv("UTF-8", "gb2312", "{$nickname1}");
                    $txt = " ID:" . $userinfo['uid'] . "(" . (gmdate('Y', time()) - $userinfo['birthyear']) . "岁),居住在" . ($provice_list[$userinfo['province']] || $city_list[$userinfo['city']] ? $provice_list[$userinfo['province']] . $city_list[$userinfo['city']] : "未填") . "的" . ($userinfo['gender'] ? '女士' : '男士') . "寻找一位年龄在" . $userinfo['age1'] . "-" . $userinfo['age2'] . "岁,居住" . ($provice_list[$userinfo['workprovince']] || $city_list[$userinfo['workcity']] ? $provice_list[$userinfo['workprovince']] . $city_list[$userinfo['workcity']] : "未填") . "的" . ($userinfo['gender'] ? '男士' : '女士');
                    $txt1 = iconv("UTF-8", "gb2312", "{$txt}");
                    $txt = $nickname . $txt1;
                    $mkdirs->fileWrite($file_path . "/" . $file_name . ".txt", $txt);
                    $pic_name_old = MooGetphotoAdmin($userinfo['uid'], 'medium');
                    $pic_only_name = $userinfo['uid'] * 3 . "_medium.gif";
                    $image->config(array('thumbDir' => $file_path . '/', 'thumbStatus' => '1', 'saveType' => '0', 'thumbName' => $pic_only_name, 'waterMarkMinWidth' => '100', 'waterMarkMinHeight' => '125', 'waterMarkStatus' => 9));
                    $image->thumb('100', '125', $pic_name_old);
                    $pic_name_file = $file_path . '/' . $pic_only_name;
                    $pic = 'http://www.zhenaiyisheng.cc/' . $pic_name_old;
                    $pic = file_get_contents($pic);
                    file_put_contents($pic_name_file, $pic);
                    //echo $pic_name_file;exit;
                    //$pic_name="5226417_mid.jpg";
                    $par = $par . '<par dur="50000ms"><img src="' . $pic_only_name . '" region="Image" /><text src="' . $file_name . '.txt" region="Text" /></par>';
                    $file_array = $file_array . "," . $file_path . "/" . $file_name . ".txt," . $pic_name_file;
                    foreach ($user_image_arr as $key => $user_image) {
                        if ($user_image) {
                            //$image_only_name=substr($user_image,45,36);
                            $image_only_name = $file_name . $key . ".gif";
                            list($width, $height) = getimagesize(".." . $user_image);
                            $d = $width / $height;
                            $c = 85 / 100;
                            if ($d < $c) {
                                $thumb1_width = 85;
                                $b = $width / $thumb1_width;
                                $thumb1_height = $height / $b;
                            } else {
                                $thumb1_height = 100;
                                $b = $height / $thumb1_height;
                                $thumb1_width = $width / $b;
                            }
                            $big_path = $file_path . '/';
                            $image->config(array('thumbDir' => $big_path, 'thumbStatus' => '1', 'saveType' => '0', 'thumbName' => $image_only_name, 'waterMarkMinWidth' => '82', 'waterMarkMinHeight' => '114', 'waterMarkStatus' => 9));
                            $image->thumb($thumb1_height, $thumb1_width, '..' . $user_image);
                            $need_product_img[] = $big_path . $image_only_name;
                            $file_array = $file_array . "," . $file_path . '/' . $image_only_name;
                            $par = $par . '<par dur="50000ms"><img src="' . $image_only_name . '" region="Image" /></par>';
                        }
                    }
                }
                $mkdirs->fileWrite($file_path . "/" . $file_name_smil . ".txt", $mes);
                $user_pic = $pic_path;
                $smil = '<smil xmlns="http://www.w3.org/2000/SMIL20/CR/Language"><head><layout><root-layout width="208" height="176" /><region id="Image" left="0" top="0" width="128" height="128" fit="hidden" /><region id="Text" left="0" top="50" width="128" height="128" fit="hidden" /></layout></head><body><par dur="50000ms"><text src="' . $file_name_smil . '.txt" region="Text" /></par>' . $par . '</body></smil>';
                $mkdirs->fileWrite($file_path . "/" . $file_name_smil . ".smil", $smil);
                require 'include/pclzip_new.lib.php';
                $archive = new PclZip($file_path . "/" . $file_name_smil . '.zip');
                $v_list = $archive->create($file_array, PCLZIP_OPT_REMOVE_ALL_PATH);
                if ($v_list == 0) {
                    die("Error : " . $archive->errorInfo(true));
                }
                $file_size = filesize($file_path . "/" . $file_name_smil . '.zip');
                if ($file_size > 45 * 1024) {
                    echo "文件过打,请删除部分图片";
                    $mkdirs->fileDelete($file_path . "/" . $file_name_smil . '.zip');
                    $mkdirs->fileDelete($file_path . "/" . $file_name_smil . '.txt');
                    $mkdirs->fileDelete($file_path . "/" . $file_name_smil . '.smil');
                    $mkdirs->fileDelete($file_path . "/" . $pic_only_name);
                    if ($need_del_file) {
                        foreach ($need_del_file as $del_file) {
                            $mkdirs->fileDelete($file_path . "/" . $del_file . '.txt');
                        }
                    }
                    if ($need_product_img) {
                        foreach ($need_product_img as $del_img) {
                            $mkdirs->fileDelete($del_img);
                        }
                    }
                    exit;
                }
                $ret = send_mms_yimei($title, $tel, $file_name_smil . '.zip');
                $ret_ok = substr($ret, 0, 2);
                if ($ret_ok == "OK") {
                    $sql = "INSERT INTO {$GLOBALS['dbTablePre']}mmslog(sid,uid,title,content,sendtime,id_list) VALUES('{$GLOBALS['adminid']}','{$uid}','{$title}','{$tel_message}','{$dateline}','{$pic_id_list}')";
                    $sid = $GLOBALS['_MooClass']['MooMySQL']->query($sql);
                    echo 1;
                } else {
                    echo 0;
                }
                $mkdirs->fileDelete($file_path . "/" . $file_name_smil . '.zip');
                $mkdirs->fileDelete($file_path . "/" . $file_name_smil . '.txt');
                $mkdirs->fileDelete($file_path . "/" . $file_name_smil . '.smil');
                $mkdirs->fileDelete($file_path . "/" . $pic_only_name);
                if ($need_del_file) {
                    foreach ($need_del_file as $del_file) {
                        $mkdirs->fileDelete($file_path . "/" . $del_file . '.txt');
                    }
                }
                if ($need_product_img) {
                    foreach ($need_product_img as $del_img) {
                        $mkdirs->fileDelete($del_img);
                    }
                }
                //写日志
                serverlog(3, $GLOBALS['dbTablePre'] . 'mmslog', "{$GLOBALS['adminid']}号客服{$GLOBALS['username']}向会员{$uid}发送彩信{$sid}", $GLOBALS['adminid'], $uid);
                exit;
            } else {
                echo "你已经发过两条同样的彩信了!";
                exit;
            }
        }
        $sql = "SELECT count(distinct senduid) as num FROM {$GLOBALS['dbTablePre']}service_rose where receiveuid='{$uid}' and receive_del=0 and send_del=0";
        $send_rose = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql, true);
        //$sql="SELECT count(1) as num FROM {$GLOBALS['dbTablePre']}service_leer where receiveuid='{$uid}' and receive_del=0 and send_del=0 and is_server=0";
        //$send_leer = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql);
        $sql = "SELECT count(1) as num FROM {$GLOBALS['dbTablePre']}service_contact where you_contact_other='{$uid}' and receive_del=0 and send_del=0 and is_server=0";
        $send_contact = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql, true);
        //$sql="SELECT count(1) as num FROM {$GLOBALS['dbTablePre']}service_friend where friendid='{$uid}' ";
        //$send_friend = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql);
        //$sql="SELECT count(distinct cuid) as num FROM {$GLOBALS['dbTablePre']}members_comment where uid='{$uid}' and receive_del=0 and send_del=0";
        //$send_comment = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql);
    }
    require_once adminTemplate('allmember_contact');
}
Esempio n. 20
0
File: leer.php Progetto: noikiy/zays
function sendnewleer()
{
    global $_MooClass, $dbTablePre, $timestamp, $user_arr, $serverid;
    $sendtoid = MooGetGPC('sendtoid', 'integer');
    $userid = $user_arr['uid'];
    //note 分配客服
    //allotserver($userid);
    //note 获得照片总数
    //$query = $_MooClass['MooMySQL']->query("SELECT imgid FROM {$dbTablePre}pic WHERE uid = '$sendtoid'");
    //$pic_total = $_MooClass['MooMySQL']->numRows($query);
    $query = $_MooClass['MooMySQL']->getOne("SELECT count(1) as c FROM {$dbTablePre}pic WHERE uid = '{$sendtoid}'");
    $pic_total = $query['c'];
    //note 自己不能给自己发送秋波,直接转到秋波列表页面
    if ($sendtoid == $userid) {
        MooMessage('自己不可以给自己发过送秋波', 'javascript:history.go(-1);', '04');
        exit;
    }
    $result = $_MooClass['MooMySQL']->getOne("select groupid from web_admin_user where uid='{$serverid}'");
    $groupid = $result['groupid'];
    //系统管理员权限
    $GLOBALS['system_admin'] = array(60);
    if (in_array($groupid, $GLOBALS['system_admin'])) {
        $serverid = null;
    }
    if ($serverid) {
        MooMessage('对不起您不能模拟操作', 'javascript:history.go(-1);', '04');
        exit;
    }
    //note 双方屏蔽不给操作
    if (MooGetScreen($userid, $sendtoid)) {
        MooMessage('因特殊原因,送秋波失败', "index.php?n=service&h=rose&t=getmorerose", '03');
        exit;
    }
    //note 要做性别过滤,异性的发送秋波,直接转到秋波列表页面
    $send_user1 = leer_send_user1($sendtoid);
    $user = leer_send_user1($userid);
    if ($send_user1['gender'] == $user['gender']) {
        MooMessage('同性之间不可互发秋波', 'javascript:history.go(-1);', '02');
        exit;
    }
    if (empty($GLOBALS['MooUid'])) {
        list($uid, $password) = explode("\t", MooAuthCode($_MooCookie['auth'], 'DECODE'));
        $uid = intval($uid);
    } else {
        $uid = $GLOBALS['MooUid'];
    }
    if (empty($uid)) {
        MooMessage('您还没有登录', 'index.php?n=login');
    }
    $leer = $_MooClass['MooMySQL']->getOne("SELECT * FROM {$dbTablePre}service_leer WHERE receiveuid = '{$sendtoid}' AND senduid = '{$userid}' ", true);
    if ($leer['lid']) {
        $lid = $leer['lid'];
        //note 如果已经发送过秋波,就增加发送秋波的次数
        $_MooClass['MooMySQL']->query("UPDATE {$dbTablePre}service_leer SET num = num + 1,receivenum = receivenum + 1,sendtime = '{$timestamp}',receivetime = '{$timestamp}',receive_del = '0' WHERE lid = '{$lid}'");
        //note 如果已经收到这个人的秋波,已经拒绝,现在改变注意,又发送秋波给这个人,拒绝状态2更改为0
        $_MooClass['MooMySQL']->query("UPDATE {$dbTablePre}service_leer SET stat = '0' WHERE senduid = '{$sendtoid}' AND receiveuid = '{$uid}' AND stat = '2'");
    } else {
        //note 发送新的秋波,写入数据库 发送者,接受者,发送时间
        $_MooClass['MooMySQL']->query("INSERT INTO {$dbTablePre}service_leer SET sendtime = '{$timestamp}',receivetime = '{$timestamp}',receivenum = '1', num = '1', senduid  = '{$uid}',receiveuid = '{$sendtoid}'");
    }
    //将新注册的会员更新为优质会员
    if (in_array($user_arr['sid'], array(0, 52, 123)) && $user_arr['is_well_user'] != 1) {
        update_iswell_user($user_arr['uid']);
    }
    //发送短信和邮件
    include_once "./module/crontab/crontab_config.php";
    /*if(MOOPHP_ALLOW_FASTDB){
    		$res = MooFastdbGet('members','uid',$sendtoid);
    	}else{
    	   $res= $_MooClass['MooMySQL']->getOne("select * from {$dbTablePre}members where uid='$sendtoid'");
       }*/
    $res = MooMembersData($sendtoid);
    $send_user_info = $_MooClass['MooMySQL']->getOne("select b.*,c.*,a.* from `{$dbTablePre}members_search` a  left join {$dbTablePre}members_base c on a.uid=c.uid left join  {$dbTablePre}members_choice b  on a.uid=b.uid  where a.uid = '{$uid}' LIMIT 1");
    //头像路径
    $path = thumbImgPath(2, $send_user_info[pic_date], $send_user_info[pic_name]);
    if (file_exists($path)) {
        $img_path = $path;
    } else {
        if ($send_user_info['gender'] == 1) {
            $img_path = "/public/images/service_nopic_woman.gif";
        } else {
            $img_path = "/public/images/service_nopic_man.gif";
        }
    }
    $send_username = $send_user_info['nickname'] ? $send_user_info['nickname'] : $send_user_info['uid'];
    //发送者用户名
    $send_user_grade = $send_user_info['gender'] == 1 ? "女" : "男";
    //发送者性别
    $province = isset($provice_list[$send_user_info[province]]) ? $provice_list[$send_user_info[province]] : '';
    //省
    $city = isset($city_list[$send_user_info[city]]) ? $city_list[$send_user_info[city]] : '';
    //市
    $height = $send_user_info[height] ? $height_list[$send_user_info[height]] : "未知";
    //身高
    ob_start();
    //require_once MooTemplate('public/mail_space_leertpl', 'module'); //秋波模板
    require_once MooTemplate('public/mail_space_leertpl', 'module');
    //秋波模板
    $body = ob_get_clean();
    MooSendMail($res['username'], "真爱一生网系统温馨提示", $body, "", false, $sendtoid);
    // MooSendMailSpace($res['username'],"真爱一生网系统温馨提示","真爱一生网提醒:有会员给您发送秋波了!请尽快查收!您的帐号是:".$res['username'],$type="1",$send_user,$send_type = "秋波",$userid,$send_user_img,$age,$tall,$area,$sendtime,$introduce);
    //每天向同一用户发送多次,短信记录数表只记一次
    $send_leer_date = isset($leer['sendtime']) ? date("Y-m-d", $leer['sendtime']) : date("Y-m-d");
    //
    $today_leer_count = isset($leer['lid']) ? $leer['num'] + 1 : 1;
    if (date("Y-m-d") > $send_leer_date) {
        $today_leer_count = 1;
    }
    //include "./module/{$name}/function.php";
    if ($res['is_phone']) {
        SendMsg($res['telphone'], "真爱一生网 用户ID:" . $userid . "," . $send_user_grade . ",已给您发送秋波,请及时把握您的缘分!4006780405");
    }
    //SendMsg($res['telphone'],"秋波","真爱一生网 用户ID:".$userid.",".$send_user_grade.",已给您发送秋波,请及时把握您的缘分!4006780405",$userid);
    /*
        $week_time = 24*3600*7;//一周时间秒数
    	$interval_time = $timestamp - $user_arr['last_login_time'];//当前时间-最后登录时间
    	$date1 = date("Y-m-d",strtotime("last Monday"));
    	$date2 = date("Y-m-d",strtotime("Sunday"));
    	
    	if($interval_time > $week_time){//不活跃用户每周发一条短信
    			$_MooClass['MooMySQL']->query("INSERT INTO {$dbTablePre}today_send SET uid = '".$sendtoid."', sid = '".$userid."',phone = '".$res['telphone']."',sendtime = '".date("Y-m-d")."'" );
    	   		$cos = $_MooClass['MooMySQL']->getOne("select count(*) as c from {$dbTablePre}today_send where uid='$sendtoid'  and sendtime>='$date1' and sendtime<='$date2'");
    	    	if($cos['c']<=1){
    				//fanglin暂时屏蔽
    			  Push_message_intab($sendtoid,$res['telphone'],"秋波","真爱一生网 用户ID:".$userid.",".$send_user_grade.",已给您发送秋波,请及时把握您的缘分!4006780405",$userid);
    		   }
    	}else{ //活跃用户每天一条
    		 if($send_leer_date==date("Y-m-d") && $today_leer_count == 1){	//每天同一个用户发送多次秋波,短信只记一次
    	       $cos = $_MooClass['MooMySQL']->getOne("select count(*) as c from {$dbTablePre}today_send where uid='$sendtoid' and sendtime='".date("Y-m-d")."'");
    		   if($cos[c]<5){
    		   	  $_MooClass['MooMySQL']->query("INSERT INTO {$dbTablePre}today_send SET uid = '".$sendtoid."', sid = '".$userid."',phone = '".$res['telphone']."',sendtime = '".date("Y-m-d")."'" );
    			  //fanglin暂时屏蔽
    			  Push_message_intab($sendtoid,$res['telphone'],"秋波","真爱一生网 用户ID:".$userid.",".$send_user_grade.",已给您发送秋波,请及时把握您的缘分!4006780405",$userid);
    		   }
    	   }    
    	}*/
    //提醒所属客服
    $sid = $user_arr['sid'];
    $title = '您的会员 ' . $user_arr['uid'] . ' 向 ' . $sendtoid . ' 发送了秋波';
    $awoketime = $timestamp + 3600;
    $sql_remark = "insert into {$dbTablePre}admin_remark set sid='{$sid}',title='{$title}',content='{$title}',awoketime='{$awoketime}',dateline='{$timestamp}'";
    $res = $_MooClass['MooMySQL']->query($sql_remark);
    $users =& $res;
    require MooTemplate('public/service_leer_sendnewleer', 'module');
}
Esempio n. 21
0
     $is_phone = !empty($telphone) ? 1 : 0;
     $md5 = md5($uid . $puid . 2 . $website . $ip . $where_from . MOOPHP_AUTHKEY);
     $apiurl = "http://mycount.7652.com/hongniang/hongniang_import.php?ip=" . $ip . "&uid=" . $uid . "&puid=" . $puid . "&s_cid=2&website=" . $website . "&keyurl=" . $where_from . "&md5=" . $md5 . "&gender=" . $gender . "&phone=" . $telphone . "&is_phone=" . $is_phone . "&birthyear=" . $birthyear;
     if (file_get_contents($apiurl) != "ok") {
         $dateline = time();
         $sql = "INSERT INTO {$GLOBALS['dbTablePre']}do_url VALUES('','{$apiurl}','{$dateline}',0,0)";
         $GLOBALS['_MooClass']['MooMySQL']->query($sql);
     }
     // htotal
     $h_time = getdate(time());
     $apiurl2 = "http://222.73.4.240/tj/index/reg?act=register&i=" . $ip . "&u=" . $uid . "&pu=" . $puid . "&w=1&site=" . $website . "&urr=" . $where_from . "&sex=" . $gender . "&p=" . $is_phone . "&t=" . strtotime(date("Y-m-d")) . "&h=" . $h_time["hours"] . "&n=" . $username;
     @file_get_contents($apiurl2);
     $rand = rand(362144, 965421);
     MooSetCookie("rand", md5(md5($rand)));
     // 希希奥信息发送手机短信接口
     $re = SendMsg($telphone, "注册真爱一生网成功 ID:" . $uid);
     if ($re) {
         $time = time();
         $content = "注册成功提醒";
         $sql_res[] = $_MooClass['MooMySQL']->query("INSERT INTO {$dbTablePre}smslog_sys (id,sid,uid,content,sendtime,type) values('','','{$uid}','{$content}','{$time}','注册成功提醒')");
         //$sql = "DELETE FROM {$dbTablePre}smslog_sys where uid = '$tele'";
         //$_MooClass ['MooMySQL']->query($sql);
     }
     MooSetCookie('auth', MooAuthCode("{$uid}\t{$password}", 'ENCODE'), 86400 * 7);
     MooSetCookie("where_from", "");
     MooSetCookie("puid", "");
     MooSetCookie("website", "");
     MooSetCookie('password2', $password2, 3600);
     // }
 } else {
     $error = "填写资料不全";