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(); }
<?php $sql_update = "UPDATE personalinformation_records SET `check` = '{$_GET['value']}' WHERE `id` = {$_GET["id"]}"; $mysql = new SaeMysql(); $do = $mysql->runSql($sql_update); echo '<script language="javascript"> window.location.href="admin.php"; </script>'; $mysql->closeDb();
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(); $s->write(SAESTOR_NAME, "saestor_" . $_SERVER['HTTP_APPVERSION'] . "/data/install.lock", '1'); } else { echo "<h1>错误</h1>"; echo "ecshop4sae.sql文件不存在!"; }
<?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>
if (is_bool($name)) { $name = ""; sae_log("名字不存在" . $name); } $mysql->closeDb(); return Message::make('news')->items(function () use($name, $welcome) { return $welcome($name); }); } }); //取消关注 $server->on('event', 'unsubscribe', function ($event) { sae_log("用户取消关注: " . $event->openid); $mysql = new SaeMysql(); $signup = "update wechat_user set isFollow = 0, unfollowTime = '" . date("Y/m/d-H:i:s") . "'WHERE\n openid='{$event->FromUserName}'"; $mysql->runSql($signup); sae_log($mysql->errno() . "-" . $mysql->errmsg()); $mysql->closeDb(); }); //文字消息处理,调用图灵机器人 $server->on('message', 'text', function ($message) use($welcome) { //四六级查分-备份考号 return handleText($message->Content, $message->FromUserName, $welcome); }); //图片处理,调用微软API $server->on('message', 'image', function ($image) { $picUrl = $image->PicUrl; $face = new Face($picUrl); $info = $face->info; if ($info !== false) { $amount = count($info);
$help .= "\n" . '#[xx]内的内容xx是指你发送给小u的'; // 接收位置 if ($type == 'location') { $uriID = 'oTHwbt_9H0QVjJn8AdI-fmkHdKgM'; $X = $xml->Location_X; $Y = $xml->Location_Y; $sql = "SELECT Location_X,Location_Y FROM info WHERE FromUserName='******'"; $sqlback = $mysql->getData($sql); $pre_X = $sqlback[0]['Location_X']; $pre_Y = $sqlback[0]['Location_Y']; $wData = weatherAPI($X, $Y); //天气查询 $distance = W::getDistance($X, $Y, $pre_X, $pre_Y); //计算距离 if ($openid == $uriID) { $mysql->runSql("UPDATE info SET Location_X='{$X}',Location_Y='{$Y}' WHERE FromUserName='******'"); $data = '主人的位置已上传' . "\n" . 'X:' . $X . "\n" . 'Y:' . $Y . "\n" . '相距上次位置' . $distance . 'km'; } else { $data = '哦哦,你和我的距离只有' . $distance . 'km哟'; } $data .= "\n" . '------------------------------' . "\n" . $wData; } elseif ($type == 'text') { $result = $mysql->getData("SELECT * FROM python WHERE FromUserName='******'"); //python console if ($result[0]['state'] == 1) { if ($content == 'quit') { $mysql->runSql("UPDATE python SET state=0 WHERE FromUserName='******'"); $data = '已退出Python终端...'; } else { $data = python($content); }
function matchEngine($content) { global $reg_arr, $biaoqing; foreach ($reg_arr as $key => $value) { if (preg_match($key, $content, $matches)) { switch ($value) { case 'dream': $data = dream($matches[2]); break; case 'translate': $data = translateAPI($matches[2]); break; case 'biaoqing': $data = $biaoqing[rand(0, count($biaoqing) - 1)]; break; case 'changeSimsimiKey': $s = new SaeStorage(); $s->write('simsimi', 'simi.txt', $matches[2]); $data = '更改成功!'; break; case 'md5': $data = md5($matches[2]); break; case 'qrcode': $qrcode = 'http://chart.apis.google.com/chart?cht=qr&chs=400x400&choe=UTF-8&chl=' . $matches[2]; $data = array(array('title' => $matches[2], 'cover' => $qrcode, 'link' => $qrcode)); break; case 'bingSearch': $bingweb = bing($matches[2], 'Web'); $bingimage = bing($matches[2], 'Image'); $data = array(array('title' => $matches[2], 'note' => '', 'cover' => $bingimage[0], 'link' => '')); //max:7 for ($i = 0; $i < 5; $i++) { array_push($data, array('title' => $bingweb[$i]['title'] . "\n" . '------------------------------------------', 'note' => $bingweb[$i]['description'], 'cover' => '', 'link' => $bingweb[$i]['url'])); } break; case 'wiki': $wiki = wiki($matches[2], $lng); $data = array(); for ($i = 0; $i < 5; $i++) { array_push($data, array('title' => $wiki[$i]['title'] . "\n" . '------------------------------------------', 'note' => $wiki[$i]['snippet'], 'cover' => '', 'link' => 'http://zh.wikipedia.org/wiki/' . $wiki[$i]['title'])); } break; case 'doubanMovie1': $m = doubanMovies($matches[2]); $data = array(array('title' => $m[0]['title'], 'note' => $m[0]['year'] . ' ' . $m[0]['average'], 'cover' => $m[0]['images']->large, 'link' => $m[0]['alt'])); for ($i = 1; $i <= 5; $i++) { array_push($data, array('title' => $m[$i]['title'], 'note' => '又名:' . $m[$i]['original_title'] . "\n" . '上映日期:' . $m[$i]['year'] . "\n" . '评价:' . $m[$i]['average'], 'cover' => $m[$i]['images']->small, 'link' => $m[$i]['alt'])); } break; case 'doubanMovie2': $m = doubanMovies($matches[2]); $movie = doubanMovie($m[0]['id']); $xinxi = '又名:'; foreach ($movie['aka'] as $value) { $xinxi .= $value . '/'; } $xinxi .= "\n" . '上映日期:' . $movie['year'] . "\n" . '制片国家:'; foreach ($movie['countries'] as $value) { $xinxi .= $value . '/'; } $xinxi .= "\n" . '类型:'; foreach ($movie['genres'] as $value) { $xinxi .= $value . '/'; } $xinxi .= "\n" . '评价:' . $movie['average']; $data = array(array('title' => $movie['title'], 'cover' => $movie['images'], 'link' => $movie['mobile_url']), array('note' => $xinxi, 'link' => $movie['mobile_url']), array('title' => '简介', 'note' => $movie['summary'], 'link' => $movie['mobile_url']), array('title' => '导演', 'note' => $movie['directors'][0]->name, 'cover' => $movie['directors'][0]->avatars->small, 'link' => $movie['directors'][0]->alt), array('title' => '主演', 'note' => $movie['casts'][0]->name, 'cover' => $movie['casts'][0]->avatars->small, 'link' => $movie['casts'][0]->alt)); break; case 'doubanBook1': $b = doubanBooks($matches[2]); $data = array(array('title' => $b[0]['title'], 'note' => $b[0]['author'][0] . ' ' . $b[0]['average'], 'cover' => $b[0]['images']->large, 'link' => $b[0]['alt'])); for ($i = 1; $i <= 4; $i++) { array_push($data, array('title' => $b[$i]['title'], 'note' => '作者:' . $b[$i]['author'][0] . "\n" . '出版社:' . $b[$i]['publisher'] . "\n" . '出版日期:' . $b[$i]['pubdate'] . "\n" . '价格:' . $b[$i]['price'] . "\n" . '评价:' . $b[$i]['average'] . "\n" . '导言:' . $b[$i]['summary'], 'cover' => $b[$i]['images']->small, 'link' => $b[$i]['alt'])); } break; case 'doubanBook2': $b = doubanBooks($matches[2]); $bk = doubanBook($b[0]['id']); $data = array(array('title' => $bk['title'], 'cover' => $bk['images'], 'link' => $bk['alt']), array('note' => '作者:' . $bk['author'][0] . "\n" . '出版社:' . $bk['publisher'] . "\n" . '出版日期:' . $bk['pubdate'] . "\n" . '价格:' . $bk['price'] . "\n" . '评价:' . $bk['average'], 'link' => $bk['alt']), array('title' => '导言:', 'note' => $bk['summary'], 'link' => $bk['alt'])); break; case 'doubanMusic1': $m = doubanMusics($matches[2]); $data = array(array('title' => $m[0]['title'], 'note' => $m[0]['average'], 'cover' => $m[0]['image'], 'link' => $m[0]['alt'])); for ($i = 1; $i <= 4; $i++) { array_push($data, array('title' => $m[$i]['title'], 'note' => '作者:' . $m[$i]['author'][0]->name . "\n" . '出版社:' . $m[$i]['publisher'][0] . "\n" . '出版日期:' . $m[$i]['pubdate'][0] . "\n" . '表演者:' . $m[$i]['singer'][0] . "\n" . '评价:' . $m[$i]['average'] . "\n" . '类型:' . $m[$i]['version'][0], 'cover' => $m[$i]['image'], 'link' => $m[$i]['alt'])); } break; case 'doubanMusic2': $m = doubanMusics($matches[2]); $mu = doubanMusic($m[0]['id']); $data = array(array('title' => $mu['title'], 'cover' => $mu['image'], 'link' => $mu['mobile_link']), array('note' => '表演者:' . $mu['singer'][0] . "\n" . '专辑类型:' . $mu['version'][0] . "\n" . '发行时间:' . $mu['pubdate'][0] . "\n" . '作者:' . $mu['author'][0]->name . "\n" . '出版者:' . $mu['publisher'][0] . "\n" . '评价:' . $mu['average'], 'link' => $mu['mobile_link']), array('title' => '简介:', 'note' => $mu['summary'], 'link' => $mu['mobile_link'])); break; case 'moments1': $moment = $matches[2]; $time = time(); $date = date("Y-m-d H:i:s", time()); $mysql = new SaeMysql(); $res = $mysql->getData("SELECT alias FROM info WHERE FromUserName='******'"); $alias = $res[0]['alias']; if (!$alias) { $data = '由于你是第一次发送动态,请按照以下格式回复基本信息:' . "\n" . '昵称:+你的昵称'; } else { $mysql->runSql("INSERT INTO moments(FromUserName,alias,moment,time,date) VALUES ('{$openid}','{$alias}','{$moment}',{$time},'{$date}')"); $data = "发送成功,你可以现在上传一张图片作为配图,当然也可以不上传啦。回复[动态]查看"; } break; case 'moments2': $alias = $matches[2]; $mysql = new SaeMysql(); $res = $mysql->getData("SELECT * FROM info"); $num = 0; while ($res[$num]) { if ($alias == $res[$num]['alias'] || $alias == '小u' || $alias == 'urinx') { $t = 1; } elseif ($openid == $res[$num]['FromUserName']) { $u = 1; } $num++; } if ($t) { $data = '该用户名已被注册,请重新输入'; } else { if ($u) { $mysql->runSql("UPDATE info SET alias='{$alias}' WHERE FromUserName='******'"); $data = '更改成功!'; } else { $mysql->runSql("INSERT INTO info(FromUserName,alias) VALUES ('{$openid}','{$alias}')"); $data = '注册成功!'; } } break; default: # code... break; } } } return $data; }
window.history.go(-1); </script> <?php } } if ("logout" == $cmd) { setcookie("user_id", "", time() - 3600, "/"); setcookie("user_username", "", time() - 3600, "/"); setcookie("user_key", "", time() - 3600, "/"); ?> <script type="text/javascript"> window.location.href="../../index.php"; </script> <?php } if ("submit-paper" == $cmd) { $mysql = new SaeMysql(); $id = intval($_COOKIE["user_id"]); $sql = "update `qs_user` set `lock`=1 where `id`={$id}"; $rowt = $mysql->runSql($sql); $mysql->closeDb(); setcookie("user_id", "", time() - 3600, "/"); setcookie("user_username", "", time() - 3600, "/"); setcookie("user_key", "", time() - 3600, "/"); ?> <script type="text/javascript"> alert('交卷成功,请离开考场'); window.location.href="../../index.php"; </script> <?php }
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:application/json;charset=UTF-8"); $token = $_GET['token']; $ua = $_SERVER['HTTP_USER_AGENT']; if (empty($token) || strlen($token) < 10) { echo json_encode(array("status" => false, "msg" => "token不正确")); exit; } $mysql = new SaeMysql(); $sql = "select id,code from result where token ='" . $mysql->escape($token) . "'"; $data = $mysql->getData($sql); if (!$data) { $code = date("YmdHis") . "||" . strtoupper(substr(md5("hongcha" . date("YmdHis") . "android"), 1, -1)); $insert_sql = "insert into result (`code`,`token`, `ua`) values ('" . $mysql->escape($code) . "','" . $mysql->escape($token) . "','" . $mysql->escape($ua) . "')"; $mysql->runSql($insert_sql); if ($mysql->errno() != 0) { echo json_encode(array("status" => false, "msg" => "mysql error!")); exit; } } else { $code = $data[0]['code']; } $mysql->closeDb(); //$code = date("YmdHis")."||".strtoupper(substr(md5("hongcha".date("YmdHis")."android"),1,-1)); echo json_encode(array("status" => true, "code" => $code));
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 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(); }
/** * 调用微信接口,重新获取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']; }
if (!empty($huojiang)) { for ($x = 0; $x < count($huojiang); $x += 2) { $str_huojiang .= $huojiang[$x] . "年,荣获《" . $huojiang[$x + 1] . "》。\n"; } } $chenguo = $str_lunwen + $str_huojiang; //########################################################################################## $sql_check = "SELECT * FROM personalinformation_records where gonghao like '{$_POST['gonghao']}'"; $sql = "INSERT INTO personalinformation_records (`uuid`, `gonghao`,`name`, `gender`, `xueli`,\n`zhicheng`, `xuewei`, `zhiwu`, `zhanke`, `shanchang`, `jianli`,`yanjue`,`chengguo`, `check_rsk`, `check_ywk` )\nVALUES('{$_POST['uuid']}','{$_POST['gonghao']}','{$_POST['name']}','{$_POST['gender']}','{$_POST['xueli']}',\n'{$_POST['zhicheng']}','{$_POST['xuewei']}','{$_POST['zhiwu']}','{$_POST['zhanke']}','{$_POST['shanchang']}',\n'{$_POST['jianli']}','{$_POST['yanjue']}','{$_POST['chengguo']}','unchecked','unchecked')"; $sql_update = "UPDATE personalinformation_records SET `name` = '{$_POST['name']}', `gender`='{$_POST['gender']}',\n`xueli`='{$_POST['xueli']}', `zhicheng`='{$_POST['zhicheng']}',\n`xuewei`='{$_POST['xuewei']}',`zhiwu`='{$_POST['zhiwu']}',`zhanke`='{$_POST['zhanke']}',\n`shanchang`='{$_POST['shanchang']}',`jianli`='{$_POST['jianli']}','{$_POST['yanjue']}','{$_POST['chengguo']}' WHERE\n`uuid` LIKE '{$_POST['uuid']}'"; //echo $sql; //include("conn.php"); $mysql = new SaeMysql(); if ($_POST["from"] == "fromItem") { $sql_update = "UPDATE personalinformation_records SET `name` = '{$_POST['name']}', `gender`='{$_POST['gender']}',\n`xueli`='{$_POST['xueli']}', `zhicheng`='{$_POST['zhicheng']}',\n`xuewei`='{$_POST['xuewei']}',`zhiwu`='{$_POST['zhiwu']}',`zhanke`='{$_POST['zhanke']}',\n`shanchang`='{$_POST['shanchang']}',`jianli`='{$_POST['jianli']}','{$_POST['yanjue']}','{$_POST['chengguo']}' WHERE `uuid` LIKE '{$_POST['uuid']}'"; $mysql->runSql($sql_update); } else { $chaxun = $mysql->getData($sql_check); //echo $chaxun->num_rows; if (empty($chaxun)) { //为空,第一次提交 $mysql->runSql($sql); //echo "location:index.php?name={$_POST['name']}&uuid={$_POST['uuid']}"; echo '<script language="javascript"> alert("提交成功!"); window.location.href="login.html"; </script>'; } else { //非空,更新之 //echo $sql_update; //echo "location:index.php?name={$_POST['name']}&uuid={$_POST['uuid']}";
echo $nameErr; ?> "); </script> <?php } else { $is_name = true; } if ($is_examid && $is_name) { $_SESSION['examid'] = $examid; $_SESSION['name'] = $name; //更新数据库 $mysql = new SaeMysql(); $update = "insert into cet (examid,name,openid) VALUES ('{$examid}','{$name}','{$openid}')"; $updata_wx = "update wechat_user set name='{$name}' WHERE openid='{$openid}'"; $bool = $mysql->runSql($update); $bool = $mysql->runSql($updata_wx); if (!$bool) { sae_log("插入考号姓名出错" . $mysql->errmsg()); } $mysql->closeDb(); //跳转 header("Location:http://5.n1gel.sinaapp.com/cet_result.php"); } } //endregion ?> <!doctype> <html lang="zh"> <head> <meta charset="UTF-8">
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; } $id = 0; $mysql = new SaeMysql(); $sql = "select id from result where code ='" . $mysql->escape($code) . "'"; $data = $mysql->getData($sql); if (!$data) { // $insert_sql = "insert into result (`code`, `ua`) values ('" .$mysql->escape($code) . "','". $mysql->escape($ua) ."')"; //$mysql->runSql($insert_sql); //if ($mysql->errno() != 0){ // echo json_encode(array("status" => false, "msg" => "mysql error!")); // exit(); //} //$id = $mysql->lastId(); echo json_encode(array("status" => false, "msg" => "请刷新后重试!")); exit; } else { $id = intval($data[0]["id"]); } $update_sql = "update result set {$poc[$poc_suc]} = 1 where id = {$id} and code ='" . $mysql->escape($code) . "'"; $mysql->runSql($update_sql); if ($mysql->error() != 0) { echo json_encode(array("status" => false, "msg" => "update error!")); exit; } $mysql->closeDb(); echo json_encode(array("status" => true, "msg" => "update success!")); exit;
</head> <body> <?php //var_dump($_POST); $login_name = $_COOKIE['name']; if (empty($login_name)) { header("login.html"); } $uuid = $_GET["uuid"]; $sql = "SELECT * FROM personalinformation_records WHERE uuid like '{$uuid}'"; $sql_update_uuid = "UPDATE personalinformation_users SET uuid='{$uuid}' WHERE user LIKE '{$_COOKIE['name']}'"; //更新uuid、在user注册表里 //echo $sql; $mysql->runSql($sql_update_uuid); //$mysqli->query($sql_update_uuid); $check = $mysql->getData($sql); // 获取信息 查看是否是已经审核的内容 //从数据库中获取该用户的信息,并自动填写相应的选项。 //没有信息则为空 //从login页面传递name //statusOfEdit 0表示均可以编辑 1表示只能编辑进一步的信息 无法修改基本信息 2表示均无法修改 $statusOfEdit = 0; if (isset($check)) { $data = $check[0]; //var_dump($data); if ($data["check_rsk"] == "checked") { $statusOfEdit = 1; if ($data["check_ywk"] == "checked") { echo "<div class='head_title' >您的信息已经通过审核!</div>";
} .admin{ margin-left: 50%; } .fengsu{ width: 200px; margin-left: -100px; } </style> </head> <?php if ($value != 0) { $mysql = new SaeMysql(); for ($i = $value - 4; $i <= $value; $i++) { $query = "update toupiao set caozuo = '0' where id = {$i}"; $result = $mysql->runSql($query); } } ?> <body> <img src="backgroud.jpg" width="100%" height="100%" style="position:absolute;top:0;left:0;z-index:-1"> <p><a href="admin.php"><img src="title.png" /></a></p> <h2 align="center">固话打分</h2> <div class='admin'> <div class='fengsu'> <form action="admin_dafeng.php" method="post"> <select name="sum_value"> <option value="5">5</option> <option value="10">10</option> <option value="15">15</option>
<?php $channel = new SaeChannel(); $name = 'user' . time() . '-' . rand(0, 10000); $duration = 3600; $url = $channel->createChannel($name, $duration); $mysql = new SaeMysql(); $sql = "SELECT name FROM online LIMIT 1"; $sqlback = $mysql->getData($sql); if ($sqlback[0]['name']) { $to = $sqlback[0]['name']; $mysql->runSql("delete from online where name='{$to}'"); } else { $mysql->runSql("insert into online(name) values('{$name}')"); }
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(); }
//从数组取出两个变量 $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 { // echo "你已成功注册" . "<br/>"; // echo "即将跳转到备份的页面"; // echo "if 111111"; //跳到填写考号和姓名的页面 header("Location:http://5.n1gel.sinaapp.com/cet_query.php"); //填写之后,更新session,更新数据库 } //用户已注册,为备份考号和姓名 } elseif (empty($examid)) { // echo "即将跳转到备份的页面"; // echo "if 222222222";
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; }
include "base-class.php"; //新建sae数据库类 $mysql = new SaeMysql(); //获取当前页码 $page = intval($_GET["page"]); //获取操作标识传入 $action = $_GET["action"]; $action = string::un_script_code($action); $action = string::un_html($action); //是否删除 if ($action == "del") { //获取部门ID号传入 $class_id = intval($_GET["class_id"]); //获取当前时间 $nowtime = date("Y/m/d H:i:s", time()); $mysql->runSql("update class set status=0,edittime='{$nowtime}' where class_id={$class_id}"); echo "<script>alert('操作成功!');location='class_manager.php?page={$page}';</Script>"; exit; } //列表数据获取、分页 //计算总数 $count = $mysql->getVar("select COUNT(*) from class where status=1"); //如果数据表里有数据 if ($count) { //每页显示记录数 $page_num = 2; //如果无页码参数则为第一页 if ($page == 0) { $page = 1; } //计算开始的记录序号
include_once "base-class.php"; //新建sae数据库类 $mysql = new SaeMysql(); //获取当前页码 $page = intval($_GET["page"]); //获取操作标识传入 $action = $_GET["action"]; $action = string::un_script_code($action); $action = string::un_html($action); //是否删除 if ($action == "del") { //获取问题ID号传入 $question_id = intval($_GET["question_id"]); //获取当前时间 $nowtime = date("Y/m/d H:i:s", time()); $mysql->runSql("update question set status=0 where question_id={$question_id}"); echo "<script>alert('操作成功!');location='question_manager.php?page={$page}';</Script>"; exit; } //列表数据获取、分页 //计算总数 $count = $mysql->getVar("select COUNT(*) from question_tb where status=1"); //如果数据表里有数据 if ($count) { //每页显示记录数 $page_num = 10; //如果无页码参数则为第一页 if ($page == 0) { $page = 1; } //计算开始的记录序号
<?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>";
static function RunSaeSql($sql) { $mysql = new SaeMysql(); self::$result_str = $sql; $mysql->runSql($sql); $mysql->closeDb(); }
public function saemysql() { $mysql = new SaeMysql(); $mysql->runSql('create table saetest(`id` int(11) NOT NULL);'); echo '在本地时请先配置好数据库,本程序执行完毕后会向数据库中建立名为saetest数据表'; }
<?php $memberIds = $_POST[members]; $num = count($memberIds); $amount = $_POST[amount]; $reason = $_POST[reason]; $sql1 = "insert into outcome (amount,reason,time,personnum) values ({$amount},'{$reason}',now(),{$num})"; $sql2 = "update depot set updatetime = now(), balance = balance-{$amount}"; $mysql = new SaeMysql(); $mysql->runSql("set names 'utf8'"); $mysql->runSql($sql1); if ($mysql->errno() != 0) { die("Error:" . $mysql->errmsg()); } $autoKey = $mysql->lastId(); $mysql->runSql($sql2); if ($mysql->errno() != 0) { die("Error:" . $mysql->errmsg()); } $avg = round($amount / $num, 2); foreach ($memberIds as $id) { $sql3 = "update member set updatetime = now(), balance = balance-{$avg} where id = {$id}"; $sql4 = "insert into out_member values({$autoKey},{$id})"; $mysql->runSql($sql3); $mysql->runSql($sql4); } $mysql->closeDb(); echo "<SCRIPT LANGUAGE='JavaScript'>"; echo "location.href='outcome.php'"; echo "</SCRIPT>";
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); //默认参数 $nowtime = date("Y/m/d H:i:s", time()); //如果是修改 if ($old_class_id) { //修改部门名称、所属、更新时间 $sql = "update class set class_name='{$class_name}',class_fid='{$class_fid}',edittime='{$nowtime}'\n where class_id={$old_class_id}"; $mysql->runSql($sql); } else { //新增 $sql = "insert into class (class_name,class_fid,addtime,edittime,status) values ('{$class_name}',\n '{$class_fid}','{$nowtime}','{$nowtime}',1)"; $mysql->runSql($sql); } if ($mysql->errno() != 0) { echo "<script>alert('" . $mysql->errmsg() . "');history.back();</Script>"; exit; } else { echo "<script>alert('操作成功!');location='class_add.php?class_id={$old_class_id}';</Script>"; exit; } } $class_list = $mysql->getData("select class_name,class_id from class where status=1 order by class_fid asc"); ?>
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; }