Esempio n. 1
0
                    include 'dbconn.php';
                    $display_u = "SELECT * FROM games WHERE url = '{$url_i_}'";
                    $display_u_proc = mysql_query($display_u);
                    $row_u = mysql_fetch_assoc($display_u_proc);
                    //$g_id = $row_u["id"];
                    $u_id = $row_u["u_id"];
                    $used = 0;
                    $insert = mysql_query("INSERT INTO g_downloads(token, url, used, number, u_id) \n                                            VALUES ('{$token}', '{$url_i_}', '{$used}', '{$phone_num}', '{$u_id}')") or die(mysql_error());
                    /* $insert=mysql_query("INSERT INTO g_downloads(token, g_id, url, used, number, u_id) 
                       VALUES ('$token', '$g_id' , '$url_i_', '$used', '$phone_num', '$u_id')") or die(mysql_error()); */
                    //Insert to downloads table
                    if ($insert) {
                        //URL TO SEND TO PHONE BY SMS
                        $url_final = "http://www.dosika.co.ke/waspplanet/0g/dwn_g_process.php?token_i=" . $token . "&url_i=" . $url_i_;
                        $msg_ = "Thank you for subscribing to DOSIKA HD GAMES. Click here " . $url_final;
                        sendmsg($msg_, $phone_num, $sender);
                        echo '<div class="container"><div class="news-paper"><div class="sign_up text-center">
                    <span style="color:#00CC66;">Thank you for subscribing to ' . $content_name['cnt_name'] . '. Please confirm your subscription by sending "GAMES" to ' . $sender . '. A link has been sent to your phone.</span>';
                        echo '<p><a href="http://www.dosika.co.ke/waspplanet/0g/">&laquo;&laquo;Back to Content</a></p></div></div></div>';
                    } else {
                        echo 'Not inserted.';
                    }
                } else {
                    echo 'Internal error occured. Please try again.';
                    echo '<p><a href="#">&laquo;&laquo;<b>Click here</b></a> to retry.</p>';
                }
            }
        }
    }
} else {
    echo '<div class="container"><div class="news-paper"><div class="sign_up text-center"><form id="frm_subcription" action="" method="post" >';
Esempio n. 2
0
     logout();
 } else {
     if ($ask == "main") {
         seemain();
     } else {
         if ($ask == "news") {
             news();
         } else {
             if ($ask == "hot") {
                 gethot();
             } else {
                 if ($ask == "userinfo") {
                     getuserinfo();
                 } else {
                     if ($ask == "sendmsg") {
                         sendmsg();
                     } else {
                         if ($ask == "msg") {
                             msg();
                         } else {
                             if ($ask == "register") {
                                 register();
                             } else {
                                 if ($ask == "edituser") {
                                     edituser();
                                 } else {
                                     if ($ask == "changepsd") {
                                         changepsd();
                                     } else {
                                         if ($ask == "delete") {
                                             del();
Esempio n. 3
0
				</head>
				<body>
				&nbsp;
				</body>
				</html>
				<?php 
            } else {
                if (eregi("^/.*", $tampon) && !eregi("^//.*", $tampon)) {
                    $rez = irc($tampon);
                    if (eregi("^Error.*", $rez)) {
                        $to2 = "{$XUSER['NAME']}:PRIV";
                        sendsysmsgto($rez, $to2);
                    }
                } else {
                    $msg = eregi_replace("//", "/", $msg);
                    sendmsg($msg);
                    $submsg = codeparse($msg);
                    $submsg = eregi_replace('"', '\\"', $submsg);
                    $submsg .= "<Br>";
                    if ($XUSER['TIMESTAMP'] == 0) {
                        $timestamp = "[";
                        $temp_timestamp = date("g") + $XUSER['OFFSET'];
                        $timestamp .= $temp_timestamp;
                        $timestamp .= date(":i:s");
                        $timestamp .= "]";
                    }
                    $submsg = "<font color=\\\"{$CS['YOURNAME']}\\\"><b>{$XUSER['NAME']}{$timestamp}</b>:</font> &nbsp; " . $submsg;
                    ?>
					<html>
					<head>
					<script language="javascript" type="text/javascript">
Esempio n. 4
0
 * User: Min
 * Date: 2015/10/31
 * Time: 15:40
 */
//file_get_contents("http://localhost:8080/index.php?route=wechat/msghandler&from=".urlencode("omiagw6HuwXD95DmvmpY27rs1y1c")."&msg=".urlencode("下单成功:50"));
$operator_idlist = ['omiagw0Fg6sXNqbbq91jV9X2pS6w', 'omiagw8PiuGfQQfVabDMtAlQI_vo', 'omiagwyIv-qIg2UHGRoHAtHuN-Hk', 'omiagw6HuwXD95DmvmpY27rs1y1c', 'omiagw0V89-YrnIfT_6ZqwdNjT0E', 'omiagwzBMqBnpGLL5o6qAhUNOZlg', 'omiagwxC73z9re0wK_JCy2-YtHGQ'];
$content = file_get_contents("welcome.txt");
$lines = explode("\n", $content);
$num = count($lines);
$idx = rand(0, $num - 1);
$token = refresh_access_token();
$msg = $lines[$idx];
foreach ($operator_idlist as $openid) {
    $res = sendmsg($openid, $msg, $token);
    var_dump($res);
    $res = sendmsg($openid, "悠选祝您每日好心情", $token);
    var_dump($res);
}
function refresh_access_token()
{
    $APPID = "wx47180ba69fa68387";
    $APPSECRET = "978a3e249a1980827fed107003227cdd";
    $TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" . $APPID . "&secret=" . $APPSECRET;
    $json = file_get_contents($TOKEN_URL);
    //$json=$this->http_get($TOKEN_URL);
    $result = json_decode($json);
    return $result->access_token;
}
function sendmsg($touser, $content, $acc_token)
{
    $data = '{
Esempio n. 5
0
     attachdl($con, $token, $id);
 } else {
     if ($ask == "attachinfo") {
         attachinfo($con, $id, $token);
     } else {
         if ($ask == "unusedattachinfo") {
             unusedattachinfo($con, $token);
         } else {
             if ($ask == "delattach") {
                 delattach($con, $token, $id);
             } else {
                 if ($ask == "editpreview") {
                     editpreview($con, $token, $bid, $tid, $pid);
                 } else {
                     if ($ask == "sendmsg") {
                         sendmsg($con, $token, $to, $text);
                     } else {
                         if ($ask == "msg") {
                             msg($con, $token, $type);
                         } else {
                             if ($ask == "changepsd") {
                                 changepsd($con, $token);
                             } else {
                                 if ($ask == "currentUserInfo") {
                                     currentUserInfo($con, $token);
                                 } else {
                                     if ($ask == "search") {
                                         searchByKeyword($con, $keyword, $token, $type, $bid);
                                     } else {
                                         if ($ask == "edituser") {
                                             edituser($con, $token, $ip);
Esempio n. 6
0
               } else {
                   $insert_user = mssql_query("INSERT INTO mobile_user VALUES('" . $phone_num . "')", $dbhandle);
                   $row_user_id = mssql_fetch_assoc(mssql_query("SELECT id from mobile_user where number='" . $phone_num . "'", $dbhandle));
               }
               ##Check id user is subscribed to content
               $row_check_subscription = mssql_fetch_assoc(mssql_query("SELECT COUNT(*) as cnt_sub from user_subscription where type_id='" . $_REQUEST['subscr'] . "' and user_id='" . $row_user_id['id'] . "' and state=1", $dbhandle));
               if ($row_check_subscription['cnt_sub'] > 0) {
                   echo 'You are already subscribed to ' . $content_name['cnt_name'];
                   echo '<p><a href="index.php?tkn=' . $_REQUEST['tkn'] . '">&laquo;&laquo;<b>CLICK HERE</b></a> to go back to content.</p>';
               } else {
                   $pin_code = getPinCode(4);
                   $date_ = date("Y-m-d H:i:s");
                   $insert_user = mssql_query("INSERT INTO subscription_code VALUES(" . $row_user_id['id'] . ",'" . $pin_code . "','" . $content_type_id . "','" . $date_ . "')", $dbhandle);
                   if ($insert_user) {
                       $msg_ = "Thank you for subscribing to " . $content_name['cnt_name'] . " content. Please confirm your subscription by sending the pin: " . $pin_code . " to 5367. waspafrica.com";
                       sendmsg($msg_, $phone_num);
                       echo '<span style="color:#00CC66;">Thank you for subscribing to ' . $content_name['cnt_name'] . ' content. A confirmation message with a pin will be sent to you shortly.</span>';
                       echo '<p><a href="index.php?tkn=' . $_REQUEST['tkn'] . '">&laquo;&laquo;Back to Content</a></p>';
                   } else {
                       echo 'Internal error occured. Please try again.';
                       echo '<p><a href="index.php?tkn=' . $_REQUEST['tkn'] . '">&laquo;&laquo;<b>CLICK HERE</b></a> to go back and try again..</p>';
                   }
               }
           }
       }
   } else {
       echo '<p>Please enter your mobile number below to subscribe.</p>';
       echo '<form id="frm_subcription" action="" method="post" >';
       echo '<table>
 <tr>
   <td>Mobile(254722123456)</td>
Esempio n. 7
0
 public function gredelay()
 {
     if (session('userid')) {
         $oid = $_GET['oid'];
         if ($oid) {
             $order_db = M('Order');
             $userid = session('userid');
             $map['oid'] = $oid;
             $map['cuserid'] = $userid;
             $oinfo = $order_db->table(C('DB_PREFIX') . 'order O')->join(C('DB_PREFIX') . 'Users U on O.userid = U.userid')->join(C('DB_PREFIX') . 'Users CU on O.cuserid = CU.userid')->join(C('DB_PREFIX') . 'Province P on U.province = P.code')->join(C('DB_PREFIX') . 'City CT on U.city = CT.code')->join(C('DB_PREFIX') . 'Car C on O.cid = C.cid')->join(C('DB_PREFIX') . 'Carbrand CB on C.cbrand = CB.brandid')->join(C('DB_PREFIX') . 'Carmodel CM on C.cmodel = CM.modelid')->field("O.*,C.cppro,C.cpzm,C.cpnum,U.name as username, U.sex, U.tel as usertel,CU.name as cusername,CU.tel as cusertel, CU.sex as csex, P.name as provincename,CT.name as cityname,CB.brandname,CM.name as modelname")->where($map)->find();
             $data['is_delay'] = '3';
             $ress = $order_db->where($map)->save($data);
             if ($ress) {
                 $oinfo['username'] = namereplace($oinfo['username'], $oinfo['sex']);
                 $oinfo['cusername'] = namereplace($oinfo['cusername'], $oinfo['csex']);
                 $ccontent = "您已经同意" . $oinfo['username'] . "将订单延迟1天还车,延迟时间按正常费率计算费用;感谢您的配合!";
                 sendmsg($oinfo['cusertel'], $ccontent);
                 $content = "车主" . $oinfo['cusername'] . "已经同意您的换驾单延迟1天还车,平台将同时为您购买相应的保险(最少为1天);祝您用车愉快!";
                 sendmsg($oinfo['usertel'], $content);
             }
             $this->redirect('Index/morder', array('oid' => $oid, 'shuaxin' => rand()));
         } else {
             $this->redirect('User/myorder');
         }
     } else {
         $this->redirect('User/login');
     }
 }
Esempio n. 8
0
    echo "We just sent the following:";
    echo "<br> Headers:<br> {$headers} \n";
    echo "<p></p>";
    echo "<br> From: {$fromEmail}\n";
    echo "<br> To: {$toEmail}\n";
    echo "<br> Message:  {$content} \n";
    echo "<br> message sent";
    echo "<p></p>";
    echo "</td></tr>";
}
#sendmsg($toEmail,$sendSubject,$httpDomain,$path,$message,$content,$fromName,$fromEmail,$sendDate);
#$sendToEmails="josh2@joshingeneral.com,josh3@joshingeneral.com";
#echo "$sendToEmails";
$emailArray = explode(',', $toEmail);
foreach ($emailArray as $email) {
    echo "<tr><td>";
    echo "<br> Email Sent To: {$email}";
    echo "</td></tr>";
    sendmsg($email, $sendSubject, $httpDomain, $path, $message, $content, $fromName, $fromEmail, $sendDate, $landingPageError, $cache);
}
?>
</tr>
<tr>
<td>
  <a href="index.php"> Home </a> <br />
  Click / View Results: <a href="results.php">Results </a> 
</td>
</tr>
</table>
</body>
</html>
Esempio n. 9
0
if ($_GET['key'] != $_config['cronkey']) {
    exit('ERROR CRON KEY');
}
$date = date('Ymd', TIMESTAMP + 900);
$mdate = date('Y-m-d', TIMESTAMP + 900);
$uid = 0;
while (true) {
    $user = DB::fetch_first("SELECT uid, username, email FROM member WHERE uid>'{$uid}' ORDER BY uid LIMIT 0,1");
    $uid = $user['uid'];
    if (!$uid) {
        break;
    }
    echo "正在检查用户 {$user[username]}<br>";
    if (check_if_msg($user)) {
        echo "正在发送邮件给 {$user[username]}...<br>";
        sendmsg($user);
    }
}
function check_if_msg($user)
{
    global $date, $uid;
    $setting = get_setting($user['uid']);
    if ($setting['send_mail']) {
        return true;
    }
    if (!$setting['error_mail']) {
        return false;
    }
    $error_num = DB::result_first("SELECT COUNT(*) FROM sign_log WHERE status!=2 AND date='{$date}' AND uid='{$uid}'");
    if ($error_num > 0) {
        return true;
Esempio n. 10
0
 public function returnclear($id)
 {
     $user_db = M('Users');
     $order_db = M('Order');
     $pointlog_db = D('Pointlog');
     $orderlist = $order_db->where('oid=' . $id)->find();
     $userid = $orderlist['userid'];
     $cuserid = $orderlist['cuserid'];
     //退还共享豆或者现金
     if ($orderlist['is_delay'] == '3') {
         $delays = I('post.delays');
         $desprice = I('post.desprice');
     }
     $deposit = I('post.deposit');
     $paytype = $orderlist['paytype'];
     //共享豆方式退还
     if ($paytype == 1) {
         $userlist = $user_db->where('userid=' . $userid)->find();
         $userbalance['balance'] = $deposit + $userlist['balance'];
         $resuser = $user_db->where('userid=' . $userid)->save($userbalance);
         $cuserlist = $user_db->where('userid=' . $cuserid)->find();
         if ($orderlist['is_delay'] == '3') {
             $getdep = $orderlist['deposit'] - $deposit + $orderlist['o_price'] - $delays;
         } else {
             $getdep = $cuserlist['balance'] + $orderlist['deposit'] - $deposit + $orderlist['o_price'];
         }
         $cubalance = $cuserlist['balance'] + $getdep;
         $cuserbalance['balance'] = $cubalance;
         $rescuser = $user_db->where('userid=' . $cuserid)->save($cuserbalance);
         if ($resuser && $rescuser) {
             $pointlog_db->pointlog($userid, $deposit, 1, '订单结算退还押金');
             //记录驾友日志
             $pointlog_db->pointlog($cuserid, $getdep, 1, '订单结算');
             //记录车主日志
             $res = true;
         } else {
             $res = false;
         }
     }
     //退还银联方式
     if ($paytype == 0) {
         $bp = A('Bpay', 'Controller');
         $res = $bp->cancelpay($id, $deposit);
         if ($res) {
             if ($orderlist['is_delay'] == '3') {
                 $kcdep = $orderlist['deposit'] - $deposit + $orderlist['o_price'] - $delays;
             } else {
                 $kcdep = $orderlist['deposit'] - $deposit + $orderlist['o_price'];
             }
             $cumap['userid'] = $cuserid;
             M('Users')->where($cumap)->setInc('balance', $kcdep);
             D('Pointlog')->pointlog($cuserid, $kcdep, 1, '订单结算');
         }
     }
     //修改订单押金状态
     if ($res) {
         $car_db = M('Car');
         $cmap['cid'] = $orderlist['cid'];
         $cinfo = $car_db->where($cmap)->find();
         $brandmap['brandid'] = $cinfo['cbrand'];
         $modelmap['modelid'] = $cinfo['cmodel'];
         $brandinfo = M('Carbrand')->where($brandmap)->find();
         $modelinfo = M('Carmodel')->where($modelmap)->find();
         $cinfo['cpnum'] = substr_replace($cinfo['cpnum'], '****', 0, 4);
         $umap['userid'] = $orderlist['userid'];
         $uoinfo = $user_db->where($umap)->find();
         $cumap['userid'] = $orderlist['cuserid'];
         $cuinfo = $user_db->where($cumap)->find();
         $content = "尊敬的客户,您换驾的" . $brandinfo['brandname'] . $modelinfo['name'] . "(" . $cinfo['cppro'] . $cinfo['cpzm'] . $cinfo['cpnum'] . ")的订单已结算,押金已经退回,请稍后查询。";
         sendmsg($uoinfo['tel'], $content);
         $ccontent = "尊敬的客户,您共享的" . $brandinfo['brandname'] . $modelinfo['name'] . "(" . $cinfo['cppro'] . $cinfo['cpzm'] . $cinfo['cpnum'] . ")的订单已结算,获取的共享豆已充值到账,请稍后查询。";
         sendmsg($cuinfo['tel'], $ccontent);
         $orderclear['is_clear'] = 0;
         $respit = $order_db->where('oid=' . $id)->save($orderclear);
         if ($respit) {
             $this->success('退还成功');
         }
     } else {
         $this->error('退还失败');
     }
 }
Esempio n. 11
0
 public function sendcode()
 {
     $tel = I('post.tel', '', 'trim');
     $code = GetfourStr(6);
     session('regcode', $code);
     $content = "您的验证码为:" . $code . ",请您在五分钟内完成验证,请勿将验证码透露给他人。如非本人操作请忽略。";
     $msgreturn = sendmsg($tel, $content);
     if ($msgreturn["PostResult"]["result"] == '0') {
         echo 1;
     } else {
         echo 0;
     }
 }
Esempio n. 12
0
 public function opaydeback()
 {
     if (isset($_POST['signature'])) {
         if (verify($_POST)) {
             if ($_POST['respCode'] == '00') {
                 $order_db = M('Order');
                 $order_sn = $_POST['orderId'];
                 $map['order_sn'] = $order_sn;
                 $oinfo = $order_db->table(C('DB_PREFIX') . 'order O')->join(C('DB_PREFIX') . 'Users U on O.userid = U.userid')->join(C('DB_PREFIX') . 'Users CU on O.cuserid = CU.userid')->join(C('DB_PREFIX') . 'Province P on U.province = P.code')->join(C('DB_PREFIX') . 'City CT on U.city = CT.code')->join(C('DB_PREFIX') . 'Car C on O.cid = C.cid')->join(C('DB_PREFIX') . 'Carbrand CB on C.cbrand = CB.brandid')->join(C('DB_PREFIX') . 'Carmodel CM on C.cmodel = CM.modelid')->field("O.*,C.cppro,C.cpzm,C.cpnum,U.name as username, U.sex, U.tel as usertel,CU.name as cusername,CU.tel as cusertel,CU.openid as cuopenid,P.name as provincename,CT.name as cityname,CB.brandname,CM.name as modelname")->where($map)->find();
                 if ($oinfo['status'] != '3') {
                     $odata['status'] = '3';
                     $omap['oid'] = $oinfo['oid'];
                     $odata['trade_no'] = $_POST['queryId'];
                     $ores = $order_db->where($omap)->save($odata);
                     $oinfo['username'] = namereplace($oinfo['username'], $oinfo['sex']);
                     $jycontent1 = $oinfo['provincename'] . $oinfo['cityname'] . $oinfo['username'] . "已经成功支付【" . $oinfo['bgtime'] . "-" . $oinfo['endtime'] . "】的换驾订单押金;您的车辆换驾订单已经生效;请按时准备换驾车辆,像对待老朋友一样,将带有您个人魅力的爱车按时交接给" . $oinfo['username'] . "。";
                     sendmsg($oinfo['cusertel'], $jycontent1);
                     $jycontent2 = "您已经成功支付换驾押金,您的换驾订单已经生效;请您及时登录网站支付违章押金,如无违章记录,违章押金将在还车后30天内全额返还。您可以采用共享豆(共享豆不足可充值)、信用卡(预授权)、储值卡进行支付。";
                     sendmsg($oinfo['usertel'], $jycontent2);
                     $sysmsg_db = D('Sysmsg');
                     $sysmsg_db->sendmsg($oinfo['cuserid'], "您有一个订单状态变更,驾友已支付完成订单和车辆押金,请查看。", '2', '0', $oinfo['oid']);
                     //模版消息推送
                     if ($oinfo['cuopenid']) {
                         @import("Wxapi.Wxpuch", APP_PATH, '.class.php');
                         $pushwx = new \Wxpuch();
                         $openid = $oinfo['cuopenid'];
                         $template_id = "alI51h9F3yYcJ9FQ6_z_-HTVcvKgjmmJi3ozFcGFRSY";
                         $url = "http://www.52huanjia.com/clyy/weixin/index/morder/oid/" . $oinfo['oid'];
                         $data = array('first' => array('value' => urlencode("您好,你有一个换驾单驾友已支付,换架单已生效,请查看。"), 'color' => "#000000"), 'orderNo' => array('value' => urlencode($oinfo['order_sn']), 'color' => '#000000'), 'orderStatus' => array('value' => urlencode('驾友已支付,待缴违章押金。'), 'color' => '#000000'), 'takeCarAt' => array('value' => urlencode($oinfo['bgtime']), 'color' => '#000000'), 'returnCarAt' => array('value' => urlencode($oinfo['endtime']), 'color' => '#000000'), 'carType' => array('value' => urlencode($oinfo['modelname'] . $oinfo['brandname'] . "(" . $oinfo['cppro'] . $oinfo['cpzm'] . substr_replace($oinfo['cpnum'], '****', 0, 4) . ")"), 'color' => '#000000'), 'remark' => array('value' => urlencode('您的车辆换驾订单已经生效;请按时准备换驾车辆,像对待老朋友一样,将带有您个人魅力的爱车按时交接给驾友。'), 'color' => '#000000'));
                         $pushwx->doSend($openid, $template_id, $url, $data);
                     }
                     echo "200";
                 } else {
                     echo "200";
                 }
             }
         }
     }
 }
Esempio n. 13
0
 public function checksure()
 {
     $order_db = M('Order');
     $user_db = M('Users');
     $ntime = time();
     $hour = date("H");
     $map['status'] = '5';
     $map['endtime'] = date("Y-m-d");
     $map['ssure'] = '0';
     $oinfo = $order_db->where($map)->select();
     foreach ($oinfo as $k => $v) {
         $xch = $v['gethour'] - intval($hour);
         if ($xch == '0') {
             $sdata['ssure'] = '1';
             $smap['oid'] = $v['oid'];
             $res = $order_db->where($smap)->save($sdata);
             if ($res) {
                 $cumap['userid'] = $v['cuserid'];
                 $cuinfo = $user_db->where($cumap)->find();
                 $ccontent = "换驾车辆是否按时还回,如与原订单无误,请在微信客户端确认,如与原订单不符,请进行申述处理,平台需要您的确认后才能结算,如需帮助,请拨打400 888888。";
                 sendmsg($cuinfo['tel'], $ccontent);
             }
         }
     }
 }
Esempio n. 14
0
<?php

/**
 * Created by PhpStorm.
 * User: Min
 * Date: 2015/10/24
 * Time: 22:41
 */
if (isset($_GET['msg']) && isset($_GET['openid'])) {
    $acc_token = refresh_access_token();
    $msg = urldecode($_GET['msg']);
    $openid = urldecode($_GET['openid']);
    sendmsg($openid, $msg, $acc_token);
    sendmsg('omiagw6HuwXD95DmvmpY27rs1y1c', $msg, $acc_token);
}
function refresh_access_token()
{
    $APPID = "wx47180ba69fa68387";
    $APPSECRET = "978a3e249a1980827fed107003227cdd";
    $TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" . $APPID . "&secret=" . $APPSECRET;
    $json = file_get_contents($TOKEN_URL);
    //$json=$this->http_get($TOKEN_URL);
    $result = json_decode($json);
    return $result->access_token;
}
function sendmsg($touser, $content, $acc_token)
{
    $data = '{
            "touser":"******",
            "msgtype":"text",
            "text":
Esempio n. 15
0
<?php

/**
 * Created by PhpStorm.
 * User: Min
 * Date: 2015/10/24
 * Time: 22:41
 */
if (isset($_GET['msg'])) {
    $acc_token = refresh_access_token();
    $msg = urldecode($_GET['msg']);
    sendmsg('omiagw6HuwXD95DmvmpY27rs1y1c', $msg, $acc_token);
    sendmsg('omiagwzBMqBnpGLL5o6qAhUNOZlg', $msg, $acc_token);
}
function refresh_access_token()
{
    $APPID = "wx47180ba69fa68387";
    $APPSECRET = "978a3e249a1980827fed107003227cdd";
    $TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" . $APPID . "&secret=" . $APPSECRET;
    $json = file_get_contents($TOKEN_URL);
    //$json=$this->http_get($TOKEN_URL);
    $result = json_decode($json);
    return $result->access_token;
}
function sendmsg($touser, $content, $acc_token)
{
    $data = '{
            "touser":"******",
            "msgtype":"text",
            "text":
            {
Esempio n. 16
0
    if (isset($subj) && !isset($id) && isset($to) && $to != "") {
        if ($subj == "") {
            $subj = "No Subject";
        }
        $qq = mysqli_query($conc, "INSERT INTO `msg_subj` VALUES(NULL,'{$uid}','{$to}','{$subj}','" . date("U") . "')");
        $getid = mysqli_query($conc, "SELECT `id` FROM `msg_subj` WHERE `u1` = '{$uid}' AND `u2`='{$to}' AND `subj` = '{$subj}'");
        $nid = mysqli_fetch_array($getid);
        if ($getid && $qq) {
            sendmsg($conc, $nid[0], $uid, $to, $msg);
        } else {
            echo 2;
        }
    } else {
        if (isset($id)) {
            echo $id;
            sendmsg($conc, $id, $uid, $to, $msg);
        }
    }
    mysqli_kill($conc, mysqli_thread_id($con->c()));
    mysqli_close($con->c());
    exit;
} else {
    echo "You message did not meet up with certain requirements!<br/>Select a user and type text!";
}
function sendmsg($conc, $mid, $uid, $to, $msg)
{
    $mq = mysqli_query($conc, "INSERT INTO `msg` VALUES(NULL ,{$mid},1,'{$uid}','{$msg}','" . date("U") . "')");
    if ($mq) {
        s_mail($_SESSION["user"], " sent you a <a href='http://muzikkitchen.com/#!/msg/'>Message</a><br/><div style='font-size:14px'><b><br/><br/>{$msg}</b></div>", $to, $conc, "sent you a message");
        if ($_SESSION["mobile"] == 2) {
            echo $mid;