function handleSubscribe($postObj) { $uid = 0; $params = array(array("" . $postObj->FromUserName, SQLSRV_PARAM_IN), array("" . $postObj->ToUserName, SQLSRV_PARAM_IN), array($uid, SQLSRV_PARAM_INOUT)); $sp = "{call app_subscrible(?,?,?)}"; sp_execute($sp, $params); // //关注时通过微信号获取用户基本信息 if ($user = get_unionid_userinfo(db_get_token_ticket(CFG_APPID, CFG_SECRET)["token"], $postObj->FromUserName)) { $params = array(array("" . $user["openid"], SQLSRV_PARAM_IN), array("" . $user["nickname"], SQLSRV_PARAM_IN), array("" . $user["province"], SQLSRV_PARAM_IN), array("" . $user["city"], SQLSRV_PARAM_IN), array("" . $user["country"], SQLSRV_PARAM_IN), array(intval($user["sex"]), SQLSRV_PARAM_IN), array("" . $user["headimgurl"], SQLSRV_PARAM_IN)); sp_execute("{call app_set_userinfo(?,?,?,?,?,?,?)}", $params); } else { db_log("获取用户信息失败!"); } //用户扫描带场景值二维码 $cids = ""; if (strstr($postObj->EventKey, "qrscene_")) { $cids = substr($postObj->EventKey, strlen("qrscene_")); $cid = str2num(canteenid_content, $cids); } else { $cid = 0; } // $sp = "{call app_user_add_canteen(?,?)}"; $params = array(array($uid, SQLSRV_PARAM_IN), array($cid, SQLSRV_PARAM_IN)); $rs = sp_execute($sp, $params); // response_canteen_welcome($postObj, $cids, $rs[0]["cname"], $rs[0]["picurl"], $rs[0]["newsid"]); }
/** * @return true on success false on failure */ public function delete() { if (!$this->view()) { $this->errormsg[] = Config::lang($this->msg['error_does_not_exist']); return false; } db_delete($this->db_table, $this->id_field, $this->id); db_log($this->id, 'delete_fetchmail', $this->result['id']); $this->infomsg[] = Config::Lang_f('pDelete_delete_success', $this->result['src_user'] . ' -> ' . $this->result['mailbox']); return true; }
function db_get_all($sql, $fetchmode = MDB2_FETCHMODE_ORDERED, $_db = NULL) { global $db, $db_error_message; if ($_db == NULL) { $_db = $db; } db_log(5, "Query: {$sql}"); $db_error_message = NULL; $result = $_db->queryAll($sql, NULL, $fetchmode); if (PEAR::isError($result)) { $db_error_message = $result->message; db_log(1, "Query Error: {$db_error_message} {$sql}"); return NULL; } else { db_log(5, "Query results: " . count($result)); return $result; } }
/** * 处理关注微信号 * @param $postObj */ function handleSubscribe($postObj) { $sub_scan_flag = 0; $uid = 0; $params = array(array("" . $postObj->FromUserName, SQLSRV_PARAM_IN), array("" . $postObj->ToUserName, SQLSRV_PARAM_IN), array($uid, SQLSRV_PARAM_OUT)); sp_execute("{call app_subscrible(?,?,?)}", $params); //关注时通过微信号获取用户基本信息 if ($user = get_unionid_userinfo(db_get_token_ticket(CFG_APPID, CFG_SECRET)["token"], $postObj->FromUserName)) { $params = array(array("" . $user["openid"], SQLSRV_PARAM_IN), array("" . $user["nickname"], SQLSRV_PARAM_IN), array("" . $user["province"], SQLSRV_PARAM_IN), array("" . $user["city"], SQLSRV_PARAM_IN), array("" . $user["country"], SQLSRV_PARAM_IN), array(intval($user["sex"]), SQLSRV_PARAM_IN), array("" . $user["headimgurl"], SQLSRV_PARAM_IN)); sp_execute("{call app_set_userinfo(?,?,?,?,?,?,?)}", $params); } else { db_log("获取用户信息失败!"); } //用户扫描带场景值二维码 if (strstr($postObj->EventKey, "qrscene_")) { $sub_scan_flag = 1; $scenestr = substr($postObj->EventKey, strlen("qrscene_")); $scenestr = explode("-", $scenestr); $uid_from = str2num(CFG_ID_USER, $scenestr[0]); $cid = str2num(CFG_ID_CAR, $scenestr[1]); log_file("sub, uid_from:{$uid_from}, cid:{$cid}, uid:{$uid}"); //共享车辆 $params = array(array($cid, SQLSRV_PARAM_IN), array($uid_from, SQLSRV_PARAM_IN), array($uid, SQLSRV_PARAM_IN)); sp_execute("{call app_share_car(?,?,?)}", $params); } else { log_file("场景值信息有误"); } if ($sub_scan_flag == 0) { //准备图文消息 $newsContent = array("title" => "您好,欢迎关注金创想!", "description" => "点击查看详情", "picUrl" => CFG_HTTP . "images/jcx0826.png", "url" => CFG_HTTP . "mobile/car_list.php"); response_news($postObj, $newsContent); } else { //查询分享发起人信息 $params = array(array($uid_from, SQLSRV_PARAM_IN), array("", SQLSRV_PARAM_IN)); $rs = sp_execute("{call app_get_userinfo(?,?)}", $params); //准备图文消息 $newsContent = array("title" => "好友" . $rs[0]["nickname"] . "的车辆信息", "description" => "点击查看详情", "picUrl" => CFG_HTTP . CFG_CAR_DEFAULT, "url" => CFG_HTTP . "mobile/car_list.php"); response_news($postObj, $newsContent); } }
if (trim($sSchema) != '') { $sSqlConsultaSchema = " select exists ( select 1 "; $sSqlConsultaSchema .= " from information_schema.schemata "; $sSqlConsultaSchema .= " where information_schema.schemata.schema_name = '{$sSchema}' ) "; $aDadosSchema = DB::query($sSqlConsultaSchema); if (is_bool($aDadosSchema)) { throw new Exception("Falha ao consultar schemas SQL : {$sSqlConsultaSchema}"); } if (!$aDadosSchema->fetchColumn()) { if (is_bool(DB::exec("CREATE SCHEMA {$sSchema} "))) { throw new Exception("Falha ao criar schema {$sSchema} !"); } if (is_bool(DB::exec("ALTER DATABASE " . DB::getInstance()->getDataBase() . " SET search_path TO {$sSchema} "))) { throw new Exception("Falha ao alterar schema atual para {$sSchema} !"); } } if (is_bool(DB::exec("SET search_path TO {$sSchema} "))) { throw new Exception("Falha ao definir schema atual para {$sSchema} !"); } } $oDataBaseVersioning = new DatabaseVersioning($sSchema); $oDataBaseVersioning->setFileLog($sFileLog); $oDataBaseVersioning->upgradeDatabase(); } catch (Exception $eException) { DB::rollBack(); db_log($eException->getMessage() . "\n", $sFileLog); exit; } DB::commit(); db_log("Processo Finalizado com Sucesso!\n", $sFileLog);
} return $response; } // instantiating a new bot $bot = new telegram_bot($token); // instantiating a new triggers set $ts = new telegram_trigger_set($botname, $singletrigger); // registering the triggers $ts->register_trigger_command("trigger_welcome", ["/start", "/welcome", "/hi"], 0); $ts->register_trigger_command("trigger_help", ["/help"], 0); $ts->register_trigger_command("trigger_photo", ["/getphoto", "/photo", "/picture"], -1); // parameters count is ignore // error trigger $ts->register_trigger_error("trigger_err"); // receiving data sent from the user $message = $bot->read_post_message(); $date = $message->message->date; $chatid = $message->message->chat->id; $text = $message->message->text; // running triggers management $response = $ts->run($bot, $chatid, $text); // returns an array of triggered events // log messages exchange on the database db_log($botname, 'recv', $chatid, 'text', $text, $date); if (count($response) > 0) { foreach ($response as $r) { db_log($botname, 'sent', $chatid, $r['type'], $r['content'], $date); } } else { db_log($botname, 'error', $chatid, 'Error', $date); }
if ($result['rows'] == 1) { $error = 1; $tAddress = escape_string($_POST['fAddress']); $tGoto = $fGoto; $tDomain = $fDomain; $pCreate_alias_address_text = $PALANG['pCreate_alias_address_text_error2']; } if ($fActive == "on") { $sqlActive = db_get_boolean(True); } else { $sqlActive = db_get_boolean(False); } if ($error != 1) { if (preg_match('/^\\*@(.*)$/', $fGoto, $match)) { $fGoto = "@" . $match[1]; } $result = db_query("INSERT INTO {$table_alias} (address,goto,domain,created,modified,active) VALUES ('{$fAddress}','{$fGoto}','{$fDomain}',NOW(),NOW(),'{$sqlActive}')"); if ($result['rows'] != 1) { $tDomain = $fDomain; $tMessage = $PALANG['pCreate_alias_result_error'] . "<br />({$fAddress} -> {$fGoto})<br />\n"; } else { db_log($SESSID_USERNAME, $fDomain, 'create_alias', "{$fAddress} -> {$fGoto}"); $tDomain = $fDomain; $tMessage = $PALANG['pCreate_alias_result_success'] . "<br />({$fAddress} -> {$fGoto})<br />\n"; } } } include "templates/header.php"; include "templates/menu.php"; include "templates/create-alias.php"; include "templates/footer.php";
function add_first_user() { global $input; // Add the first user in database $first_user = file_get_contents("../first_user"); $first_user = explode(" , ", $first_user); $user_ID = $first_user[0]; $surname = $first_user[3]; $forename = $first_user[2]; $passwd = $first_user[1]; $permissions = 1; // try { if (!db_ready()) { db_prepare(); } db_user_create($user_ID, $surname, $forename, $passwd, $permissions); add_admin_to_file($user_ID); push_users_to_ezmanager(); db_log(db_gettable('users'), 'Created user ' . $user_ID, $_SESSION['user_login']); db_close(); // } catch (PDOException $e) { // $errors['db_error'] = $e->getMessage(); // require template_getpath('install.php'); // die; // } session_destroy(); unlink("../first_user"); require template_getpath('install_success.php'); }
// echo '<div class="item" style="height:40px;">'; echo '<div class="item-txtname">电话</div>'; echo '<div class="item-txtval">'; echo '<input type="tel" id="canteenTel" name="canteenTel" placeholder="请输入餐厅电话" value="" class="txt-input" maxlength="30">'; echo '</div>'; echo '</div>'; } ?> <div class="ui-btn-wrap"> <?php if ($_REQUEST["action"] == "finish") { db_log("user_canteen_create:9"); echo '<button id="register" onclick="location.href=\'mycanteen.php\'" class="ui-btn-lg ui-btn-green">点击进入</button>'; } else { db_log("user_canteen_create:10"); echo '<button id="register" onclick="toRegister()" class="ui-btn-lg ui-btn-primary">立即注册</button>'; } ?> </div> </div> </div> </div> <script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script> <script> <?php //通过access_token获取jsapi_ticket $ticket = db_get_token_ticket(CFG_APPID, CFG_SECRET)["ticket"]; $signPackage = get_sign_package(CFG_APPID, $ticket); ?>
/** * store $this->values in the database * * converts values based on $this->struct[*][type] (boolean, password encryption) * * calls $this->storemore() where additional things can be done * @return bool - true if all values were stored in the database, otherwise false * error messages (if any) are stored in $this->errormsg */ public function store() { if ($this->values_valid == false) { $this->errormsg[] = "one or more values are invalid!"; return false; } if (!$this->beforestore()) { return false; } $db_values = $this->values; foreach (array_keys($db_values) as $key) { switch ($this->struct[$key]['type']) { # modify field content for some types case 'bool': $db_values[$key] = db_get_boolean($db_values[$key]); break; case 'pass': $db_values[$key] = pacrypt($db_values[$key]); break; case 'b64p': $db_values[$key] = base64_encode($db_values[$key]); break; case 'quot': case 'vnum': case 'vtxt': unset($db_values[$key]); # virtual field, never write it break; } if ($this->struct[$key]['not_in_db'] == 1) { unset($db_values[$key]); } # remove 'not in db' columns if ($this->struct[$key]['dont_write_to_db'] == 1) { unset($db_values[$key]); } # remove 'dont_write_to_db' columns } if ($this->new) { $result = db_insert($this->db_table, $db_values); } else { $result = db_update($this->db_table, $this->id_field, $this->id, $db_values); } if ($result != 1) { $this->errormsg[] = Config::lang_f($this->msg['store_error'], $this->label); return false; } $result = $this->storemore(); # db_log() even if storemore() failed db_log($this->domain, $this->msg['logname'], $this->id); if ($result) { # return success message # TODO: add option to override the success message (for example to include autogenerated passwords) $this->infomsg['success'] = Config::lang_f($this->msg['successmessage'], $this->label); } return $result; }
$redirect_uri = urlencode(CFG_HTTP . "mobile/sales_scan.php?cids=" . $_REQUEST["cids"] . "&winids=" . $_REQUEST["winids"] . "&action=setcookie"); weixin_require_auth($redirect_uri); } exit; } $tipMsg = ""; $wid = $_COOKIE["wxp_user_openid"]; $cids = $_REQUEST["cids"]; $winids = $_REQUEST["winids"]; $cid = str2num(canteenid_content, $cids); $winid = str2num(saleswin_content, $winids); //debug:1 $mode = 0; $ret = " "; $params = array(array("" . $wid, SQLSRV_PARAM_IN), array($cid, SQLSRV_PARAM_IN), array($winid, SQLSRV_PARAM_IN), array($mode, SQLSRV_PARAM_IN), array($ret, SQLSRV_PARAM_OUT)); db_log("sales_scan:wid:{$wid}, cid:{$cid}, winid:{$winid}"); $rs = sp_execute("{call app_sales_scan(?,?,?,?,?)}", $params); if ($ret == "ok_master") { $tipMsg = '您已经成为【' . $rs[0]["cname"] . '】[' . $rs[0]["winname"] . ']的管理员'; } else { if ($ret == "ok_sales") { //send message altermsg_for_sales($cids, $rs[0]["oid"], $rs[0]["uname"], $rs[0]["cname"], $rs[0]["winname"], $rs[0]["pay_sta"], $rs[0]["uid"], $rs[0]["amount"], $rs[0]["total"], $rs[0]["wid_m"]); $tipMsg = '已将您的订餐信息通知给【' . $rs[0]["cname"] . '】管理员'; } else { $tipMsg = $ret; } } ?> <!DOCTYPE html> <html>
/** * @return true on success false on failure */ public function delete() { if (!$this->view()) { $this->errormsg[] = Config::Lang($this->msg['error_does_not_exist']); return false; } db_delete('domain_admins', $this->id_field, $this->id); db_delete($this->db_table, $this->id_field, $this->id); db_log('admin', 'delete_admin', $this->id); # TODO delete_admin is not a valid db_log keyword yet, and 'admin' is not displayed in viewlog.php $this->infomsg[] = Config::Lang_f('pDelete_delete_success', $this->id); return true; }
//设置有效期7天 $time = time() + 3600 * 24 * 7; weixin_auth_openid_set_cookie($user, $time); echo '<script>location.href="http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . '"</script>'; exit; } } else { db_log("check_cookie:5"); //处理需要重定向的URL中是否带有参数 $qstr = $_SERVER["QUERY_STRING"]; $t = "?"; if (strlen($qstr) > 0) { $t = "&"; } $redirect_uri = urlencode('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . $t . "act_sc=setcookie"); weixin_require_auth($redirect_uri); exit; } } db_log("check_cookie:6"); //通过用户微信号获取用户ID $params = array(array(0, SQLSRV_PARAM_IN), array("" . $_COOKIE["wxp_user_openid"], SQLSRV_PARAM_IN)); $rs = sp_execute("{call app_get_userinfo(?,?)}", $params); if (count($rs) > 0) { $_SESSION["uid"] = $rs[0]["uid"]; db_log("check_cookie:7"); } else { db_log("check_cookie:8"); //db_log("用户不存在,wid=".$_COOKIE["wxp_user_openid"]); } }
// close connection //=== Archive compressed databases using 7z unset($output); // Clear output error buffer exec("7za.exe a -t7z {$DEST}/{$BACKUP_NAME}.7z {$TEMP}/*.7z 2>&1", $output, $res); if ($res > 0) { // Was compression OK db_log("Archived Failed: {$BACKUP_NAME}.7z"); // No: Log failed db_log(".............................................................\n"); die(" Archived Failed: \n {$BACKUP_NAME}.7z"); // No: Failed } else { db_log("Archived OK: {$BACKUP_NAME}.7z"); //Yes: Log pass db_log(".............................................................\n"); print " Archived OK: {$BACKUP_NAME}.7z \n"; } //=== Remove files in temp folder if ($dir = @opendir($TEMP)) { while (($file = readdir($dir)) !== false) { if (!is_dir($file)) { unlink($TEMP . '/' . $file); } } } closedir($dir); //=== Delete temp folder rmdir($TEMP); //=== Log ===================================================================== // Logs Database actions to a log file
<script src="plugins/sweetalert/sweetalert.min.js?v=2"></script> <!--sweet-alert plugin end--> </head> <body> <div class="body"> <div style="height:2px;"></div> <!--topsearch--> <div class="container"> <?php $closeord = 0; if ($oid > 0) { echo '<div class="headerCnameTips">' . $_SESSION["cname"] . '</div>'; //处理消息链接带oids进来 $closeord = 1; } db_log($cid); $sp = "{call app_get_canteen_ords(?)}"; $params = array(array($cid, SQLSRV_PARAM_IN)); $rs = sp_execute($sp, $params); $haveOK = false; //当前有订单 if (count($rs) > 0) { foreach ($rs as $row) { if ($oid != 0 && $row["oid"] != $oid) { continue; } $haveOK = true; $oids = num2str_x(orderid_content_x, $row["oid"]); $stateColor = $row["state"] == 1 ? "chengse1" : ($row["state"] == 11 ? "statecolor1" : ($row["state"] == 18 ? "statecolor2" : "statecolor2")); ?> <div class="ordertitletime" id="Time_Index_<?php
} else { if ($action == "user_set_sales_win") { $winids = $_REQUEST["winids"]; $winid = str2num(saleswin_content, $winids); $winname = $_POST["winname"]; //生成二维码 $path = dirname(__FILE__) . "/upload/qrcode/"; $name = md5(time()) . '.png'; $filename = $path . $name; //ready param $cids = num2str(canteenid_content, $_SESSION["cid"]); $codeText = CFG_HTTP . "mobile/sales_scan.php?cids={$cids}&winids={$winids}"; QRcode::png($codeText, $filename, L, 12, 2); $winver = "qrcode/{$name}"; $windesc = $_POST["windesc"]; db_log("winid:{$winid}, winname:{$winname}, verurl:{$winver}, desc:{$windesc}, cid:" . $_SESSION["cid"]); $params = array(array(intval($_SESSION["cid"]), SQLSRV_PARAM_IN), array($winid, SQLSRV_PARAM_IN), array("" . $winname, SQLSRV_PARAM_IN), array("" . $winver, SQLSRV_PARAM_IN), array("" . $windesc, SQLSRV_PARAM_IN)); sp_execute("{call web_set_sales_win(?,?,?,?,?)}", $params); $status = "ok"; $info = $name; } else { if ($action == "set_canteen_allow_order") { $params = array(array(intval($_SESSION["cid"]), SQLSRV_PARAM_IN), array(intval($_REQUEST["orden"]), SQLSRV_PARAM_IN)); sp_execute("{call web_set_canteen_sale_state(?,?)}", $params); $status = "ok"; $info = "成功"; } } } } }
} if (empty($array[$i])) { continue; } if (!check_email($array[$i])) { $error = 1; $tGoto = $goto; $tMessage = $PALANG['pEdit_alias_goto_text_error2'] . "{$array[$i]}</font>"; } } if ($error != 1) { if (empty($goto)) { $goto = $USERID_USERNAME; } if ($fVacation == "YES") { $goto .= "," . $vacation_goto; } $result = db_query("UPDATE {$table_alias} SET goto='{$goto}',modified=NOW() WHERE address='{$USERID_USERNAME}'"); if ($result['rows'] != 1) { $tMessage = $PALANG['pEdit_alias_result_error']; } else { db_log($USERID_USERNAME, $USERID_DOMAIN, 'edit_alias', "{$USERID_USERNAME} -> {$goto}"); header("Location: main.php"); exit; } } include "../templates/header.php"; include "../templates/users_menu.php"; include "../templates/users_edit-alias.php"; include "../templates/footer.php"; }
{ db_log ($CONF['admin_email'], $fDomain, 'create_mailbox', $fUsername); */ /* TODO: this is the start of /create-mailbox code segment that was originally used in /create-mailbox.php instead of the above from admin/create-mailbox.php. To be compared / merged. */ $result = db_query("INSERT INTO {$table_mailbox} (username,password,name,maildir,quota,domain,created,modified,active) VALUES ('{$fUsername}','{$password}','{$fName}','{$maildir}','{$quota}','{$fDomain}',NOW(),NOW(),'{$sqlActive}')"); if ($result['rows'] != 1 || !mailbox_postcreation($fUsername, $fDomain, $maildir, $quota)) { $tDomain = $fDomain; $tMessage .= $PALANG['pCreate_mailbox_result_error'] . "<br />({$fUsername})<br />"; db_query('ROLLBACK'); } else { db_query('COMMIT'); db_log($SESSID_USERNAME, $fDomain, 'create_mailbox', "{$fUsername}"); /* TODO: this is the end of /create-mailbox.php code segment */ $tDomain = $fDomain; if ($CONF['generate_password'] == "YES") { $tMessage .= " / {$fPassword})</br />"; } else { if ($CONF['show_password'] == "YES") { $tMessage .= " / {$fPassword})</br />"; } else { $tMessage .= ")</br />"; } } $tQuota = $CONF['maxquota']; if ($fMail == "on") {
function remove_renderer() { global $input; if (!renderer_delete(trim($input['name']))) { echo json_encode(array('error' => '1')); } else { echo json_encode(array('success' => '1')); db_log("renderers", 'Deleted renderer ' . $input['name'], $_SESSION['user_login']); push_renderers_to_ezmanager(); // notify_changes(); } }
<!--sweet-alert plugin end--> </head> <body> <div class="body"> <div style="height:2px;"></div> <!--topsearch--> <div class="container"> <?php if ($_SESSION["act"] == 'preoids' || $_SESSION["act"] == 'preuids') { echo '<div class="headerCnameTips">' . $_SESSION["cname"] . '</div>'; } $haveOK = false; //当前有订单 if (count($rs) > 0) { foreach ($rs as $row) { db_log("oid:" . $row["oid"]); //if($_SESSION["act"]=='preoids' && $row["oid"]!=$_SESSION["oid"]) continue; $haveOK = true; $oids = num2str_x(orderid_content_x, $row["oid"]); $stateColor = $row["state"] == 1 ? "chengse1" : ($row["state"] == 11 ? "statecolor1" : ($row["state"] == 18 ? "statecolor2" : "statecolor2")); ?> <div class="ordertitletime" id="Time_Index_<?php echo $row["oid"]; ?> " style="margin-top:10px;"><?php echo $row["cdt"]; ?> </div> <div class="admin-order-wrap" id="Order_Index_<?php echo $row["oid"]; ?>
/** * 根据类型菜单类型跳转 * @param $row * @param $state */ function canteen_menu_redirect($row, $state) { db_log("mycanteen:8"); $menu_list = array("user_mymenu0.php", "user_mymenu1.php"); $mode = $row["menumode"]; if ($row["master"] == 1) { echo "<script>location.href='admin_overview.php'</script>"; } else { if ($state <= 1) { echo "<script>location.href='user_info.php?action=new'</script>"; } else { if ($mode == 0 || $mode == 1) { echo "<script>location.href='{$menu_list[$mode]}'</script>"; } else { echo "<script>alert('未定义菜单类型:{$mode}');</script>"; } } } }
$message = $_GET['message']; // checking if logs are enabled (see https://github.com/auino/php-telegram-bot-library for more information) if (!LOGS_ENABLED) { exit("Logs are not enabled for this bot."); } // creating the bot object $bot = new telegram_bot($TELEGRAM_TOKEN); try { // creating base chat list $chatlist = array(); if ($chatid != null) { array_push($chatlist, $chatid); } else { $chatlist = db_getchatlist($TELEGRAM_BOTNAME); } // iterating over the chat list foreach ($chatlist as $chat) { // getting current date $date = (string) time(); // sending the message $r = $bot->send_message($chat, $message); // log sent message on the database @db_log($TELEGRAM_BOTNAME, 'sent', $chat, 'text', $message, $date); } // printing output echo "Message(s) sent!"; } catch (Exception $e) { @db_log($TELEGRAM_BOTNAME, 'error', $chatid, 'Error', $date); // printing the error echo "Error: {$e}"; }
db_log("verifylogin:7"); session_id($_REQUEST["sessionid"]); $_SESSION["wxp_user_openid"] = $_COOKIE["wxp_user_openid"]; $_SESSION["uid"] = $rs[0]["uid"]; $_SESSION["roleid"] = $rs[0]["roleid"]; $_SESSION["cid"] = $rs[0]["cid"]; $_SESSION["uname"] = $rs[0]["uname"]; echo json_encode(array("status" => "ok")); exit; } else { db_log("verifylogin:8"); echo json_encode(array("status" => "error")); exit; } } else { db_log("verifylogin:9"); } } ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title></title> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <meta content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport"> <!-- Mobile Devices Support @begin --> <meta content="application/xhtml+xml;charset=UTF-8" http-equiv="Content-Type"> <meta content="no-cache,must-revalidate" http-equiv="Cache-Control"> <meta content="no-cache" http-equiv="pragma"> <meta content="0" http-equiv="expires">
/** * @return true on success false on failure */ public function delete() { if (!$this->view()) { $this->errormsg[] = Config::Lang('alias_does_not_exist'); return false; } if ($this->result['is_mailbox']) { $this->errormsg[] = Config::Lang('mailbox_alias_cant_be_deleted'); return false; } db_delete('alias', 'address', $this->id); list(, $domain) = explode('@', $this->id); db_log($domain, 'delete_alias', $this->id); $this->infomsg[] = Config::Lang_f('pDelete_delete_success', $this->id); return true; }
function loadScripts() { $sDirectoryScripts = 'db'; if (!is_dir($sDirectoryScripts)) { throw new Exception("Diretório {$sDirectoryScripts} não existe!"); } if (!$this->checkTablesVersioning()) { return false; } $sLastVersion = " select version "; $sLastVersion .= " from " . $this->getSchema() . "database_version "; $sLastVersion .= " order by version desc limit 1 "; $oLastVersion = DB::query($sLastVersion); if (is_bool($oLastVersion)) { throw new Exception("ERRO: Ao executar SQL {$sLastVersion} "); } if ($oLastVersion->rowCount() == 0) { $iLastVersion = 0; } else { $iLastVersion = $oLastVersion->fetchColumn(); } $sDirectoryCheck = $sDirectoryScripts . '/' . $iLastVersion; while (is_dir($sDirectoryCheck)) { db_log("AVISO: Verificando Scripts em {$sDirectoryCheck}", $this->sFileLog, $this->iParamLog); $aFiles = scandir($sDirectoryCheck); $sSqlExists = " select * \n from " . $this->getSchema() . "database_version \n where version = {$iLastVersion} "; $oExists = DB::query($sSqlExists); $iOrd = 0; if ($oExists->rowCount() == 0) { db_log("AVISO: Inserindo versão {$iLastVersion} do schema da base de dados", $this->sFileLog, $this->iParamLog); $sInsert = "INSERT INTO " . $this->getSchema() . "database_version(version) VALUES ({$iLastVersion})"; if (is_bool(DB::query($sInsert))) { throw new Exception("ERRO: Ao executar SQL {$sInsert} "); } } else { $sLastOrder = "SELECT coalesce(max(ord),0) FROM " . $this->getSchema() . "database_version_sql WHERE version = {$iLastVersion}"; $oLastOrder = DB::query($sLastOrder); $iOrd = $oLastOrder->fetchColumn(); } foreach ($aFiles as $sFile) { if ($sFile == '.' or $sFile == '..') { continue; } $aPathInfo = pathinfo($sDirectoryCheck . '/' . $sFile); if ($aPathInfo['extension'] != 'sql') { continue; } $sSqlExists = " select * \n from " . $this->getSchema() . "database_version_sql \n where sql_name = '{$sFile}' \n and version = {$iLastVersion}"; $oLastOrder = DB::query($sSqlExists); if ($oLastOrder->rowCount() == 0) { $iOrd++; db_log("AVISO: Carregando script {$sFile} da versão {$iLastVersion} na ordem de execução {$iOrd}", $this->sFileLog, $this->iParamLog); $sScriptContent = file_get_contents($sDirectoryCheck . '/' . $sFile); $sScriptContent = addslashes($sScriptContent); $sInsert = "INSERT INTO " . $this->getSchema() . "database_version_sql (sql_name, version, ord, script) "; $sInsert .= "VALUES ('{$sFile}', {$iLastVersion}, {$iOrd}, '{$sScriptContent}')"; if (is_bool(DB::query($sInsert))) { throw new Exception("ERRO: Ao executar SQL {$sInsert} "); } } } $iLastVersion++; $sDirectoryCheck = $sDirectoryScripts . '/' . $iLastVersion; } }
try { db_log("Processo inicializado", $sFileLog); /** * Arquivo com configuracoes de acesso ao banco */ require_once PATH . '../../app/config/database.php'; $oDatabase = new DATABASE_CONFIG(); $aConfig = $oDatabase->default; db_log("Conectando a base", $sFileLog); $pConnection = @pg_connect("host={$aConfig['host']} dbname={$aConfig['database']} port={$aConfig['port']} user={$aConfig['login']} password={$aConfig['password']}"); if (!$pConnection) { throw new Exception('Erro ao conectar ao banco de dados.'); } pg_query($pConnection, 'begin'); /** * Caminho com arquivos de atualizacao da base */ DBDataBaseMigration::$sPathScrips = PATH . "db"; /** * Atualiza base caso exista alguem arquivo sql nao executado ainda */ db_log("Atualizando base", $sFileLog); DBDataBaseMigration::upgradeDatabase($pConnection); pg_query($pConnection, 'commit'); db_log("Processo Finalizado com Sucesso!", $sFileLog); } catch (Exception $eException) { if ($pConnection) { pg_query($pConnection, 'rollback'); } db_log($eException->getMessage(), $sFileLog); }
$uploadPath = dirname(dirname(__FILE__)) . "/upload/shop/"; $tmpFile = "aaa.jpg"; $time = time(); $ext = ".jpg"; saveWeixinFile($uploadPath . $tmpFile, $fileinfo["body"]); my_image_resize($uploadPath . $tmpFile, $uploadPath . $time . $ext, 375, 300); } // $canteenName = $_REQUEST["canteenName"]; $canteenTel = $_REQUEST["canteenTel"]; $picurl = $time . $ext; $cid = 0; //创建餐厅,并建立绑定关系,设置成管理员 $longitude = $_REQUEST["longitude"]; $latitude = $_REQUEST["latitude"]; db_log("create canteen x:{$longitude}, y:{$latitude}, tel:{$canteenTel}"); $params = array(array(intval($_SESSION["uid"]), SQLSRV_PARAM_IN), array("" . $canteenName, SQLSRV_PARAM_IN), array("" . $canteenTel, SQLSRV_PARAM_IN), array("" . $picurl, SQLSRV_PARAM_IN), array("" . $longitude, SQLSRV_PARAM_IN), array("" . $latitude, SQLSRV_PARAM_IN), array($cid, SQLSRV_PARAM_OUT)); sp_execute("{call app_user_create_canteen(?,?,?,?,?,?,?)}", $params); $_SESSION["cid"] = $cid; $_SESSION["cname"] = $canteenName; $_SESSION["shop_picurl"] = $picurl; //根据经纬度获得餐厅地址信息 if (strlen($longitude) > 0 && strlen($latitude)) { $addr = get_location_bdapi(CFG_BDAPI_AK, $longitude, $latitude); $params = array(array($cid, SQLSRV_PARAM_IN), array("" . $addr, SQLSRV_PARAM_IN)); sp_execute("{call web_set_canteen_addr(?,?)}", $params); } $status = "ok"; } else { $status = "error"; }
//检查权限 if (!filter_canteenadmin()) { exit; } // require_once "../libs/PHPExcel/PHPExcel.php"; $mid = 0; $qdt = date("Y-m-d"); if (isset($_REQUEST["mid"])) { $mid = $_REQUEST["mid"]; } if (isset($_REQUEST["qdt"])) { $qdt = $_REQUEST["qdt"]; } //ready data db_log("cid:" . $_SESSION["cid"] . ", mid:{$mid}, qdt:{$qdt}"); $params = array(array(intval($_SESSION["cid"]), SQLSRV_PARAM_IN), array($mid, SQLSRV_PARAM_IN), array($qdt, SQLSRV_PARAM_IN)); $rs = sp_execute_multi("{call web_canteen_query_orders(?,?,?)}", $params); // Create new PHPExcel object $objPHPExcel = new PHPExcel(); // Set properties $objPHPExcel->getProperties()->setCreator("ctos")->setLastModifiedBy("ctos")->setTitle("Office 2007 XLSX Test Document")->setSubject("Office 2007 XLSX Test Document")->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")->setKeywords("office 2007 openxml php")->setCategory("Test result file"); // set width $objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(15); $objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(20); $objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(10); $objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(10); $objPHPExcel->getActiveSheet()->getColumnDimension('E')->setWidth(15); $objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(10); $objPHPExcel->getActiveSheet()->getColumnDimension('G')->setWidth(10); $objPHPExcel->getActiveSheet()->getColumnDimension('H')->setWidth(10);
/** * @return boolean true on success; false on failure * @param string $old_password * @param string $new_passwords * @param bool $match = true * * All passwords need to be plain text; they'll be hashed appropriately * as per the configuration in config.inc.php */ public function change_pw($new_password, $old_password, $match = true) { list(, $domain) = explode('@', $this->id); if ($match == true) { if (!$this->login($this->id, $old_password)) { db_log($domain, 'edit_password', "MATCH FAILURE: " . $this->id); $this->errormsg[] = Config::Lang('pPassword_password_current_text_error'); return false; } } $set = array('password' => pacrypt($new_password)); $result = db_update('mailbox', 'username', $this->id, $set); if ($result != 1) { db_log($domain, 'edit_password', "FAILURE: " . $this->id); $this->errormsg[] = Config::lang('pEdit_mailbox_result_error'); return false; } db_log($domain, 'edit_password', $this->id); return true; }
/** * @return true on success false on failure */ public function delete() { if (!$this->view()) { $this->errormsg[] = 'An alias domain with that name does not exist!'; # TODO: make translatable? (will a user ever see this?) return false; } db_delete($this->db_table, $this->id_field, $this->id); db_log($this->id, 'delete_alias_domain', $this->result['target_domain']); $this->infomsg[] = Config::Lang_f('pDelete_delete_success', $this->result['alias_domain'] . ' -> ' . $this->result['target_domain']); return true; }