Exemplo n.º 1
0
 public function cx($conf)
 {
     $params = array('version' => '5.0.0', 'encoding' => 'utf-8', 'certId' => getSignCertId(), 'signMethod' => '01', 'txnType' => '00', 'txnSubType' => '00', 'bizType' => '000000', 'accessType' => '0', 'channelType' => '07', 'orderId' => $conf['ordernumber'], 'merId' => '898110248160161', 'txnTime' => date("YmdHis", strtotime($conf['addtime'])));
     // 签名
     sign($params);
     // 发送信息到后台
     $result = sendHttpRequest($params, SDK_SINGLE_QUERY_URL);
     //返回结果展示
     $result_arr = coverStringToArray($result);
     $insert = array();
     $insert['ordernumber'] = $conf['ordernumber'];
     $insert['fqtime'] = $conf['addtime'];
     $insert['ylnumber'] = isset($result_arr['queryId']) ? $result_arr['queryId'] : 0;
     $insert['yltime'] = isset($result_arr['traceTime']) ? $result_arr['traceTime'] : 0;
     $insert['ylstatus'] = $conf['cztype'];
     $insert['cxtime'] = date("Y-m-d  H:i:s");
     $insert['cxstatus'] = $result_arr['respCode'];
     $insert['cxmiaosu'] = $result_arr['respMsg'];
     $insert['userId'] = $conf['userId'];
     $insert['origRespCode'] = isset($result_arr['origRespCode']) ? $result_arr['origRespCode'] : 0;
     $insert['origRespMsg'] = isset($result_arr['origRespMsg']) ? $result_arr['origRespMsg'] : 0;
     $this->db->insert("yinlian", $insert);
     if ($this->db->insert_id() > 0) {
         $this->db->query("update  `cz`  set  `cl`=1  where   logId=" . $conf['logId']);
     }
 }
Exemplo n.º 2
0
function build_mysign($sort_array, $security_code, $sign_type = "MD5")
{
    $prestr = create_linkstring($sort_array);
    $prestr = $prestr . $security_code;
    $mysgin = sign($prestr, $sign_type);
    return $mysgin;
}
Exemplo n.º 3
0
function preparePutRequest($merchantId, $payId, $dttm, $privateKey, $privateKeyPassword)
{
    $data = array("merchantId" => $merchantId, "payId" => $payId, "dttm" => $dttm);
    $text = $merchantId . "|" . $payId . "|" . $dttm;
    $data['signature'] = sign($text, $privateKey, $privateKeyPassword, "data to sign:");
    return $data;
}
Exemplo n.º 4
0
 public function before($controller, $metadata, &$data)
 {
     if (!$controller->request->input->exists('app_id')) {
         throw new BadRequestException("Missing app id.");
     }
     $conf = Config::Get('apps');
     $app = $conf->{$controller->request->input->app_id};
     if (!$app->signed) {
         return;
     }
     if (!$controller->request->input->exists('app_id', 'signature', 'time')) {
         throw new BadRequestException("Missing signature.");
     }
     $signature = str_replace(' ', '+', $controller->request->input->signature);
     $vals = array();
     foreach ($controller->request->input as $key => $val) {
         if (!in_array($key, array('signature', 'time'))) {
             $vals[$key] = $val;
         }
     }
     $sig = sign($vals, $app->key, $controller->request->input->time);
     if ($sig['signature'] != $signature) {
         throw new BadRequestException("Invalid signature.");
     }
 }
Exemplo n.º 5
0
 public function dopay($money = null, $order = null, $ordername = null, $reqReserved = '透传信息')
 {
     //取插件配置参数
     $conf = F('pluginunionpay');
     if (empty($conf) || APP_DEBUG) {
         $data = M('Addons')->field('param')->where("mark='Unionpay'")->find();
         $conf = json_decode($data['param'], true);
         F('pluginunionpay', $conf);
     }
     define('UNIONPAY_MEMBER_ID', $conf['MEMBER_ID']);
     include_once UNIONPAY_PATH . '/lib/utf8/func/SDKConfig.php';
     include_once UNIONPAY_PATH . '/lib/utf8/func/common.php';
     include_once UNIONPAY_PATH . '/lib/utf8/func/PinBlock.php';
     include_once UNIONPAY_PATH . '/lib/utf8/func/PublicEncrypte.php';
     include_once UNIONPAY_PATH . '/lib/utf8/func/secureUtil.php';
     include_once UNIONPAY_PATH . '/lib/utf8/func/httpClient.php';
     /**
      *	以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己需要,按照技术文档编写。该代码仅供参考
      */
     // 初始化日志
     //$log = new PhpLog ( SDK_LOG_FILE_PATH, "PRC", SDK_LOG_LEVEL );
     //$log->LogInfo ( "============处理前台请求开始===============" );
     // 初始化日志
     $params = array('version' => '5.0.0', 'encoding' => 'utf-8', 'certId' => getSignCertId(), 'txnType' => '01', 'txnSubType' => '01', 'bizType' => '000201', 'frontUrl' => SDK_FRONT_NOTIFY_URL, 'backUrl' => SDK_BACK_NOTIFY_URL, 'signMethod' => '01', 'channelType' => '08', 'accessType' => '0', 'merId' => MEMBER_ID, 'orderId' => $order, 'txnTime' => date('YmdHis'), 'txnAmt' => $money * 100, 'currencyCode' => '156', 'orderDesc' => $ordername, 'reqReserved' => $reqReserved);
     // 签名
     sign($params);
     // 前台请求地址
     $front_uri = SDK_FRONT_TRANS_URL;
     $html_form = create_html($params, $front_uri);
     return $html_form;
 }
Exemplo n.º 6
0
function buildMysign($sort_para, $key, $sign_type = "MD5")
{
    $prestr = createLinkstring($sort_para);
    $prestr = $prestr . $key;
    $mysgin = sign($prestr, $sign_type);
    return $mysgin;
}
Exemplo n.º 7
0
 public function init()
 {
     parent::init();
     $conf = Config::Get($this->config_file);
     $this->conf = $conf->{$this->type};
     $this->app_id = $conf->app_id ? $conf->app_id : $this->app_id;
     $this->secret = $conf->app_id ? $conf->secret : $this->secret;
     $this->auth = $this->session->build_session();
     $this->forced_formats = $this->conf->forced_formats ? $this->conf->forced_formats : $this->forced_formats;
     $this->formats = $this->conf->formats ? $this->conf->formats : $this->formats;
     $this->queue_limit = $this->conf->queue_limit ? $this->conf->queue_limit : $this->queue_limit;
     $this->max_files = $this->conf->max_files ? $this->conf->max_files : $this->max_files;
     $this->file_formats = $this->conf->file_formats ? $this->conf->file_formats : $this->file_formats;
     $this->allowed_filesize = $this->conf->allowed_filesize ? $this->conf->allowed_filesize : $this->allowed_filesize;
     $this->form = $this->conf->form ? $this->conf->form : $this->form;
     $this->script = $this->conf->script ? $this->conf->script : $this->script;
     $this->container = $this->conf->container ? $this->conf->container : $this->container;
     if ($this->content && $this->content->fields) {
         foreach ($this->content->fields->field as $item) {
             $this->fields[(string) $item['name']] = (string) $item['value'];
         }
     }
     $sig = sign(array('app_id' => $this->app_id, 'formats' => $this->formats, 'forced_formats' => $this->forced_formats), $this->secret);
     $this->time = $sig['time'];
     $this->signature = $sig['signature'];
 }
Exemplo n.º 8
0
function build_mysign($sort_array)
{
    //把数组所有元素,按照“参数=参数值”的模式用“&”字符拼接成字符串
    $prestr = create_linkstring($sort_array);
    //调用RSA签名方法
    $mysgin = sign($prestr);
    return $mysgin;
}
Exemplo n.º 9
0
 public function goPay($payDetail)
 {
     $this->params["txnAmt"] = $payDetail["payMoney"] * 100;
     $this->params["orderId"] = $payDetail["unitePayID"];
     $params = $this->params;
     sign($params);
     return create_html($params, SDK_FRONT_TRANS_URL);
 }
Exemplo n.º 10
0
function build_mysign($sort_array, $key, $sign_type = "MD5")
{
    $prestr = create_linkstring($sort_array);
    $prestr = $prestr . $key;
    log_result("sign : " . $prestr);
    $mysgin = sign($prestr, $sign_type);
    return $mysgin;
}
Exemplo n.º 11
0
/**
 * RSA验签
 * @param $data   待签名数据
 * @param $priKey 密钥
 * @param $sign   要校对的的签名结果
 * return 验证结果
 */
function verify($data, $priKey, $sign)
{
    $selfSign = sign($data, $priKey);
    if ($selfSign === $sign) {
        return true;
    } else {
        return false;
    }
}
function build_mysign($sort_array, $key, $sign_type = "MD5")
{
    $prestr = create_linkstring($sort_array);
    //把数组所有元素,按照“参数=参数值”的模式用“&”字符拼接成字符串
    $prestr = $prestr . $key;
    //把拼接后的字符串再与安全校验码直接连接起来
    $mysgin = sign($prestr, $sign_type);
    //把最终的字符串签名,获得签名结果
    return $mysgin;
}
Exemplo n.º 13
0
/**
 * 生成签名结果
 * @param $sort_para 要签名的数组
 * @param $key 支付宝交易安全校验码
 * @param $sign_type 签名类型 默认值:MD5
 * return 签名结果字符串
 */
function buildMysign($sort_para, $key, $sign_type = "MD5")
{
    //把数组所有元素,按照“参数=参数值”的模式用“&”字符拼接成字符串
    $prestr = createLinkstring($sort_para);
    //把拼接后的字符串再与安全校验码直接连接起来
    $prestr = $prestr . $key;
    //把最终的字符串签名,获得签名结果
    $mysgin = sign($prestr, $sign_type);
    return $mysgin;
}
Exemplo n.º 14
0
function ksso()
{
    $soapUser = '';
    $soapPassword = '';
    $publicKeyStr = '';
    $cookieValue = $_COOKIE['SATHTOKEN'];
    $soap = new SoapClient('https://iam.kaist.ac.kr/iamps/services/singlauth?wsdl');
    $result = $soap->verification(array('cookieValue' => $cookieValue, 'publicKeyStr' => $publicKeyStr, 'adminVO' => array('adminId' => $soapUser, 'password' => $soapPassword)));
    setcookie("SATHTOKEN", "", time() - 3600, '/');
    return sign($result->return);
}
Exemplo n.º 15
0
function request($bssid, $ssid, $salt, $dhid = 'ff8080814cc5798a014ccbbdfa375369')
{
    $data = array('appid' => '0008', 'bssid' => $bssid, 'chanid' => 'gw', 'dhid' => $dhid, 'ii' => '609537f302fc6c32907a935fb4bf7ac9', 'lang' => 'cn', 'mac' => '60f81dad28de', 'method' => 'getDeepSecChkSwitch', 'pid' => 'qryapwd:commonswitch', 'ssid' => $ssid, 'st' => 'm', 'uhid' => 'a0000000000000000000000000000001', 'v' => '324');
    $data['sign'] = sign($data, $salt);
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, 'http://wifiapi02.51y5.net/wifiapi/fa.cmd');
    curl_setopt($curl, CURLOPT_USERAGENT, 'WiFiMasterKey/1.1.0 (Mac OS X Version 10.10.3 (Build 14D136))');
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_POST, true);
    curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
    curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
    $ret = json_decode(curl_exec($curl), true);
    curl_close($curl);
    return $ret;
}
Exemplo n.º 16
0
 /**
  * @throws BadRequestException
  * @param  $method
  * @param  $args
  * @return mixed
  */
 public function call($method, $args)
 {
     $req = new HTTP_Request($this->conf->endpoint . $method);
     $req->setMethod('POST');
     $args['app_id'] = $this->conf->app_id;
     foreach ($args as $key => $value) {
         $req->addPostData($key, $value);
     }
     $sig = sign($args, $this->conf->key);
     $req->addPostData('signature', $sig['signature']);
     $req->addPostData('time', $sig['time']);
     $req->sendRequest();
     if ($req->getResponseCode() != 200) {
         throw new BadRequestException($req->getResponseBody());
     }
     return json_decode($req->getResponseBody());
 }
Exemplo n.º 17
0
/**
* calculates results for one set
*/
function calc_match($user, $set, $extra = 2)
{
    $results = array();
    foreach ($set as $s) {
        $sum = 0;
        $count = 0;
        if (isset($user['votes']) and count($user['votes']) > 0) {
            foreach ($user['votes'] as $key => $uv) {
                //weight
                if (isset($user['weight'][$key])) {
                    $w = $extra;
                } else {
                    $w = 1;
                }
                //existing divisions only and if a user votes
                if (property_exists($s, 'votes') and property_exists($s->votes, $key) and $uv != 0) {
                    $sum = $sum + $w * $s->votes->{$key} * sign($uv);
                    $count = $count + $w;
                }
            }
        }
        if ($count == 0) {
            $count = 1;
        }
        // to allow match = 0/1 = 0;
        //read what data should go to result
        $res = array();
        foreach ($s as $key => $item) {
            $res[$key] = $s->{$key};
        }
        //common results for any calc
        $res['result'] = (1 + $sum / $count) / 2;
        $res['result_percent'] = round((100 + 100 * $sum / $count) / 2);
        $res['id'] = $s->id;
        $res['random'] = rand(0, 1000000);
        $results[] = $res;
    }
    //sort by result
    foreach ($results as $key => $row) {
        $result[$key] = $row['result'];
        $random[$key] = $row['random'];
    }
    array_multisort($result, SORT_DESC, $random, SORT_ASC, $results);
    return $results;
}
function request($method, $params)
{
    $sign = sign($method, $params);
    $options = array(CURLOPT_HTTPHEADER => array('Authorization: Basic ' . $sign['auth'], 'Json-Rpc-Tonce: ' . $sign['ts']));
    $postData = json_encode(array('method' => $method, 'params' => $params, 'id' => 1));
    print $postData;
    $headers = array('Authorization: Basic ' . $sign['auth'], 'Json-Rpc-Tonce: ' . $sign['ts']);
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; BTC China Trade Bot; ' . php_uname('a') . '; PHP/' . phpversion() . ')');
    curl_setopt($ch, CURLOPT_URL, 'https://api.btcchina.com/api.php/payment');
    curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    // run the query
    $res = curl_exec($ch);
    return $res;
}
Exemplo n.º 19
0
function registerNewDevice()
{
    $salt = '1Hf%5Yh&7Og$1Wh!6Vr&7Rs!3Nj#1Aa$';
    $data = array();
    $data['appid'] = '0008';
    $data['bssid'] = $bssid;
    $data['chanid'] = 'gw';
    $data['dhid'] = $dhid;
    $data['ii'] = '609537f302fc6c32907a935fb4bf7ac9';
    $data['lang'] = 'cn';
    $data['mac'] = '60f81dad28de';
    $data['method'] = 'getDeepSecChkSwitch';
    $data['pid'] = 'qryapwd:commonswitch';
    $data['ssid'] = $ssid;
    $data['st'] = 'm';
    $data['uhid'] = 'a0000000000000000000000000000001';
    $data['v'] = '324';
    $data['sign'] = sign($data, $salt);
}
Exemplo n.º 20
0
function api_query($method, $parameters = null)
{
    global $API_KEY;
    $sign = sign($method);
    // generate the extra headers
    $headers = array('X-CK-Key: ' . $API_KEY, 'X-CK-Sign: ' . $sign[0], 'X-CK-Timestamp: ' . $sign[1]);
    // our curl handle (initialize if required)
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "https://api.coinkite.com{$method}");
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    if ($parameters != null) {
        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
        curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($parameters));
    }
    // run the query
    $res = curl_exec($ch);
    $dec = json_decode($res, true);
    return $dec;
}
Exemplo n.º 21
0
function sendRequest($url, $method, $param)
{
    // 创建一个新cURL资源
    $ch = curl_init();
    // $headerArr['X-AVOSCloud-Request-Sign'] = sign();
    // $headerArr ['Content-Type'] = 'application/json';
    $headerArr = array("X-AVOSCloud-Application-Id: " . APPID, "X-AVOSCloud-Request-Sign: " . sign(), "Content-Type: application/json");
    // 设置URL和相应的选项
    $opt = array(CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_HEADER => FALSE, CURLOPT_FOLLOWLOCATION => FALSE, CURLOPT_AUTOREFERER => TRUE, CURLOPT_CONNECTTIMEOUT => 10, CURLOPT_TIMEOUT => 10, CURLOPT_SSL_VERIFYHOST => 0, CURLOPT_SSL_VERIFYPEER => FALSE, CURLOPT_VERBOSE => FALSE, CURLOPT_HTTPHEADER => $headerArr);
    curl_setopt_array($ch, $opt);
    if ($method == 'POST') {
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($param));
    }
    if ($method == 'GET') {
        $buildurl = $url . '?' . http_build_query($param);
        // $buildurl ='https://leancloud.cn/1.1/rtm/messages/logs?convid=551e3563e4b043f1c8332315&peerid=PUSH&nonce=bibce&signature_ts=1428123525&signature=a7e111140d3ddbcf424cd7910bd0fe6be00e3fd4';
        curl_setopt($ch, CURLOPT_URL, $buildurl);
        curl_setopt($ch, CURLOPT_POST, 0);
    }
    // 抓取URL并把它传递给浏览器
    $raw = curl_exec($ch);
    $errno = curl_errno($ch);
    if ($errno != CURLE_OK) {
        $errstr = curl_error($ch);
        var_dump($raw);
        return false;
    }
    $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    if ($code != 200 && $code != 201) {
        var_dump($raw);
        return false;
    }
    if (empty($raw)) {
        return false;
    }
    // 关闭cURL资源,并且释放系统资源
    curl_close($ch);
    return $raw;
}
Exemplo n.º 22
0
 public function public_dialog($path = '/', $callback = null, $ext = 'jpg|jpeg|png|gif|txt|xml|doc|ppt|pdf|zip|rar', $sign = '')
 {
     if (IS_POST) {
         $path = ltrim($path, '/');
         $path = preg_replace("/\\.+/", '.', $path);
         //屏蔽非法路径
         $path = str_replace(array('\\', '/', '\\/', '/\\'), DS, UPLOAD_PATH . $path);
         $data = file_list_upload($path);
         $this->ajaxReturn($data);
     } else {
         //验证签名,防止非法上传
         $key = sign(array('callback' => $callback, 'ext' => $ext));
         if ($sign != $key) {
             exit('<div style="padding:6px">签名错误</div>');
         }
         $ext = preg_replace('/^\\W+|\\W+$/', '', $ext);
         $ext = preg_split('/\\W/', $ext);
         $this->assign('callback', $callback);
         $this->assign('ext', $ext);
         $this->display('dialog');
     }
 }
Exemplo n.º 23
0
 public function actionPay($order_code)
 {
     $is_login = Yii::app()->session['is_login'];
     $uid = Yii::app()->session['uid'];
     $username = Yii::app()->session['username'];
     if (!isset($is_login) && !isset($uid) && empty($username) && $is_login != 1) {
         $this->redirect($this->createUrl('user/login'));
     }
     $orders = Orders::model()->find('uid=:uid and order_code=:order_code', array(':uid' => $uid, ':order_code' => $order_code));
     if (empty($order_code) || empty($orders)) {
         throw new CHttpException(400, Yii::t('yii', 'Your request is invalid.'));
     }
     $pay_price = (int) ($orders->total_price * 100);
     $params = array('version' => '5.0.0', 'encoding' => 'utf-8', 'certId' => getSignCertId(), 'txnType' => '01', 'txnSubType' => '01', 'bizType' => '000201', 'frontUrl' => SDK_FRONT_NOTIFY_URL, 'backUrl' => SDK_BACK_NOTIFY_URL, 'signMethod' => '01', 'channelType' => '08', 'accessType' => '0', 'merId' => '898110279910126', 'orderId' => $orders->order_code, 'txnTime' => date('YmdHis'), 'txnAmt' => $pay_price, 'currencyCode' => '156', 'defaultPayType' => '0001', 'reqReserved' => $orders->goods_name);
     sign($params);
     // 前台请求地址
     $front_uri = SDK_FRONT_TRANS_URL;
     // 构造 自动提交的表单
     $html_form = create_html($params, $front_uri);
     echo $html_form;
     exit;
 }
Exemplo n.º 24
0
 private function validate()
 {
     if ($_GET['v'] == 'test') {
         return TRUE;
     }
     if (IS_POST) {
         $params = $_POST;
         $sign = $params['sign'];
         if (empty($sign)) {
             sleep(1);
             $this->ajaxReturn(return_data_format('获取信息失败', '4002', 0), 'JSON');
         }
         unset($params['sign']);
         $t = sign($params);
         if (strcasecmp($sign, $t) != 0) {
             sleep(1);
             $this->ajaxReturn(return_data_format('获取信息失败', '4002', 0), 'JSON');
         }
     } else {
         sleep(1);
         $this->ajaxReturn(return_data_format('获取信息失败', '4002', 0), 'JSON');
     }
 }
Exemplo n.º 25
0
 public function pay()
 {
     $merId = empty($this->merId) ? MER_ID : $this->merId;
     $orderId = empty($this->orderId) ? date('YmdHis') : $this->orderId;
     $frontUrl = empty($this->frontUrl) ? SDK_FRONT_NOTIFY_URL : $this->frontUrl;
     $backUrl = empty($this->backUrl) ? SDK_BACK_NOTIFY_URL : $this->backUrl;
     // 初始化日志
     $log = new \PhpLog(SDK_LOG_FILE_PATH, "PRC", SDK_LOG_LEVEL);
     $log->LogInfo("============处理前台请求开始===============");
     // 初始化日志
     $params = array('version' => '5.0.0', 'encoding' => 'utf-8', 'certId' => getSignCertId(), 'txnType' => '01', 'txnSubType' => '01', 'bizType' => '000201', 'frontUrl' => $frontUrl, 'backUrl' => $backUrl, 'signMethod' => '01', 'channelType' => '08', 'accessType' => '0', 'merId' => $merId, 'orderId' => $orderId, 'txnTime' => date('YmdHis'), 'txnAmt' => $this->txnAmt, 'currencyCode' => '156', 'defaultPayType' => '0001', 'reqReserved' => $this->reqReserved);
     // 签名
     sign($params);
     // 前台请求地址
     $front_uri = SDK_FRONT_TRANS_URL;
     $log->LogInfo("前台请求地址为>" . $front_uri);
     // 构造 自动提交的表单
     $html_form = create_html($params, $front_uri);
     $log->LogInfo("-------前台交易自动提交表单>--begin----");
     //$log->LogInfo ( $html_form );
     $log->LogInfo("-------前台交易自动提交表单>--end-------");
     $log->LogInfo("============处理前台请求 结束===========");
     echo $html_form;
 }
Exemplo n.º 26
0
 function Stroke($img, $aVal, $x, $y)
 {
     if ($this->show) {
         if ($this->negformat == "") {
             $this->negformat = $this->format;
         }
         if ($this->negcolor == "") {
             $this->negcolor = $this->color;
         }
         if ($aVal === NULL || is_string($aVal) && ($aVal == "" || $aVal == "-" || $aVal == "x")) {
             return;
         }
         if (is_numeric($aVal) && $aVal == 0 && $this->iHideZero) {
             return;
         }
         // Since the value is used in different cirumstances we need to check what
         // kind of formatting we shall use. For example, to display values in a line
         // graph we simply display the formatted value, but in the case where the user
         // has already specified a text string we don't fo anything.
         if ($this->iFormCallback != '') {
             $f = $this->iFormCallback;
             $sval = call_user_func($f, $aVal);
         } elseif (is_numeric($aVal)) {
             if ($aVal >= 0) {
                 $sval = sprintf($this->format, $aVal);
             } else {
                 $sval = sprintf($this->negformat, $aVal);
             }
         } else {
             $sval = $aVal;
         }
         $y = $y - sign($aVal) * $this->margin;
         $txt = new Text($sval, $x, $y);
         $txt->SetFont($this->ff, $this->fs, $this->fsize);
         if ($this->valign == "") {
             if ($aVal >= 0) {
                 $valign = "bottom";
             } else {
                 $valign = "top";
             }
         } else {
             $valign = $this->valign;
         }
         $txt->Align($this->halign, $valign);
         $txt->SetOrientation($this->angle);
         if ($aVal > 0) {
             $txt->SetColor($this->color);
         } else {
             $txt->SetColor($this->negcolor);
         }
         $txt->Stroke($img);
     }
 }
Exemplo n.º 27
0
 function pay()
 {
     $this->load->database();
     $logId = $this->input->get('logId');
     $rw = $this->db->query(" select * from `moneylog`  where  `logId`=" . $logId)->row();
     // 初始化日志
     $log = new PhpLog(SDK_LOG_FILE_PATH, "PRC", SDK_LOG_LEVEL);
     $log->LogInfo("============处理前台请求开始===============");
     // 初始化日志
     $params = array('version' => '5.0.0', 'encoding' => 'UTF-8', 'certId' => getSignCertId(), 'txnType' => '01', 'txnSubType' => '01', 'bizType' => '000000', 'frontUrl' => SDK_FRONT_NOTIFY_URL, 'backUrl' => SDK_BACK_NOTIFY_URL, 'signMethod' => '01', 'channelType' => '07', 'accessType' => '0', 'merId' => '898110260120032', 'orderId' => $rw->ordernumber, 'txnTime' => date('YmdHis'), 'txnAmt' => $rw->shouru * 100, 'currencyCode' => '156', 'defaultPayType' => '0001');
     // 签名
     sign($params);
     // 前台请求地址
     $front_uri = SDK_FRONT_TRANS_URL;
     $log->LogInfo("前台请求地址为>" . $front_uri);
     // 构造 自动提交的表单
     $html_form = create_html($params, $front_uri);
     $log->LogInfo("-------前台交易自动提交表单>--begin----");
     $log->LogInfo($html_form);
     $log->LogInfo("-------前台交易自动提交表单>--end-------");
     $log->LogInfo("============处理前台请求 结束===========");
     echo $html_form;
 }
<?php 
header('Content-type:text/html;charset=utf-8');
include_once $_SERVER['DOCUMENT_ROOT'] . '/upacp_sdk_php/utf8/func/common.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/upacp_sdk_php/utf8/func/SDKConfig.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/upacp_sdk_php/utf8/func/secureUtil.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/upacp_sdk_php/utf8/func/httpClient.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/upacp_sdk_php/utf8/func/log.class.php';
/**
 *	预授权完成
 */
/**
 *	以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己需要,按照技术文档编写。该代码仅供参考
 */
// 初始化日志
$log = new PhpLog(SDK_LOG_FILE_PATH, "PRC", SDK_LOG_LEVEL);
$log->LogInfo("===========处理后台请求开始============");
$params = array('version' => '5.0.0', 'encoding' => 'utf-8', 'certId' => getSignCertId(), 'signMethod' => '01', 'txnType' => '03', 'txnSubType' => '00', 'bizType' => '000201', 'accessType' => '0', 'channelType' => '07', 'orderId' => date('YmdHis'), 'merId' => '888888888888888', 'origQryId' => '201502281110005523968', 'txnTime' => date('YmdHis'), 'txnAmt' => '100', 'backUrl' => SDK_BACK_NOTIFY_URL, 'reqReserved' => ' 透传信息');
// 签名
sign($params);
echo "请求:" . getRequestParamString($params);
$log->LogInfo("后台请求地址为>" . SDK_BACK_TRANS_URL);
// 发送信息到后台
$result = sendHttpRequest($params, SDK_BACK_TRANS_URL);
$log->LogInfo("后台返回结果为>" . $result);
echo "应答:" . $result;
//返回结果展示
$result_arr = coverStringToArray($result);
echo verify($result_arr) ? '验签成功' : '验签失败';
?>

Exemplo n.º 29
0
<?php

// Signs a message using an accounts signing key. Used for smart contracts.
postedTo();
if ($verifiedAccount == 0) {
    // Account required!
    error('account/required');
}
// Get the signing key (bytes):
$account = $dz->get_row('select `SignKey` from `Bank.Accounts` where ID=' . $verifiedAccount);
if (!$account) {
    // System error.
    serverError();
}
// Get the private key (bytes):
$privateKey = $account['SignKey'];
// The message can be just about anything.
$message = safe('message', true);
// Is it actually text?
if (!is_string($message)) {
    // The message must be a string.
    error('field/invalid', 'message');
}
// Sign the message (sig is bytes):
$sig = sign($message, $privateKey);
// Ok!
echo '{"signature":"' . base64_encode($sig) . '"}';
Exemplo n.º 30
0
<?php

//header ( 'Content-type:text/html;charset=utf-8' );
require_once './config_wap.php';
//银联wap配置文件
$payment_notice_id = intval($_REQUEST['payment_notice_id']);
$payment_notice = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment_notice where id = " . $payment_notice_id);
$money = round($payment_notice['money'], 2) * 100;
$payment_info = $GLOBALS['db']->getRow("select id,config,logo from " . DB_PREFIX . "payment where id=" . intval($payment_notice['payment_id']));
$payment_info['config'] = unserialize($payment_info['config']);
$parameter = array('version' => '5.0.0', 'encoding' => 'utf-8', 'certId' => getSignCertId(), 'txnType' => '01', 'txnSubType' => '01', 'bizType' => '000201', 'frontUrl' => SDK_FRONT_NOTIFY_URL, 'backUrl' => SDK_BACK_NOTIFY_URL, 'signMethod' => '01', 'channelType' => '08', 'accessType' => '0', 'merId' => $payment_info['config']['merId'], 'orderId' => $payment_notice['notice_sn'], 'txnTime' => to_date($payment_notice['create_time'], 'YmdHis'), 'txnAmt' => $money, 'currencyCode' => '156', 'reqReserved' => $payment_notice_id);
//签名
sign($parameter);
// 前台请求地址
$front_uri = SDK_FRONT_TRANS_URL;
$payLinks = create_html($parameter, $front_uri);
/**
    $log = new PhpLog ( SDK_LOG_FILE_PATH, "PRC", SDK_LOG_LEVEL );
$log->LogInfo ( "前台请求地址为>" . $front_uri );
$log->LogInfo ( "-------前台交易自动提交表单>--begin----" );
$log->LogInfo ( $payLinks );
$log->LogInfo ( "-------前台交易自动提交表单>--end-------" );
$log->LogInfo ( "============处理前台请求 结束===========" );
*/
header('Content-type:text/html;charset=utf-8');
echo $payLinks;