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


PHP SaeMysql::getLine方法代码示例

本文整理汇总了PHP中SaeMysql::getLine方法的典型用法代码示例。如果您正苦于以下问题:PHP SaeMysql::getLine方法的具体用法?PHP SaeMysql::getLine怎么用?PHP SaeMysql::getLine使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SaeMysql的用法示例。


在下文中一共展示了SaeMysql::getLine方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: check_admin

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;
    }
}
开发者ID:dalinhuang,项目名称:OEMS,代码行数:23,代码来源:common-function.php

示例2: SaeMysql

</HEAD>
<body>
    
<?php 
include "base-class.php";
//新建sae数据库类
$mysql = new SaeMysql();
//获取部门ID号传入
$class_id = intval($_GET["class_id"]);
//获取操作标识传入
$action = $_POST["action"];
$action = string::un_script_code($action);
$action = string::un_html($action);
//判断是否修改,如果传入了部门ID,进行数据库查询获取全部内容
if ($class_id) {
    $class_value = $mysql->getLine("select * from class where class_id={$class_id}");
    if (!$class_value) {
        echo "<script>alert('无此部门');history.back();</Script>";
        exit;
    }
}
//如果获取到操作标识,进行录入或者修改操作
if ($action == "update") {
    //获取表单传入数据
    $old_class_id = $_POST["class_id"];
    $class_name = $_POST["class_name"];
    $class_fid = $_POST["class_fid"];
    //传入数据过滤
    $old_class_id = intval($old_class_id);
    $class_name = string::un_script_code($class_name);
    $class_fid = intval($class_fid);
开发者ID:Kingson4Wu,项目名称:Kingson4WeixinOnSae,代码行数:31,代码来源:class_add.php

示例3: sprintf

 }
 //用户跳出操作
 if (strtolower($form_Content) == "exit") {
     //清空memcache动作
     $mc->delete($fromUsername . "_question_data");
     //清空memcache数据
     $mc->delete($fromUsername . "_question_order");
     //回复操作提示
     $msgType = "text";
     $resultStr = sprintf($textTpl, $fromUsername, $toUsername, time(), $msgType, "你已经退出当前答题,寻求帮助请输入“help”,重新挑战请输入“go”!");
     echo $resultStr;
     exit;
 }
 //用户查询最好成绩
 if (strtolower($form_Content) == "best") {
     $question_value = $mysql->getLine("select * from answer_tb where answer_user='{$fromUsername}' order by answer_time asc limit 0,1");
     //回复消息
     $msgType = "text";
     $resultStr = sprintf($textTpl, $fromUsername, $toUsername, time(), $msgType, "你最好的成绩为:" . $question_value["answer_time"] . "秒\n\n完成时间为:" . $question_value["create_time"]);
     echo $resultStr;
     exit;
 }
 //用户查询历史成绩,最新的10次
 if (strtolower($form_Content) == "history") {
     $question_list = $mysql->getData("select * from answer_tb where answer_user='{$fromUsername}' \n                    \t\t\torder by create_time desc limit 0,10");
     $out_str = "";
     foreach ($question_list as $key => $value) {
         $out_str .= $key + 1 . ". 在" . $value["create_time"] . "完成答题,成绩为答错" . $value["answer_error"] . "次,用时" . $value["answer_time"] . "秒\n\n";
     }
     //回复消息
     $msgType = "text";
开发者ID:QPG,项目名称:answer_system,代码行数:31,代码来源:wx_interapi.php

示例4: intval

$uid = intval($_COOKIE["user_id"]);
$fid = intval($_GET["fid"]);
if ($fid < 1 || $fid > 20) {
    echo "invalid {$qid}";
    exit(0);
}
$num = 20;
//注意这里需要修改
$qid = ($fid + $uid) % $num + 1;
$sql = "select * from `judge_answer` where `user_id`={$uid} and `ques_id` = {$qid}";
$mysql = new SaeMysql();
$rowa = $mysql->getLine($sql);
$mysql->closeDb();
$sql = "select `question` from `judge_question` where `id`={$qid}";
$mysql = new SaeMysql();
$row = $mysql->getLine($sql);
$mysql->closeDb();
?>

<?php 
if ($rowa != false) {
    $answer = $rowa["answer"] == 1 ? "first" : "second";
    ?>
<script type="text/javascript">
	$(window).load(function() {
    	var user_answer = "<?php 
    echo $answer;
    ?>
";
  		$("#"+user_answer).attr('checked', 'checked');
  });             
开发者ID:dalinhuang,项目名称:OEMS,代码行数:31,代码来源:answer-judge.php

示例5: SaeMysql

<?php

include 'header.php';
?>

<?php 
$mysql = new SaeMysql();
$sql = "select * from depot";
$line = $mysql->getLine($sql);
//echo "haha";
?>
<table border="0">
 <tr>
 <td align="right">Balance:</td><td align="left"><B><?php 
echo $line["balance"];
?>
</B></td>
 <td align="right">UpdateTime:</td><td align="left"><B><?php 
echo $line["updatetime"];
?>
</B></td>
 </tr>
</table>
<?php 
$mysql->closeDb();
include 'footer.php';
开发者ID:AccountingPlatform,项目名称:club4fun,代码行数:26,代码来源:index.php

示例6: receiveText

 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.'" >';
//.........这里部分代码省略.........
开发者ID:initialb,项目名称:UCMS,代码行数:101,代码来源:index.duplicall.php

示例7: SaeMysql

<?php

session_start();
//查询数据库,openid是否已经存在
//用SAEMySQL的getdata方法,如果结果为空,会返回false,但没有错误
$openid = $_GET['openid'];
$_SESSION['openid'] = $openid;
$mysql = new SaeMysql();
$query = "SELECT openid,name FROM wechat_user WHERE openid='{$openid}'";
//根据openid取出考号,以降序排列,默认查询考号最大的一次
$examid = "select examid from cet WHERE openid='{$openid}' ORDER BY examid DESC";
//从数组取出两个变量
$query = $mysql->getLine($query);
$examid = $mysql->getVar($examid);
//数据库保存的openid
$openid_db = $query['openid'];
$name = $query['name'];
$_SESSION['examid'] = $examid;
$_SESSION['name'] = $name;
//var_dump($examid);
//var_dump($mysql->getLine($query));
//var_dump($mysql->getVar($query));
//sae_log(json_encode($openid . "-" . $examid));
//用户尚未注册
if (empty($openid_db)) {
    $signup = "INSERT INTO wechat_user (openid) VALUES ('{$openid}') ";
    $bool = $mysql->runSql($signup);
    if (!$bool) {
        echo $debug = sprintf("注册失败 %d : %s", $mysql->errno(), $mysql->errmsg());
        sae_log($debug);
    } else {
开发者ID:j178,项目名称:MyWechat,代码行数:31,代码来源:cet.php

示例8: function

//关注事件
/**
 * 生成提示功能的news
 * @param null $user_name
 * @return array
 */
$welcome = function ($user_name = "") {
    $i = 1;
    return array(Message::make('news_item')->title("{$user_name} 你好~欢迎关注!")->PicUrl('http://n1gel-n1gel.stor.sinaapp.com/img%2Fwelcome.jpg'), Message::make('news_item')->title("『" . $i++ . "』发送图片可以查询照片中人脸的年龄和性别信息,还会在脸上标出来哦…")->PicUrl('http://n1gel-wechatimg.stor.sinaapp.com/mmbizaC7DypReicewYESlc5gXjH3IKQbYribnF72lBOIpmK0BWKZ6XTVdcSmaPzwp4NibAqdZTzSYuxNaRoqbrtqaacNWA0814814157.jpg'), Message::make('news_item')->title("『" . $i++ . "』机智的图灵机器人陪你聊天解闷,可以查天气查火车查航班…")->PicUrl('http://n1gel-n1gel.stor.sinaapp.com/2786001_213751420000_2.jpg'), Message::make('news_item')->title("『" . $i++ . "』新功能:语音聊天~直接给我发送语音就可以聊天了哦~")->PicUrl('http://www.36dsj.com/wp-content/uploads/2015/03/228.jpg'), Message::make('news_item')->title("『" . $i++ . "』四六级查分已经上线,回复\"46\"来备份考号吧!")->PicUrl('http://n1gel-n1gel.stor.sinaapp.com/img%2F%E5%9B%9B%E5%85%AD%E7%BA%A7%E6%9F%A5%E5%88%86.jpg'));
};
$server->on('event', 'subscribe', function ($event) use($welcome) {
    sae_log("用户关注: " . $event->FromUserName);
    $mysql = new SaeMysql();
    //用户以前是否关注过
    $everFollowed = "select openid,name from wechat_user WHERE openid='{$event->FromUserName}'";
    $user = $mysql->getLine($everFollowed);
    //用户第一次关注
    if ($user === false) {
        $signup = "insert into wechat_user(openid,followTime) VALUES ('{$event->FromUserName}','" . date("Y/m/d-H:i:s") . "')";
        $mysql->runSql($signup);
        sae_log("用户第一次关注");
        $mysql->closeDb();
        return Message::make('news')->items($welcome);
    } else {
        //MySQL如何修改现有的一行数据?
        //更新关注时间、关注状态,获取用户姓名
        $update = "update wechat_user set followTime = '" . date("Y/m/d-H:i:s") . "',isFollow = 1 WHERE\n        openid='{$event->FromUserName}' ";
        $mysql->runSql($update);
        $name = $mysql->getVar("select name from wechat_user WHERE openid = '{$event->FromUserName}'");
        if (is_bool($name)) {
            $name = "";
开发者ID:devsnippet,项目名称:MyWechat,代码行数:31,代码来源:Wechat.php

示例9: receiveText

 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;
 }
开发者ID:AAYuan,项目名称:museum,代码行数:36,代码来源:museum.php

示例10: safe_replace

@define("WE_ROOT", dirname(__FILE__) . "/");
require_once WE_ROOT . "wechat.class.php";
require_once WE_ROOT . "tuling.func.php";
require_once WE_ROOT . "idioms.func.php";
require_once WE_ROOT . "UnderCover.func.php";
$options = array('token' => 'huangang');
$weObj = new Wechat($options);
$weObj->valid();
$type = $weObj->getRev()->getRevType();
$username = $weObj->getRev()->getRevFrom();
$content = $weObj->getRev()->getRevContent();
$content = safe_replace($content);
$mysql = new SaeMysql();
$sql = "select * from wx_users where openid = '{$username}' ";
$data = $mysql->getLine($sql);
if ($data) {
    $lock = $data['lock'];
} else {
    $sql = "insert into wx_users(openid) values('{$username}')";
    $mysql->runSql($sql);
    if ($mysql->errno() != 0) {
        die("Error:" . $mysql->errmsg());
    }
    $lock = "unlock";
}
$mysql->closeDb();
function safe_replace($string)
{
    $string = str_replace('%20', '', $string);
    $string = str_replace('%27', '', $string);
开发者ID:funny-guess,项目名称:wechat-server-php,代码行数:30,代码来源:test.php

示例11: SaeMysql

</HEAD>
<body>
    
<?php 
include_once "base-class.php";
//新建sae数据库类
$mysql = new SaeMysql();
//获取问题ID号传入
$question_id = intval($_GET["question_id"]);
//获取操作标识传入
$action = $_POST["action"];
$action = string::un_script_code($action);
$action = string::un_html($action);
//判断是否修改,如果传入了问题ID,进行数据库查询获取全部内容
if ($question_id) {
    $question_value = $mysql->getLine("select * from question_tb where question_id={$question_id}");
    if (!$question_value) {
        echo "<script>alert('无此题目');history.back();</Script>";
        exit;
    }
}
//如果获取到操作标识,进行录入或者修改操作
if ($action == "update") {
    //获取表单传入数据
    $old_question_id = $_POST["question_id"];
    $question_subject = $_POST["question_subject"];
    $question_options = $_POST["question_options"];
    $question_true = $_POST["question_true"];
    //传入数据过滤
    $old_question_id = intval($old_question_id);
    $question_subject = string::un_script_code($question_subject);
开发者ID:QPG,项目名称:answer_system,代码行数:31,代码来源:question_add.php

示例12: get_JS_Access_Token

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;
}
开发者ID:initialb,项目名称:UCMS,代码行数:27,代码来源:utility.php

示例13: intval

<?php

require_once "../../config/saemysql.class.php";
$uid = intval($_COOKIE["user_id"]);
$qid = intval($_POST["qid"]);
$post_answer = trim($_POST["answer"]);
$sql = "select * from `choice_answer` where `user_id`={$uid} and `ques_id`={$qid}";
$mysql = new SaeMysql();
$row1 = $mysql->getLine($sql);
$user_answer = $row1["answer"];
//echo "<br/>";
$sql = "select `score`,`right_answer` from `choice_question` where `id`={$qid}";
$row2 = $mysql->getLine($sql);
$score = intval($row2["score"]);
$right_answer = trim($row2["right_answer"]);
if ($row1 != false) {
    //更新答案操作
    $sql = "update `choice_answer` set `answer`='{$post_answer}' where `user_id`={$uid} and `ques_id`={$qid}";
    $mysql->runSql($sql);
    $str = "答案修改成功";
    if ($user_answer == $right_answer && $post_answer != $right_answer) {
        //原答案正确并且现答案错误,则执行减分操作
        $sql = "update `qs_user` set `grade`=`grade`-{$score} where `id`={$uid}";
        $mysql->runSql($sql);
    } else {
        if ($user_answer != $right_answer && $post_answer == $right_answer) {
            //原答案错误并且现答案正确,执行加分操作
            $sql = "update `qs_user` set `grade`=`grade`+{$score} where `id`={$uid}";
            $mysql->runSql($sql);
        }
    }
开发者ID:dalinhuang,项目名称:OEMS,代码行数:31,代码来源:commit-choice.php


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