Ejemplo n.º 1
0
function TimingTask()
{
    // load urls
    $mysql = new SaeMysql();
    $sql = "SELECT url FROM `url`";
    $data = $mysql->getData( $sql );
    $mysql->closeDb();

    $queue = new SaeTaskQueue('task_queue_0_2');
    $array = array();
    for($i = 0; $i < sizeof($data); ++$i)
    {
        //$array[] = array('url'=>"http://urlwatcher.sinaapp.com/url_watch.php", "postdata"=>"target=".$data[$i], "prior"=>true);
        $array[] = array('url'=>"http://urlwatcher.sinaapp.com/url_watch.php?target=" . $data[$i]["url"], "postdata"=>NULL, "prior"=>true);
    }
    
    $queue->addTask($array);

    $ret = $queue->push();
    if ($ret === false)
    {
        var_dump($queue->errno(), $queue->errmsg());
        echo "Failed.";
    }
    else
    {    
        echo "Success.";
        print_r($array);
    }
}
Ejemplo n.º 2
0
function syncPhone($id, $oldPhone, $newPhone)
{
    $url = 'http://x.suzhoumaker.com/syncAction.php';
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, "oldPhone=" . $oldPhone . "&newPhone=" . $newPhone);
    // receive server response ...
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $server_output = curl_exec($ch);
    curl_close($ch);
    $syncAction = 3;
    // further processing ....
    $mysql = new SaeMysql();
    if ($server_output == "OK") {
        $syncAction = 0;
    }
    $sql = "UPDATE Member SET m_sync_action = " . $syncAction . ", m_updated_on=now() WHERE m_num=" . $id;
    $mysql->runSql($sql);
    if ($mysql->errno() != 0) {
        die("Error:" . $mysql->errmsg());
    } else {
        //
    }
    $mysql->closeDb();
}
Ejemplo n.º 3
0
function get_bookinfo()
{
    $mysql = new SaeMysql();
    if (!isset($_GET['campus'])) {
        $sql = "SELECT * FROM bookinfo";
        $data = $mysql->getData($sql);
        return $data;
    } else {
        $sql = "SELECT * FROM bookinfo WHERE campus = '" . $_GET['campus'] . "'";
        $data = $mysql->getData($sql);
        return $data;
    }
    $mysql->closeDb();
}
Ejemplo n.º 4
0
function check_admin()
{
    if (isset($_COOKIE["admin_id"]) && isset($_COOKIE["admin_username"]) && isset($_COOKIE["admin_key"])) {
        $id = intval($_COOKIE["admin_id"]);
        $mysql = new SaeMysql();
        $sql = "select * from `qs_admin` where `id`={$id}";
        $row = $mysql->getLine($sql);
        $mysql->closeDb();
        if (3 == count($row)) {
            $admin_username = $row["username"];
            $admin_key = md5($row["password"] . $admin_username);
            if ($_COOKIE["admin_key"] == $admin_key) {
                return true;
            } else {
                return false;
            }
        } else {
            return false;
        }
    } else {
        return false;
    }
}
Ejemplo n.º 5
0
 private function receiveText($obj)
 {
     $keyword = trim($obj->Content);
     if (is_numeric($keyword) && $keyword >= 100 && $keyword < 200) {
         /*
         $callUri ="http://duplicall.eicp.net:8088/rs/smarttap/calls/info?maxResults=10&sortField=startTime&sortOrder=DESC&targetId=".$keyword;
         $credentials = "admin:admin";
         		
         $ch = curl_init();
         curl_setopt($ch,CURLOPT_URL,$SWXurl);
         curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,FALSE);
         curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,FALSE);
         curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
         curl_setopt($ch, CURLOPT_USERPWD, $credentials);
         curl_setopt($ch,CURLOPT_HTTPHEADER,array("Accept: application/json"));
         curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
         $output = curl_exec($ch);
         curl_close($ch);	
         */
         //$content ="您发送的是数字文本:" . $keyword;
         $smcValue = SaeMemCache_get($obj->FromUserName . "key");
         $content = $smcValue;
         $result = $this->transmitText($obj, $content);
         //if (SaeMemCache_get($obj->FromUserName."key",$obj->FromUserName."Recording");
     } else {
         switch (strtolower($keyword)) {
             case "id":
                 $access_token = get_Access_Token();
                 $result = $this->transmitText($obj, "Access_Token: " . $access_token);
                 break;
             case "61":
                 $CC = new CCInterface();
                 $CC->SendMsg($obj->FromUserName, "【DC测试】六一节快乐 ");
                 break;
             case "users":
                 $SWXurl = "http://duplicall.eicp.net:8088/rs/smarttap/users/info";
                 $credentials = "admin:admin";
                 $ch = curl_init();
                 curl_setopt($ch, CURLOPT_URL, $SWXurl);
                 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
                 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
                 curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
                 curl_setopt($ch, CURLOPT_USERPWD, $credentials);
                 curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept: application/json"));
                 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                 $output = curl_exec($ch);
                 curl_close($ch);
                 $retArray = json_decode($output, true);
                 $userArray = $retArray['usersInfo'];
                 usort($userArray, function ($a, $b) {
                     if ($a["id"] == $b["id"]) {
                         return 0;
                     }
                     return $a["id"] < $b["id"] ? -1 : 1;
                 });
                 foreach ($userArray as $user) {
                     //$content .= $user["uri"]."|".$user["id"]."|".$user["displayName"]."|".$user["disabled"]."|".$user["firstName"]."|".$user["lastName"]."|".$user["emailAddress"]."|".$user["alias"]."|".$user["loginId"]."\n";
                     $content .= $user["id"] . ":" . $user["firstName"] . "," . $user["lastName"] . "\n";
                 }
                 $result = $this->transmitText($obj, $content);
                 break;
             case "code":
                 $appid = APPID;
                 $redirect_uri = REDIRECT_URI;
                 $auth_url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" . $appid . "&redirect_uri=" . $redirect_uri . "&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirect";
                 $content = 'DupliCALL UCenter Oauth2.0 <a href="' . $auth_url . '">点击这里进行授权</a>';
                 $result = $this->transmitText($obj, $content);
                 break;
             case "auth":
                 $appid = APPID;
                 $appsecret = APPSECRET;
                 $mysql = new SaeMysql();
                 $sql = "SELECT * FROM `gParameters` WHERE `name` ='gAuthCode'";
                 $data = $mysql->getLine($sql);
                 $authCode = $data["Value"];
                 $mysql->closeDb();
                 $url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=" . $appid . "&secret=" . $appsecret . "&code=" . $authCode . "&grant_type=authorization_code";
                 $result1 = https_request($url);
                 $jsoninfo = json_decode($result1, true);
                 $authAccessToken = $jsoninfo["access_token"];
                 $authRefreshToken = $jsoninfo["refresh_token"];
                 $authOpenId = $jsoninfo["openid"];
                 $authScope = $jsoninfo["scope"];
                 $userinfo_url = "https://api.weixin.qq.com/sns/userinfo?access_token=" . $authAccessToken . "&openid=" . $authOpenId;
                 $userinfo_json = https_request($userinfo_url);
                 $userinfo_array = json_decode($userinfo_json, true);
                 $userOpenid = $userinfo_array["openid"];
                 $userNickname = $userinfo_array["nickname"];
                 if ($userinfo_array["sex"] == 1) {
                     $userSex = "先生";
                 } else {
                     $userSex = "女士";
                 }
                 $userLanguage = $userinfo_array["language"];
                 $userCity = $userinfo_array["city"];
                 $userProvince = $userinfo_array["province"];
                 $userCountry = $userinfo_array["country"];
                 $userImg = $userinfo_array["headimgurl"];
                 $content1 = "OpenId : " . $userOpenid . "\n Nickname : " . $userNickname . "\n Sex : " . $userSex . "\n Language : " . $userLanguage . "\n Location : " . $userCountry . "/" . $userProvince . "/" . $userCity . "\n";
                 //$content .= '<img src="'. $userImg.'" >';
                 $content[] = array("Title" => $userNickname, "Description" => $content1, "PicUrl" => $userImg);
                 $result = $this->transmitNews($obj, $content);
                 break;
             case "文本":
             case "text":
                 $content = "欢迎参加DupliCALL公众号测试|Welcome to join the test of DupliCALL's Public WX Account";
                 $result = $this->transmitText($obj, $content);
                 break;
             case "音乐":
             case "music":
                 $content = array("Title" => "最美", "Description" => "歌手:羽泉", "MusicUrl" => "http://duplicall.eicp.net:3476/0111.mp3", "HQMusicUrl" => "http://duplicall.eicp.net:3476/0111.mp3");
                 $result = $this->transmitMusic($obj, $content);
                 break;
             case "图文":
             case "单图文":
                 $content = array();
                 $content[] = array("Title" => "DupliCALL 公司介绍", "Description" => "Full-Time Lync Recorder", "PicUrl" => "http://www.ai-logix.com.cn/eng/images/logos/smartworks_box_logo-s.jpg", "Url" => "http://www.ai-logix.com.cn/chs/products.htm");
                 $result = $this->transmitNews($obj, $content);
                 break;
             case "多图文":
                 $content = array();
                 $content[] = array("Title" => "DupliCALL技术支持", "Description" => "在线技术支持", "PicUrl" => "http://www.ai-logix.com.cn/chs/images/support_box.jpg", "Url" => "http://www.ai-logix.com.cn/chs/support.htm");
                 $content[] = array("Title" => "产品资料下载", "Description" => "", "PicUrl" => "http://www.ai-logix.com.cn/chs/images/companypage_banner_large.jpg", "Url" => "http://www.ai-logix.com.cn/chs/support-down-smartworks.htm");
                 $content[] = array("Title" => "Skype在线通话技术支持", "Description" => "使用Skype在线互联网电话软件", "PicUrl" => "http://www.ai-logix.com.cn/chs/images/support.jpg", "Url" => "http://www.ai-logix.com.cn/chs/support-skype.htm");
                 $content[] = array("Title" => "FAQ技术问答", "Description" => "使用Skype在线互联网电话软件", "PicUrl" => "http://www.ai-logix.com.cn/chs/images/solutions_box.jpg", "Url" => "http://www.ai-logix.com.cn/chs/support-down-faq.htm");
                 $result = $this->transmitNews($obj, $content);
                 break;
             default:
                 $content = "您发送的是文本消息,内容如下:" . $keyword;
                 $result = $this->transmitText($obj, $content);
         }
     }
     return $result;
 }
Ejemplo n.º 6
0
<?php

$lvyi_db = new SaeMysql();
//install
$sql = file_get_contents('./db.sql');
//do
runquery($sql);
//report
if ($lvyi_db->errno() != 0) {
    die("Error:" . $lvyi_db->errmsg());
}
$lvyi_db->closeDb();
//include success template
function runquery($sql)
{
    global $lvyi_db;
    $sql = str_replace("\r", "\n", $sql);
    $ret = array();
    $num = 0;
    foreach (explode(";\n", trim($sql)) as $query) {
        $queries = explode("\n", trim($query));
        foreach ($queries as $query) {
            $ret[$num] .= $query[0] == '#' || $query[0] . $query[1] == '--' ? '' : $query;
        }
        $num++;
    }
    unset($sql);
    $strtip = "";
    foreach ($ret as $query) {
        $query = trim($query);
        if ($query) {
Ejemplo n.º 7
0
 static function RunSaeSql($sql)
 {
     $mysql = new SaeMysql();
     self::$result_str = $sql;
     $mysql->runSql($sql);
     $mysql->closeDb();
 }
Ejemplo n.º 8
0
 private function receiveText($object)
 {
     $mem = memcache_init();
     $userid_fback = $mem->get($object->FromUserName . "fbkey");
     $userid_view = $mem->get($object->FromUserName . "viewkey");
     if ($object->FromUserName . "fback" == $userid_fback) {
         $mysql = new SaeMysql();
         $sql = "INSERT  INTO `tb_feedback` ( `userid`, `time`, `content`) VALUES ('" . $object->FromUserName . "',NOW(),'" . $object->Content . "')";
         $mysql->runSql($sql);
         $mysql->closeDb();
         $content = "谢谢反馈";
         $result = $this->transmitText($object, $content);
         $mem->delete($object->FromUserName . "fbkey");
     } else {
         if ($object->FromUserName . "view" == $userid_view) {
             $num = $object->Content;
             $sql = "SELECT * FROM `tb_exhibit` WHERE number = " . $num;
             $mysql = new SaeMysql();
             $result = $mysql->getLine($sql);
             $mysql->closeDb();
             $content = array();
             $content[] = array("Title" => $result['title'], "Description" => $result['description'], "PicUrl" => $result['picurl'], "Url" => "");
             $result = $this->transmitNews($object, $content);
             $mem->delete($object->FromUserName . "viewkey");
             return $result;
         } else {
             $keyword = $object->Content;
             $url = "http://www.tuling123.com/openapi/api?key=1dfd7a09ee0aafd4eb7b243a470f8657&info=" . $keyword;
             $res = file_get_contents($url);
             $resjson = json_decode($res);
             $content = $resjson->text;
             $result = $this->transmitText($object, $content);
         }
     }
     return $result;
 }
Ejemplo n.º 9
0
 public function saveping($source, $destination, $min, $avg, $max, $loss)
 {
     $mysql = new SaeMysql();
     $sql = "INSERT INTO `ping` (`source`, `destination`, `min`, `avg`, `max`, `loss`, `time`)" . " VALUES ('" . $mysql->escape($source) . "', '" . $mysql->escape($destination) . "', " . $min . ", " . $avg . ", " . $max . ", " . $loss . ", NOW())";
     $mysql->runSql($sql);
     if ($mysql->errno() != 0) {
         log_message('error', "MySQL Error: " . $mysql->errmsg());
         //die( "Error: " . $mysql->errmsg() );
         die($sql);
     }
     $mysql->closeDb();
 }
Ejemplo n.º 10
0
 public function responseMsg()
 {
     //get post data, May be due to the different environments
     $postStr = $GLOBALS["HTTP_RAW_POST_DATA"];
     //extract post data
     if (!empty($postStr)) {
         /* libxml_disable_entity_loader is to prevent XML eXternal Entity Injection,
            the best way is to check the validity of xml by yourself */
         libxml_disable_entity_loader(true);
         $postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);
         $fromUsername = $postObj->FromUserName;
         $toUsername = $postObj->ToUserName;
         $type = $postObj->MsgType;
         $customevent = $postObj->Event;
         $latitude = $postObj->Location_X;
         //获取纬度
         $longitude = $postObj->Location_Y;
         //获取经度
         $label = $postObj->Label;
         //获取地理信息
         $voice = $postObj->Recognition;
         //为语音识别结果
         $keyword = trim($postObj->Content);
         $time = time();
         $picurl = $postObj->PicUrl;
         //图片链接
         $textTpl = "<xml>\n\t\t\t\t\t\t\t<ToUserName><![CDATA[%s]]></ToUserName>\n\t\t\t\t\t\t\t<FromUserName><![CDATA[%s]]></FromUserName>\n\t\t\t\t\t\t\t<CreateTime>%s</CreateTime>\n\t\t\t\t\t\t\t<MsgType><![CDATA[%s]]></MsgType>\n\t\t\t\t\t\t\t<Content><![CDATA[%s]]></Content>\n\t\t\t\t\t\t\t<FuncFlag>0</FuncFlag>\n\t\t\t\t\t\t\t</xml>";
         $newTpl = "<xml>\n\t\t\t\t\t\t\t<ToUserName><![CDATA[%s]]></ToUserName>\n\t\t\t\t\t\t\t<FromUserName><![CDATA[%s]]></FromUserName>\n\t\t\t\t\t\t\t<CreateTime>%s</CreateTime>\n\t\t\t\t\t\t\t<MsgType><![CDATA[news]]></MsgType>\n\t\t\t\t\t\t\t<ArticleCount>1</ArticleCount>\n\t\t\t\t\t\t\t<Articles>\n\t\t\t\t\t\t\t<item>\n\t\t\t\t\t\t\t<Title><![CDATA[%s]]></Title>\n\t\t\t\t\t\t\t<Description><![CDATA[%s]]></Description>\n\t\t\t\t\t\t\t<PicUrl><![CDATA[%s]]></PicUrl>\n\t\t\t\t\t\t\t<Url><![CDATA[%s]]></Url>\t\n\t\t\t\t\t\t\t</item>\n\t\t\t\t\t\t\t<FuncFlag>0</FuncFlag>\n\t\t\t\t\t\t\t</Articles>\n\t\t\t\t\t\t\t</xml>";
         $linkTP = "<xml>\n\t\t\t\t\t\t\t<ToUserName><![CDATA[%s]]></ToUserName>\n\t\t\t\t\t\t\t<FromUserName><![CDATA[%s]]></FromUserName>\n\t\t\t\t\t\t\t<CreateTime>%s</CreateTime>\n\t\t\t\t\t\t\t<MsgType><![CDATA[event]]></MsgType>\n\t\t\t\t\t\t\t<Event><![CDATA[VIEW]]></Event>\n\t\t\t\t\t\t\t<EventKey><![CDATA[http://yijianchelian.sinaapp.com/about.html/]]></EventKey>\n\t\t\t\t\t\t\t</xml> ";
         $picTP = "<xml>\n\t\t\t\t\t\t\t <ToUserName><![CDATA[%s]]></ToUserName>\n\t\t\t\t\t\t\t <FromUserName><![CDATA[%s]]></FromUserName>\n\t\t\t\t\t\t\t <CreateTime>%s</CreateTime>\n\t\t\t\t\t\t\t <MsgType><![CDATA[image]]></MsgType>\n\t\t\t\t\t\t\t <PicUrl><![CDATA[%s]]></PicUrl>\n\t\t\t\t\t\t\t <MediaId><![CDATA[media_id]]></MediaId>\n\t\t\t\t\t\t\t <MsgId>1234567890123456</MsgId>\n\t\t\t\t\t\t\t </xml>";
         // 连主库
         $link = mysql_connect(SAE_MYSQL_HOST_M . ':' . SAE_MYSQL_PORT, SAE_MYSQL_USER, SAE_MYSQL_PASS);
         // 连从库
         // $link=mysql_connect(SAE_MYSQL_HOST_S.':'.SAE_MYSQL_PORT,SAE_MYSQL_USER,SAE_MYSQL_PASS);
         if (!$link) {
             die("Connect Server Failed: " . mysql_error());
             $contentStr = "连接错误";
             $msgType = "text";
             $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);
         } else {
             mysql_select_db(SAE_MYSQL_DB, $link);
             //your code goes here
             $mysql = new SaeMysql();
             //$sql = "SELECT * FROM `user` LIMIT 10";
             //$data = $mysql->getData( $sql );
             //$name = strip_tags( $_REQUEST['name'] );
             //$age = intval( $_REQUEST['age'] );
             //$sql = "INSERT  INTO `user` ( `name`, `age`, `regtime`) VALUES ('"  . $mysql->escape( $name ) . "' , '" . intval( $age ) . "' , NOW() ) ";
             $sql = "SELECT * FROM devConnect WHERE qq ='{$fromUsername}' ";
             $query = mysql_query($sql);
             //执行sql语句
             $num_row = mysql_num_rows($query);
             //$rs=mysql_fetch_array($query);
             $devID = array();
             //print_r($rs);
             $i = 0;
             while ($rs = mysql_fetch_array($query)) {
                 //echo $num_row--;
                 //$devID[i]=$row->devID."<br/>";
                 echo "i=" . $i;
                 echo $result_devID[$i] = $rs['devID'];
                 echo $result_qq[$i] = $rs['qq'];
                 $i++;
             }
             //$QQ=$rs['qq'];
             $QQ = $result_qq[0];
             echo $i;
             if (!strcmp($QQ, $fromUsername)) {
                 /*****************绑定设备功能*********************/
                 switch ($type) {
                     case "voice":
                         //$contentStr=$voice;
                         $contentStr = $this->dealVoice($voice);
                         $msgType = "text";
                         $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);
                         break;
                     case "link":
                         $contentStr = "功能完善中";
                         $msgType = "text";
                         $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);
                         break;
                     case "shortvideo":
                         $contentStr = "功能完善中";
                         $msgType = "text";
                         $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);
                         break;
                     case "location":
                         //JPush 功能
                         //JPUSH应用
                         $br = '<br/>';
                         $app_key = 'ad2add0d7bafaab683ca3b16';
                         $master_secret = '2009611fff8213ed1bd0c3a6';
                         // 初始化
                         $client = new JPush($app_key, $master_secret);
                         // 简单推送示例
                         $result = $client->push()->setPlatform('all')->addAllAudience()->setNotificationAlert("导航到" . "{$label}")->send();
                         echo 'test Result=' . json_encode($result) . $br;
                         $app_key = '5f1e36080805488ab8f22631';
                         $master_secret = '2bd1c368081d8ad860afb867';
                         // 初始化
                         $client = new JPush($app_key, $master_secret);
                         // 简单推送示例
                         $result = $client->push()->setPlatform('all')->addAllAudience()->setNotificationAlert("导航到" . "{$label}")->send();
                         echo 'jpush Result=' . json_encode($result) . $br;
                         $contentStr = "位置已发送,如果长时间未收到,可能是网络原因,请重试!";
                         $msgType = "text";
                         $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);
                         break;
                     case "image":
                         $picTP = "<xml>\n\t\t\t\t\t\t <ToUserName><![CDATA[%s]]></ToUserName>\n\t\t\t\t\t\t <FromUserName><![CDATA[%s]]></FromUserName>\n\t\t\t\t\t\t <CreateTime>%s</CreateTime>\n\t\t\t\t\t\t <MsgType><![CDATA[image]]></MsgType>\n\t\t\t\t\t\t <PicUrl><![CDATA[%s]]></PicUrl>\n\t\t\t\t\t\t <MediaId><![CDATA[media_id]]></MediaId>\n\t\t\t\t\t\t <MsgId>1234567890123456</MsgId>\n\t\t\t\t\t\t </xml>";
                         $contentStr = $picurl;
                         $msgType = "text";
                         //$resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);
                         $resultStr = sprintf($picTP, $fromUsername, $toUsername, $time, $picurl);
                         break;
                     case "event":
                         if ($customevent == "subscribe") {
                             $contentStr = "感谢你的关注" . $postObj->EventKey;
                             $msgType = "text";
                             $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);
                         } else {
                             if ($customevent == "CLICK") {
                                 //$contentStr = "event";
                                 switch ($postObj->EventKey) {
                                     case "about":
                                         $title = "易见联";
                                         $description = "访问易见联网站";
                                         $picUrl = "http://yijianchelian.sinaapp.com/source/view.jpg";
                                         $url = "yijianchelian.sinaapp.com/html/about.html";
                                         $resultStr = sprintf($newTpl, $fromUsername, $toUsername, $time, $title, $description, $picUrl, $url);
                                         break;
                                     case "mycarplace":
                                         $contentStr = "设备  " . "      位置";
                                         for ($num = 0; $num < $i; $num++) {
                                             //i为当前账号绑定的设备数
                                             $sql = "SELECT * FROM deviceInfo WHERE devID ='{$result_devID[$num]}' ";
                                             $query = mysql_query($sql);
                                             //执行sql语句
                                             $rs_info = mysql_fetch_array($query);
                                             $ret_devAddr = $rs_info['devAddree'];
                                             if (!$ret_devAddr) {
                                                 $ret_devAddr = "无地址信息";
                                             }
                                             $contentStr = $contentStr . "\n" . $result_devID[$num] . ":    " . $ret_devAddr;
                                         }
                                         $msgType = "text";
                                         $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);
                                         break;
                                     case "navigation":
                                         $contentStr = '请发送要导航的位置信息。或者发送"导航到**",例如:导航到深圳大学';
                                         $msgType = "text";
                                         $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);
                                         break;
                                     case "person":
                                         $contentStr = '请发送被接人的位置信息。或者发送"导航到**",例如:导航到深圳大学';
                                         $msgType = "text";
                                         $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);
                                         break;
                                     case "devicemanagement":
                                         $title = "设备管理";
                                         $description = "进入管理界面";
                                         $picUrl = "http://yijianchelian.sinaapp.com/source/devicemanagement.jpg";
                                         $url = "http://yijianchelian.sinaapp.com/html/devicemanagement.php?qq={$fromUsername}";
                                         $resultStr = sprintf($newTpl, $fromUsername, $toUsername, $time, $title, $description, $picUrl, $url);
                                         break;
                                     case "menu_register":
                                         $sql = "insert into devRegister(time,qq) values(now(),'{$fromUsername}')";
                                         //加入注册表
                                         $query = mysql_query($sql);
                                         //执行sql语句
                                         if (!$query) {
                                             die("insert into Sheet1: " . mysql_error());
                                         }
                                         $contentStr = "请输入你的设备号";
                                         $msgType = "text";
                                         $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);
                                         break;
                                     case "mycarview":
                                         //视频回放
                                         $title = "远程视频";
                                         $description = "请点开击查看视频";
                                         $picUrl = "http://yijianchelian.sinaapp.com/source/view.jpg";
                                         $url = "yijianchelian.sinaapp.com/html/mycarview.html";
                                         $resultStr = sprintf($newTpl, $fromUsername, $toUsername, $time, $title, $description, $picUrl, $url);
                                         break;
                                     case "mycarblack":
                                         //轨迹回放
                                         $title = "轨迹回放";
                                         $description = "请点开击回放轨迹";
                                         $picUrl = "http://yijianchelian.sinaapp.com/source/jinyuanshawudasha.jpg";
                                         $url = "yijianchelian.sinaapp.com/html/ditu.php";
                                         $resultStr = sprintf($newTpl, $fromUsername, $toUsername, $time, $title, $description, $picUrl, $url);
                                         break;
                                     default:
                                         $contentStr = "功能完善中";
                                         $msgType = "text";
                                         $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);
                                         break;
                                 }
                             } else {
                                 if ($customevent == "SCAN") {
                                     //扫描关注事件
                                     $sql = "SELECT * FROM devConnect WHERE user='******' ";
                                     //判断有无此设备
                                     $query = mysql_query($sql);
                                     //执行sql语句
                                     if (!$query) {
                                         die("insert into Sheet1: " . mysql_error());
                                     }
                                     $rs = mysql_fetch_array($query);
                                     $USER = $rs['user'];
                                     //设备号
                                     //	$dev=$rs['qq'];
                                     //	if(!$dev){
                                     if ($USER == $postObj->EventKey) {
                                         //有此设备
                                         $sql = "update devConnect set qq='{$fromUsername}' where user={$postObj->EventKey}";
                                         //绑定设备
                                         $query = mysql_query($sql);
                                         //执行sql语句
                                         $contentStr = "设备绑定成功" . $postObj->EventKey;
                                         if (!$query) {
                                             die("update devConnect: " . mysql_error());
                                             $contentStr = "设备绑定失败,请重新绑定";
                                         }
                                         $msgType = "text";
                                         $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);
                                     } else {
                                         $contentStr = "绑定失败,请重新绑定";
                                         //$contentStr=$err;
                                         $msgType = "text";
                                         $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);
                                     }
                                 }
                             }
                         }
                         break;
                     case "action":
                         /*****
                         			<xml>   
                         			<ToUserName><![CDATA[gh_204936aea56d]]></ToUserName>  
                         			<FromUserName><![CDATA[oF-YDuPUhZPhm3NfRwF2Gj1Coyd8]]></FromUserName> 
                         			<CreateTime>1452482277</CreateTime>
                         			<MsgType><![CDATA[action]]></MsgType>							
                         			<DevId><![CDATA[11112222333334444555]]></DevId>  
                         			<Content><![CDATA[金源商务大厦]]></Content> 
                         			<MsgId>1234567890abcdef</MsgId>
                         			</xml>
                         			****/
                         $devAddr = $postObj->Content;
                         $devID = $postObj->DevId;
                         $sql = "SELECT * FROM deviceInfo WHERE devID ='{$devID}' ";
                         $query = mysql_query($sql);
                         //执行sql语句
                         if (!$query) {
                             die("SELECT * FROM deviceInfo: " . mysql_error());
                             $contentStr = "SELECT * FROM deviceInfo 失败";
                         } else {
                             $rs = mysql_fetch_array($query);
                             $ret = $rs['devID'];
                             //设备号
                             if ($ret != 0) {
                                 $rs = mysql_fetch_array($query);
                                 $sql = "update deviceInfo set devAddree='{$devAddr}' where devID ='{$devID}'";
                                 //绑定设备
                                 //$sql = "update deviceInfo set devAddree='西乡站d55出站口' where devID ='1111222233334444555'";//绑定设备
                                 $query = mysql_query($sql);
                                 //执行sql语句
                                 if (!$query) {
                                     die("update deviceInfo: " . mysql_error());
                                     $contentStr = "更新地址失败.";
                                 } else {
                                     $contentStr = "更新地址成功.";
                                 }
                             } else {
                                 $contentStr = "没有那个设备号";
                             }
                         }
                         $msgType = "text";
                         $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);
                         break;
                     case "text":
                         //$navWord = substr($keyword,0,3);
                         $navWord = mb_substr($keyword, 0, 3, 'utf-8');
                         $sql0 = "SELECT * FROM devRegister WHERE qq='{$fromUsername}' ";
                         //判断是否要绑定
                         $query0 = mysql_query($sql0);
                         //执行sql语句
                         if (!$query0) {
                             die("SELECT * FROM devRegister: " . mysql_error());
                         }
                         $rs0 = mysql_fetch_array($query0);
                         $USER = $rs0['qq'];
                         if ($navWord == "导航到") {
                             $contentStr = $this->dealVoice($keyword);
                             //发送导航信息
                             if ($USER == $fromUsername) {
                                 $sql0 = "delete FROM devRegister WHERE qq='{$fromUsername}' ";
                                 //
                                 $query0 = mysql_query($sql0);
                                 //执行sql语句
                                 if (!$query0) {
                                     die("delete * FROM devRegister: " . mysql_error());
                                 }
                             }
                             $msgType = "text";
                             $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);
                         } else {
                             if ($keyword == "天气") {
                                 $contentStr = $this->dealWeather();
                                 if ($USER == $fromUsername) {
                                     $sql0 = "delete FROM devRegister WHERE qq='{$fromUsername}' ";
                                     //
                                     $query0 = mysql_query($sql0);
                                     //执行sql语句
                                     if (!$query0) {
                                         die("delete * FROM devRegister: " . mysql_error());
                                     }
                                 }
                                 $msgType = "text";
                                 $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);
                             } else {
                                 if ($USER == $fromUsername) {
                                     //绑定操作
                                     $sql = "SELECT * FROM devConnect WHERE devID='{$keyword}' ";
                                     //判断有无此设备
                                     $query = mysql_query($sql);
                                     //执行sql语句
                                     if (!$query) {
                                         die("SELECT * FROM devConnect: " . mysql_error());
                                     }
                                     $rs = mysql_fetch_array($query);
                                     $USER = $rs['devID'];
                                     if ($USER == $keyword) {
                                         //有此设备
                                         $sql = "update devConnect set qq='{$fromUsername}' where devID={$USER}";
                                         //绑定设备
                                         $query = mysql_query($sql);
                                         //执行sql语句
                                         if (!$query) {
                                             die("update devConnect: " . mysql_error());
                                             $contentStr = "设备绑定失败,请重新绑定";
                                         } else {
                                             $contentStr = "设备绑定成功";
                                         }
                                         $msgType = "text";
                                         $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);
                                     } else {
                                         $contentStr = "设备绑定失败,请重新绑定";
                                         $msgType = "text";
                                         $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);
                                     }
                                     $sql0 = "delete FROM devRegister WHERE qq='{$fromUsername}' ";
                                     //
                                     $query0 = mysql_query($sql0);
                                     //执行sql语句
                                     if (!$query0) {
                                         die("delete * FROM devRegister: " . mysql_error());
                                     }
                                 } else {
                                     $contentStr = $this->baiduFanyi($keyword);
                                     $msgType = "text";
                                     $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);
                                 }
                             }
                         }
                         break;
                     default:
                         if (!empty($keyword)) {
                         } else {
                             echo "Input something...";
                         }
                 }
                 //switch_end
             } else {
                 /*******************未注册设备******************/
                 //$sql = "insert into Sheet1(BM) values('{$fromUsername}')";
                 //$query=mysql_query( $sql );//执行sql语句
                 //die("insert into Sheet1: " . mysql_error());
                 switch ($type) {
                     case "event":
                         $contentStr = "event0\n";
                         if ($customevent == "subscribe") {
                             $contentStr = "感谢你的关注\n请绑定设备" . $postObj->EventKey;
                             if ($postObj->EventKey) {
                                 //绑定设备
                                 $rest = substr($postObj->EventKey, 8, strlen($postObj->EventKey) - 8);
                                 $sql = "SELECT * FROM devConnect WHERE user='******' ";
                                 //判断有无此设备
                                 $query = mysql_query($sql);
                                 //执行sql语句
                                 if (!$query) {
                                     die("insert into Sheet1: " . mysql_error());
                                 }
                                 $rs = mysql_fetch_array($query);
                                 $USER = $rs['user'];
                                 if ($USER == $rest) {
                                     //有此设备
                                     $sql = "update devConnect set qq='{$fromUsername}' where user={$USER}";
                                     //绑定设备
                                     $query = mysql_query($sql);
                                     //执行sql语句
                                     $contentStr = "感谢你的关注\n设备绑定成功";
                                     if (!$query) {
                                         die("update devConnect: " . mysql_error());
                                         $contentStr = "感谢你的关注\n设备绑定失败,请重新注册";
                                     }
                                     $msgType = "text";
                                     $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);
                                 } else {
                                     $contentStr = "感谢你的关注\n绑定失败,请重新注册";
                                     $msgType = "text";
                                     $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);
                                 }
                             }
                             $msgType = "text";
                             $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);
                         } else {
                             if ($customevent == "CLICK") {
                                 //$contentStr = "event";
                                 switch ($postObj->EventKey) {
                                     case "menu_register":
                                         $sql = "insert into devRegister(time,qq) values(now(),'{$fromUsername}')";
                                         //判断有无此设备
                                         $query = mysql_query($sql);
                                         //执行sql语句
                                         if (!$query) {
                                             die("insert into Sheet1: " . mysql_error());
                                         }
                                         $contentStr = "请输入你的设备号";
                                         $msgType = "text";
                                         $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);
                                         break;
                                     default:
                                         $contentStr = "******" . "欢迎新朋友\n请绑定设备";
                                         $msgType = "text";
                                         $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);
                                         break;
                                 }
                             } else {
                                 if ($customevent == "SCAN") {
                                     //$postObj->EventKey = substr($postObj->EventKey, 8, strlen($postObj->EventKey)-8);
                                     $sql = "SELECT * FROM devConnect WHERE user='******' ";
                                     //判断有无此设备
                                     $query = mysql_query($sql);
                                     //执行sql语句
                                     if (!$query) {
                                         die("insert into Sheet1: " . mysql_error());
                                     }
                                     $rs = mysql_fetch_array($query);
                                     $USER = $rs['user'];
                                     //设备号
                                     if ($USER == $postObj->EventKey) {
                                         //有此设备
                                         $sql = "update devConnect set qq='{$fromUsername}' where user={$postObj->EventKey}";
                                         //绑定设备
                                         $query = mysql_query($sql);
                                         //执行sql语句
                                         $contentStr = "设备绑定成功" . $postObj->EventKey;
                                         if (!$query) {
                                             die("update devConnect: " . mysql_error());
                                             $contentStr = "设备绑定失败,请重新绑定";
                                         }
                                         $msgType = "text";
                                         $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);
                                     } else {
                                         $contentStr = "绑定失败,请重新绑定";
                                         $msgType = "text";
                                         $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);
                                     }
                                 }
                             }
                         }
                         break;
                     default:
                         $sql0 = "SELECT * FROM devRegister WHERE qq='{$fromUsername}' ";
                         //判断是否要绑定
                         $query0 = mysql_query($sql0);
                         //执行sql语句
                         if (!$query0) {
                             die("SELECT * FROM devRegister: " . mysql_error());
                         }
                         $rs0 = mysql_fetch_array($query0);
                         $USER = $rs0['qq'];
                         if ($USER == $fromUsername) {
                             //绑定操作
                             $sql = "SELECT * FROM devConnect WHERE devID='{$keyword}' ";
                             //判断有无此设备
                             $query = mysql_query($sql);
                             //执行sql语句
                             if (!$query) {
                                 die("SELECT * FROM devConnect: " . mysql_error());
                             }
                             $rs = mysql_fetch_array($query);
                             $USER = $rs['devID'];
                             if ($USER == $keyword) {
                                 //有此设备
                                 $sql = "update devConnect set qq='{$fromUsername}' where devID={$USER}";
                                 //绑定设备
                                 $query = mysql_query($sql);
                                 //执行sql语句
                                 if (!$query) {
                                     die("update devConnect: " . mysql_error());
                                     $contentStr = "设备绑定失败,请重新绑定";
                                 } else {
                                     $contentStr = "设备绑定成功";
                                 }
                                 $msgType = "text";
                                 $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);
                             } else {
                                 $contentStr = "设备绑定失败,请重新绑定";
                                 $msgType = "text";
                                 $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);
                             }
                             $sql0 = "delete FROM devRegister WHERE qq='{$fromUsername}' ";
                             //判断是否要绑定
                             $query0 = mysql_query($sql0);
                             //执行sql语句
                             if (!$query0) {
                                 die("delete * FROM devRegister: " . mysql_error());
                             }
                         } else {
                             $contentStr = "******" . "欢迎新朋友\n请绑定设备";
                             $msgType = "text";
                             $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);
                         }
                         break;
                 }
             }
             $mysql->closeDb();
         }
         echo $resultStr;
     } else {
         echo "";
         exit;
     }
 }
Ejemplo n.º 11
0
	public function update(){
		$query = "update toupiao set {$this->pingwei} = {$this->score} where keshi_name = '{$this->jiemu}'";
		//echo $query;
		$mysql = new SaeMysql();
		$query_submit = "select didSubmit from score_pingwei where score like '{$this->pingwei}'";
		$resultOfQuery_submit = $mysql->getData($query_submit);
		//var_dump($this->pingwei);
		//var_dump($resultOfQuery_submit);
		if ($resultOfQuery_submit[0]["didSubmit"] > 1 || ($this -> score>100)|| ($this -> score<75)) {
			# code...

			$this->show_error();
			
		}else{
			

			$mysql->runSql( $query );
			$mysql->closeDb();
			$this->show_success();
					}
			
	}
Ejemplo n.º 12
0
function upuserlock($lock, $username)
{
    $mysql = new SaeMysql();
    $sql = "UPDATE `wx_users` SET  `lock` =  '{$lock}' WHERE  `openid` =  '{$username}'";
    $mysql->runSql($sql);
    if ($mysql->errno() != 0) {
        die("Error:" . $mysql->errmsg());
    }
    $mysql->closeDb();
}
Ejemplo n.º 13
0
 /**
  * 调用微信接口,重新获取access_token
  * @return  string
  */
 private function _getNewAccessToken()
 {
     // 获取新的access_token
     $apiUrl = sprintf($this->_apiUrl, APP_ID, APP_SECRET);
     $newAccessToken = Curl::doCurl($apiUrl);
     // 判断是否获取成功
     if (!$newAccessToken['errcode'] && !empty($newAccessToken['access_token'])) {
         // 将新获取的access_token更新到数据库
         $c_time = time() - 200;
         // 将获取到的时间提前一点
         $mysql = new SaeMysql();
         $sql = "SELECT `c_time`, `t_value` FROM `weixin_access_token`";
         $data = $mysql->getData($sql);
         //$data = DbPDO::table('weixin_access_token')->find();
         if (!$data) {
             // 首次插入
             //DbPDO::table('weixin_access_token')->where(array('id'=>1))->add(array('c_time' => $c_time, 't_value' => $newAccessToken['access_token']));
             $sql = "INSERT INTO `weixin_access_token` (`c_time`, `t_value`) VALUES ({$c_time}, " . $newAccessToken['access_token'] . ")";
         } else {
             // 修改
             //DbPDO::table('weixin_access_token')->where(array('id'=>1))->save(array('c_time' => $c_time, 't_value' => $newAccessToken['access_token']));
             $sql = "UPDATE `weixin_access_token` SET `c_time` = {$c_time} , `t_value` = " . $newAccessToken['access_token'] . " WHERE id = 1";
         }
         $mysql->runSql($sql);
         $mysql->closeDb();
     } else {
         throw new Exception($newAccessToken['errcode'] . '-' . $newAccessToken['errmsg']);
     }
     return $newAccessToken['access_token'];
 }
Ejemplo n.º 14
0
function get_JS_Access_Token()
{
    $appid = APPID;
    $appsecret = APPSECRET;
    $nowTime = time();
    $mysql = new SaeMysql();
    $sql = "SELECT * FROM `gParameters` WHERE `name` ='gJSAccessToken'";
    $data = $mysql->getLine($sql);
    $JSAccessToken = $data["Value"];
    //	sae_debug("accessToken = ".$accessToken);
    $sql = "SELECT * FROM `gParameters` WHERE `name` ='gJSTokenTime'";
    $data = $mysql->getLine($sql);
    $JSTokenTime = $data["Value"];
    if ($nowTime - $JSTokenTime > 7000) {
        $accessToken = get_Access_Token();
        $url = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?type=jsapi&access_token=" . $accessToken;
        $outputToken = https_request($url);
        $jsoninfo = json_decode($outputToken, true);
        $JSAccessToken = $jsoninfo["ticket"];
        $sql = "UPDATE `gParameters` SET `Value` ='" . $JSAccessToken . "' WHERE `name` ='gJSAccessToken'";
        $mysql->runSql($sql);
        $sql = "UPDATE `gParameters` SET `Value` ='" . $nowTime . "' WHERE `name` ='gTokenTime'";
        $mysql->runSql($sql);
    }
    $mysql->closeDb();
    return $JSAccessToken;
}
Ejemplo n.º 15
0
function ShowDiff($group_id, $from, $to, &$summary)
{
    $mysql = new SaeMysql();
    $sql = "SELECT url FROM `url` WHERE `group_id`=" . $group_id;
    $urls = $mysql->getData( $sql );
    $results = array();
    
    for($i = 0; $i < sizeof($urls); ++$i)
    {
        $title = "";
        $content_diff = "";
        
        $sql_from = "SELECT content FROM `web_content` WHERE `url`='" . $urls[$i]['url'] . "' AND `date`='" . $from . "'";
        $sql_to = "SELECT content FROM `web_content` WHERE `url`='" . $urls[$i]['url'] . "' AND `date`='" . $to . "'";

        $content_from = $mysql->getVar( $sql_from );
        $content_to = $mysql->getVar( $sql_to );
       
        if (!$content_from || !$content_to)
        {
            array_attach($results, foutput('failed', $urls[$i]['url'], NULL, $summary));
        }
        else
        {
            if ($content_from !== $content_to)
            {
                $content_diff = GetFormattedDiff($content_from, $content_to);
                
                if (is_string($content_diff))
                {
                    array_attach($results, foutput('changed', $urls[$i]['url'], $content_diff, $summary));
                }
                else
                {
                    array_attach($results, foutput('error', $urls[$i]['url'], NULL, $summary));
                }
            }
            else
            {
                array_attach($results, foutput('identical', $urls[$i]['url'], NULL, $summary));
            }
        }
    }
    
    $mysql->closeDb();
    
    return $results;
}
Ejemplo n.º 16
0
function DBinsert($userid, $username)
{
    $mysql = new SaeMysql();
    $sql_1 = "SELECT * FROM `users` WHERE `weiboid` =" . $userid;
    //$sql_1 = "SELECT * FROM `users` LIMIT 10";
    $data = $mysql->getData($sql_1);
    if ($mysql->errno() != 0) {
        die("Error_1:" . $mysql->errmsg());
    }
    if (count($data) == 0) {
        $sql_2 = "INSERT  INTO `users` ( `weiboid` , `weiboname` ) VALUES ('" . $userid . "','" . $username . "') ";
        $mysql->runSql($sql_2);
    } else {
        foreach ($data as $v1) {
            echo '<p/>';
            echo 'weiboname: ' . $v1['weiboname'] . '<br/>';
        }
    }
    $sql_3 = "SELECT `pynames` FROM `users` WHERE `weiboid` =" . $userid;
    $data = $mysql->getData($sql_3);
    if ($mysql->errno() != 0) {
        die("Error_3:" . $mysql->errmsg());
    }
    if (checkArray($data)) {
        echo 'pyname is null <br/>';
    } else {
        //echo "length of data=".count($data).'<br/>';
        foreach ($data as $v1) {
            //echo '<p/>';
            //echo 'pynames: ' . $v1['pynames'] . '<br/>';
            $ps = explode(",", $v1['pynames']);
            //echo "length of ps=".count($ps).'<br/>';
            foreach ($ps as $v2) {
                //echo '<p/>';
                //echo 'pynames: ' . $v2 . '<br/>';
                $sql_4 = "SELECT `pynames` FROM `users` WHERE `weiboid` =" . $v2;
                $data_4 = $mysql->getData($sql_4);
                if ($mysql->errno() != 0) {
                    die("Error_4:" . $mysql->errmsg());
                }
                if (count($data_4) == 0) {
                    echo '<p/>';
                    echo 'pynames: ' . $v2 . ' 还没有使用本服务<br/>';
                } else {
                    echo 'pynames: ' . $v2 . ' 选中的有:';
                    foreach ($data_4 as $v3) {
                        //echo '<p/>';
                        echo $v3['pynames'] . '<br/>';
                        if (strpos($v3['pynames'], (string) $userid, 0) === false) {
                            //echo '没有找到';
                        } else {
                            echo '用户' . $v2 . '也选择了您!';
                        }
                    }
                }
            }
            //SelectTag($ps);
        }
    }
    $mysql->closeDb();
}
Ejemplo n.º 17
0
				<thead>
					<tr>
						<th>题目编号</th>
						<th>描述</th>
						<th>正确答案</th>
						<th>查看</th>
						<th>修改</th>
						<th>删除</th>
					</tr>
				</thead>
				<tbody>
					<?php 
$mysql = new SaeMysql();
$sql = "select `id`,`question`,`right_answer` from `choice_question` order by `id` DESC";
$rows = $mysql->getData($sql);
$mysql->closeDb();
// print_r($rows);
foreach ($rows as $row) {
    echo "<tr>";
    echo "<td>" . $row["id"] . "</td>";
    echo "<td>" . substr_cut($row["question"], 50) . "</td>";
    echo "<td><code>" . $row["right_answer"] . "</code></td>";
    echo "<td><a class=\"btn btn-info\" href=\"./index.php?id=7&qid=" . $row["id"] . "\">查看</a></td>";
    echo "<td><a class=\"btn btn-primary\" href=\"./index.php?id=8&qid=" . $row["id"] . "\">修改</a></td>";
    echo "<td><a class=\"btn btn-danger\" href=\"../function/admin/common-action.php?cmd=delete-choice&id=" . $row["id"] . "\">删除</a></td>";
    echo "</tr>";
}
?>
				</tbody>
			</table>
        </div>
Ejemplo n.º 18
0
function Watch($url)
{
    $datetime = new DateTime();
    $date = $datetime->format('Ymd');
    
    // fetch urls
    $web_content = RetrieveContent($url);
    if (NULL === $web_content)
        return NULL;
    
    $mysql = new SaeMysql();
    // store web content(plain text)
    $sql = "INSERT INTO `web_content` ( `url` , `date` , `content` ) VALUES ( '"  . $mysql->escape($url) . "' , '" . $date . "' , '" . $web_content . "')";
    if (!$mysql->runSql( $sql ))
        echo "Error : " . $sql;
    else
        echo "Sql is executed successfully.";
        
    $mysql->closeDb();
    
    return $web_content;
}