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(); }
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); } }
/** * 调用微信接口,重新获取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']; }
function getAstrosData() { $mysql = new SaeMysql(); $sql0 = "SELECT * FROM `" . tname("astro") . "` LIMIT 12"; $astros = $mysql->getData($sql0); return $astros; }
public function index() { $mysql = new SaeMysql(); $sql = "SELECT * FROM `scrawl` WHERE sid = 1"; $data = $mysql->getData($sql); if ($mysql->errno() != 0) { die("Error:" . $mysql->errmsg()); } $this->assign('svg', $data[0]['data']); $this->display(); }
/** * Non-persistent database connection * * @access private called by the base class * @return resource */ function db_connect() { if ($this->port != '') { $this->hostname .= ':' . $this->port; } //---change---// //return @mysql_connect($this->hostname, $this->username, $this->password, TRUE); $t_saemysql = new SaeMysql(); $t_saemysql->setCharset($this->char_set); $t_saemysql->setAuth($this->username, $this->password); $t_saemysql->setPort($this->port); return $t_saemysql; }
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; }
function get_book_count($bookid) { if (empty($bookid)) { return "数量异常"; } $mysql = new SaeMysql(); $sql = "SELECT count FROM bookinfo WHERE id = '" . $bookid . "'"; $data = $mysql->getData($sql); if (empty($data[0][0])) { return "数量异常"; } //取到总备货数量 $count1 = intval($data[0][0]); $sql = "SELECT SUM(count) FROM sellinfo WHERE bookid = '" . $bookid . "' GROUP BY null"; $data = $mysql->getData($sql); $count2 = 0; if (!empty($data[0][0])) { $count2 = intval($data[0][0]); } return strval($count1 - $count2); }
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(); } }
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; } }
public function update() { $check_caozuo = "select caozuo from toupiao where id ={$this->jiemu}"; $query = "update toupiao set {$this->pingwei} = {$this->score} where id = {$this->jiemu}"; //echo $query; $mysql = new SaeMysql(); $mysql_caozuo = new SaeMysql(); $result_check = $mysql_caozuo->getData($check_caozuo); //var_dump($result_check); if ($result_check[0]['caozuo'] == "1") { # code... $result = $mysql->runSql($query); if ($result) { $this->show_success(); } else { $this->show_fail(); } } else { $this->show_error(); } //$result->free(); //$mysqli->close(); }
<?php header("content-type:text/html; charset=utf-8"); //require_once('../utility.php'); //require_once('../SaeMysql.php'); $mysql = new SaeMysql(); $sql = "INSERT INTO `WM_Log` (`page`) VALUES('A4-20160522')"; $mysql->runSql($sql); $mysql->closeDb(); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=10, user-scalable=yes"> <title>政策揭秘:美联储加息,你的恐惧为哪般?</title> <meta name="description" content="Release by WorldMoney 2016.01.01"> <meta name="author" content="WorldMoney"> <link href="../bootstrap/css/bootstrap.min.css" rel="stylesheet"> <!-- link href="../bootstrap/css/style.css" rel="stylesheet" --> <link rel="stylesheet" href="../bootstrap/weui-master/dist/style/weui.css"/> <link rel="stylesheet" href="../bootstrap/weui-master/dist/style/weui.min.css"/> <link rel="stylesheet" href="../bootstrap/fancybox/jquery.fancybox.css" type="text/css" media="screen" /> <link rel="stylesheet" href="../css/zhuanyangqian.css" /> <link rel="stylesheet" href="../css/A5.css" />
<?php header("Content-Type:application/json;charset=UTF-8"); $code = $_GET['code']; $poc = array("poc_1" => 1, "poc_2" => 2, "poc_3" => 3, "poc_4" => 4, "poc_5" => 5, "poc_6" => 6, "poc_7" => 7, "poc_8" => 8, "poc_9" => 9, "poc_10" => 10); //参数 code验证 if (strpos($code, "||") == false) { echo json_encode(array("status" => false, "msg" => "error code!")); exit; } list($key, $value) = explode("||", $code); if ($value != strtoupper(substr(md5("hongcha" . $key . "android"), 1, -1))) { echo json_encode(array("status" => false, "msg" => "error code!")); exit; } $mysql = new SaeMysql(); $sql = "select * from result where code ='" . $mysql->escape($code) . "'"; $data = $mysql->getData($sql); $result = array(); if ($data) { $tmpdata = $data[0]; foreach ($tmpdata as $key => $value) { if ($key != "code" && $key != "id" && $key != "token" && $key != "ua") { $result[$key] = intval($value); } } echo json_encode(array("status" => true, "msg" => $result)); } else { echo json_encode(array("status" => false, "msg" => "query empty!")); } $mysql->closeDb();
<h6 align="center"><a href="admin_personal.php">查看评委打分</a> || <a href="admin_dafeng.php">固化打分</a> || <a href="result.php">观众最喜爱结果的评分</a></h6> <table border='1' align='center'> <tr> <th>节目序号</th> <th>节目名称</th> <th>表演者</th> <th>小组</th> <th>总分</th> <th>平均分</th> <th>(去)总分</th> <th>(去)平均分</th> </tr> <?php //connect database $mysql = new SaeMysql(); //mysqli_query($mysqli,"SET NAMES utf8"); $query = "select * from toupiao"; $result = $mysql->getData($query); //var_dump($result); $array_pingfeng = array(); //创建数组 存储qu平均分后的数组 记录id和平均分 for ($i = 0; $i < count($result); $i++) { $row = $result[$i]; // var_dump($row); $num_child_row = count($row) - 5; $array_score = array_slice($row, 5); //off 5 argues sort($array_score); $total_score = array_sum($array_score); $total_pingjun_score = $total_score / $num_child_row;
<?php $title = $_POST['title']; $abstract = $_POST['abstract']; $url = $_POST["url"]; $thumbnail = $_POST['thumbnail']; $type = $_POST["type"]; $status = $_POST["status"]; $reviewer = $_POST["reviewer"]; $deliver = $_POST["deliver"]; $create_at = $_POST["create_at"]; $delete = $_POST["delete"]; if (empty($title)) { die("{\"s_status\": \"ERROR\",\"s_message\": \"Empty data\",\"s_code\": 0}"); } $mysql = new SaeMysql(); $sql = "INSERT INTO `android_digest_review`( `title`, `abstract`, `url`, `thumbnail`, `type`, `status`, `reviewer`, `deliver`, `create_at`, `delete`) " . "VALUES ('" . $title . "', '" . $abstract . "', '" . $url . "', '" . $thumbnail . "', '" . $type . "', '" . $status . "', '" . $reviewer . "', '" . $deliver . "', '" . $create_at . "', '" . $delete . "') "; $mysql->runSql($sql); if ($mysql->errno() != 0) { die("{\"s_status\": \"ERROR\",\"s_message\": \"" . $mysql->errmsg() . "\",\"s_code\": 1}"); } else { die("{\"s_status\": \"OK\",\"s_message\": \"\",\"s_code\": 200}"); } $mysql->closeDb();
<?php if (defined('SAE_MYSQL_DB')) { $sql = new SaeMysql(); } else { require 'x/mysql.class.php'; } $list = $sql->getData('SELECT * FROM imouto_article ORDER BY created DESC LIMIT 0,15'); $h = '<?xml version="1.0" encoding="UTF-8"?>' . "\n" . '<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">' . "\n" . '<channel>' . "\n" . ' <title>卜卜口</title>' . "\n" . ' <link>http://mouto.org/</link>' . "\n" . ' <description>94年少年。</description>' . "\n" . ' <lastBuildDate>' . date('D, d M Y H:i:s ', $list[0]['created']) . '</lastBuildDate>' . "\n" . ' <language>zh-CN</language>' . "\n"; foreach ($list as $p) { $h .= ' <item>' . "\n" . ' <title><![CDATA[' . $p['title'] . ']]></title>' . "\n" . ' <link>http://mouto.org/#!' . $p['pid'] . '</link>' . "\n" . ' <category>' . $p['category'] . '</category>' . "\n" . ' <pubDate>' . date('D, d M Y H:i:s ', $p['created']) . '</pubDate>' . "\n" . ' <description><![CDATA['; if ($p['cover']) { $h .= '<p><img src="http://ww2.sinaimg.cn/large/' . $p['cover'] . '.jpg"></p>'; } $h .= $p['text'] . ']]></description>' . "\n" . ' </item>' . "\n"; } $h .= '</channel>' . "\n" . '</rss>'; header('Content-type: application/rss+xml;charset=utf-8'); exit($h); file_put_contents('rss.xml', $h);
<?php //装载模板文件 include_once "wx_tpl.php"; include_once "base-class.php"; //新建sae数据库类 $mysql = new SaeMysql(); //新建Memcache类 $mc = memcache_init(); //获取微信发送数据 $postStr = $GLOBALS["HTTP_RAW_POST_DATA"]; //每次抽取几题 $question_nums = 20; //返回回复数据 if (!empty($postStr)) { //解析数据 $postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA); //发送消息方ID $fromUsername = $postObj->FromUserName; //接收消息方ID $toUsername = $postObj->ToUserName; //消息类型 $form_MsgType = $postObj->MsgType; //欢迎消息 if ($form_MsgType == "event") { //获取事件类型 $form_Event = $postObj->Event; //订阅事件 if ($form_Event == "subscribe") { //欢迎词 $welcome_str = "欢迎来到YYF答题系统\n\n\n已添加由\n“NEUQ ACM俱乐部”\n提供的\n《计算机基础》题库。\n===NEUQ ACM===\n每次问答系统将从题库中随机抽取" . $question_nums . "道题目,都为单选题,输入选项对应字母答题。\n\n准备好了吗?输入“go”进行答题:\n(答案已尽量修正,若还有错误,请谅解)";
private function getAnalysedRepory($reports) { $kv = new SaeKV(); $kv->init(); $maxDaysOfMonth = $kv->get('maxDaysOfMonth'); $increaseRate = $kv->get('increaseRate'); $salesTarget = $kv->get('salesTarget'); $manTarget = $kv->get('manTarget'); $cosmeticsTarget = $kv->get('cosmeticsTarget'); $mysql = new SaeMysql(); $month = $reports[0][1]; $day = $reports[0][2]; $sql = "SELECT SUM(`dailySales`) FROM `sales_amount` WHERE `date` = '2016-" . $month . "-" . $day . "'"; $data = $mysql->getData($sql); $lastYearDailySales = $data[0]['SUM(`dailySales`)']; $sql = "SELECT SUM(`monthlySales`) FROM `sales_amount` WHERE `date` = '2016-" . $month . "-" . $day . "'"; $data = $mysql->getData($sql); $lastYearMonthlySales = $data[0]['SUM(`monthlySales`)']; $dailyTarget = $this->sum($reports, 3); $realSales = $this->sum($reports, 4); $totalSales = $this->sum($reports, 6); $cosmeticsSales = $this->sum($reports, 7); $manSales = $this->sum($reports, 8); $line1 = "华东大区," . $month . "月" . $day . "日,时间进度" . round($day / $maxDaysOfMonth * 100) . "%,当月目标增长率" . $increaseRate . "%\r\n"; $line2 = "1)当日指标:" . $dailyTarget . ",实际销量:" . $realSales . ",当日达成率:" . round($realSales / $dailyTarget * 100, 1) . "%,同比增长:" . round(($realSales / $lastYearDailySales - 1) * 100, 1) . "%;\r\n"; $line3 = "2)当月指标:" . $salesTarget . ",累计销售:" . $totalSales . ",累计达成率:" . round($totalSales / $salesTarget * 100, 1) . "%,同比增长:" . round(($totalSales / $lastYearMonthlySales - 1) * 100, 1) . "%;\r\n"; $line4 = "3)重点品:男士销售:" . $manSales . "元,男士指标达成:" . round($manSales / $manTarget * 100, 1) . "%;彩妆销售:" . $cosmeticsSales . "元,彩妆指标达成:" . round($cosmeticsSales / $cosmeticsTarget * 100, 1) . "%;\r\n"; $line5 = "4)执行反馈:无"; return $line1 . $line2 . $line3 . $line4 . $line5; }
public function saemysql() { $mysql = new SaeMysql(); $mysql->runSql('create table saetest(`id` int(11) NOT NULL);'); echo '在本地时请先配置好数据库,本程序执行完毕后会向数据库中建立名为saetest数据表'; }
<!--插入查询功能--> <h1 align="center">玉环县人民医院医师信息审核系统</h1> <h6 align="center">后台控制 版本1.0 制作人:<a href="market_admin_repick.php">苏维杰</a> 制作时间:2015-09-10</h6> <h1 align="center">医务科后台</h1> <?php //creat timestamp for record $t = time(); $datestamp = date("Y-m-d H:i", $t); echo "<h6 align='center'>现在时间:" . $datestamp . "</h6>"; //connect database require_once 'conn.php'; //define openid //getdata for person $sql = "SELECT * FROM personalinformation_records WHERE 'check_rsk'='checked' ORDER BY id DESC"; $mysql = new SaeMysql(); //echo the result echo "<table border='1' align='center' class='datalist'>"; $num = 0; $query_sql = $mysql->getData($sql); $numoflist = count($query_sql); //$get_data =mysql_query("select * from waimai where class='{$class}' ORDER BY ord DESC");//查询 if ($numoflist <= 10) { //如果总数小于等于10则全部生成 // makeList($get_data); } else { //总数大于10则分页 if (!isset($_GET['limit'])) { $limitHead = 0; } else { $limitHead = $_GET['limit'];
<?php $amount = $_POST[amount]; $memberId = $_POST[memberId]; //echo $amount." ".$memberId; $sql1 = "insert into income (amount,time,member_id) values ({$amount},now(),{$memberId})"; $sql2 = "update depot set updatetime = now(), balance = balance+{$amount}"; $sql3 = "update member set updatetime = now(),balance = balance+{$amount} where id = {$memberId}"; $mysql = new SaeMysql(); $mysql->runSql($sql1); if ($mysql->errno() != 0) { die("Error:" . $mysql->errmsg()); } $mysql->runSql($sql2); if ($mysql->errno() != 0) { die("Error:" . $mysql->errmsg()); } $mysql->runSql($sql3); if ($mysql->errno() != 0) { die("Error:" . $mysql->errmsg()); } $mysql->closeDb(); echo "<SCRIPT LANGUAGE='JavaScript'>"; echo "location.href='income.php'"; echo "</SCRIPT>";
<?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) {
<div class="content"> <p class="text-info"><strong>查看选择题题目:</strong><span style="display:none;" id="info">题目</span></p> <table class="table table-hover"> <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>"; } ?>
<?php include 'header.php'; $mysql = new SaeMysql(); $sql = "select * from member"; $result = $mysql->getData($sql); ?> <P> <H2>New Income:</H2> <P> <form method="post" action="addIncome.php"> <table border="0"> <tr> <td>amount:</td> <td><input type="text" maxlength="255" size="30" name="amount" /><font color="red">(*number only)</font></td> </tr> <tr> <td>from:</td> <td> <select name="memberId"> <?php foreach ($result as $member) { ?> <option value="<?php echo $member[id]; ?> "/><?php echo $member[name]; ?> </option> <?php
* and open the template in the editor. */ require dirname(__FILE__) . "/../data/config.php"; echo '<meta http-equiv="Content-Type" content="text / html;charset=UTF-8" />'; $install = @file_get_contents(saestor("saestor_" . $_SERVER['HTTP_APPVERSION'] . "/data/install.lock")); if ($install == "1") { echo "<h1>警告</h1>"; echo "<h3>版本" . $_SERVER['HTTP_APPVERSION'] . "已完成安装!请删除/install/目录!</h3>"; echo "<h3>如果重新安装请先删除storage内的 saestor_" . $_SERVER['HTTP_APPVERSION'] . "/data/install.lock 文件</h3>"; } else { // 判断是否已经初始化了storage,mc,mysql if (is_storage() && is_mc() && is_mysql()) { $fp = @fopen(dirname(__FILE__) . "/ecshop4sae.sql", "r") or die("不能打开SQL文件 {$file_name}"); //打开文件 if ($fp) { $mysql = new SaeMysql(); echo "正在执行导入操作:"; while ($SQL = GetNextSQL()) { $SQL = str_replace("`ecs_", "`" . TABLE_PREFIX, $SQL); // echo $SQL."<BR/>"; if (!$mysql->runSql($SQL)) { echo "执行出错:" . $mysql->errmsg() . ""; echo "SQL语句为:" . $SQL . ""; exit; } } echo "导入完成<br/>"; echo "<h1>安装成功</h1>"; echo "点击<a href='/admin'>/admin</a> 进入后台,管理员帐号为admin 密码为123<br/><br/><h2>注意</h2>为确保安全请登入后台后修改密码!并使用svn删除/install目录!"; @fclose($fp); $s = new SaeStorage();
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; }
<!DOCTYPE HTML> <html> <HEAD> <meta charset="utf-8"> <TITLE>部门添加/修改</TITLE> </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"];
<?php include 'header.php'; $mysql = new SaeMysql(); $mysql->runSql("set names 'utf8'"); $sql = "select * from member"; $members = $mysql->getData($sql); echo "<table>\n"; foreach ($members as $member) { ?> <tr> <td align="right">name:</td><td align="left"><B><?php echo $member["name"]; ?> </B></td> <td align="right">updateTime:</td><td align="left"><B><?php echo $member["updatetime"]; ?> </B></td> </tr> <tr> <td colspan="2">balance:<FONT <?php if ($member["balance"] < 0) { echo "color=\"red\""; } ?> ><?php echo $member["balance"]; ?> </FONT></td> </tr>
public function setCharset($charset) { self::$charset = $charset; mysql_query("set names " . self::$charset, self::$link); }
<?php $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');