Exemplo n.º 1
0
 /**
  * 加密函数
  * @param string $txt 需加密的字符串
  * @param string $key 加密密钥,默认读取SECURE_CODE配置
  * @return string 加密后的字符串
  */
 private function jiami($txt, $key = null)
 {
     empty($key) && ($key = C('SECURE_CODE'));
     //有mcrypt扩展时
     if (function_exists('mcrypt_module_open')) {
         return desencrypt($txt, $key);
     }
     //无mcrypt扩展时
     return tsauthcode($text, 'ENCODE', $key);
 }
Exemplo n.º 2
0
 /**
  * 上传文件
  *
  * @param string $uploadType 上传文件的类型
  * @param string $attachType 保存文件的类型
  * @param string [$param, $param ...] 限制文件上传的类型
  * @return array
  * @author Medz Seven <*****@*****.**>
  **/
 protected function uploadFile($uploadType, $attachType)
 {
     $ext = func_get_args();
     array_shift($ext);
     array_shift($ext);
     $option = array('attach_type' => $attachType);
     count($ext) and $option['allow_exts'] = implode(',', $ext);
     $info = model('Attach')->upload(array('upload_type' => $uploadType), $option);
     // # 判断是否有上传
     if (count($info['info']) <= 0) {
         $this->error(array('status' => '-1', 'msg' => '没有上传的文件'));
         // # 判断是否上传成功
     } elseif ($info['status'] == false) {
         $this->error(array('status' => '0', 'msg' => $info['info']));
     }
     $data = array();
     foreach ($info['info'] as $value) {
         $value = desencrypt($value['attach_id'], C('SECURE_CODE'));
         array_push($data, $value);
     }
     return array('status' => '1', 'list' => $data);
 }
Exemplo n.º 3
0
 public function pushMessage($toUids, $data)
 {
     $clients = $this->getClientByUser($toUids);
     if ($clients) {
         if (!class_exists('Gateway', false)) {
             require ADDON_PATH . '/library/GatewayClient/Gateway.php';
         }
         foreach ($data as &$rs) {
             $rs['message_id'] = (int) $rs['message_id'];
             $rs['from_uid'] = (int) $rs['from_uid'];
             $rs['room_id'] = (int) $rs['list_id'];
             $rs['mtime'] = (int) $rs['mtime'];
             $rs['from_uname'] = (string) getUserName($rs['from_uid']);
             if (isset($rs['attach_id'])) {
                 $rs['attach_id'] = @desencrypt($rs['attach_id'], C('SECURE_CODE'));
             }
             $rs['content'] = $this->htmlDecode($rs['content']);
             if (isset($rs['location'])) {
                 $rs['location'] = $this->htmlDecode($rs['location']);
             }
             if (isset($rs['title'])) {
                 $rs['title'] = $this->htmlDecode($rs['title']);
             }
             unset($rs['list_id']);
         }
         $data = json_encode(array('type' => 'push_message', 'result' => array('from' => 'web', 'length' => count($data), 'list' => $data), 'status' => 0, 'msg' => ''));
         Gateway::sendToAll($data, $clients);
     }
 }
Exemplo n.º 4
0
 public function index()
 {
     $de = desencrypt('*****@*****.**', 'SociaxV1');
     echo desdecrypt($de, 'SociaxV1');
 }
Exemplo n.º 5
0
 /**
  * 加密函数
  * @param string $txt 需加密的字符串
  * @param string $key 加密密钥,默认读取SECURE_CODE配置
  * @return string 加密后的字符串
  */
 private function jiami($txt, $key = null)
 {
     empty($key) && ($key = C('SECURE_CODE'));
     //有mcrypt扩展时
     if (function_exists('mcrypt_module_open')) {
         return desencrypt($txt, $key);
     }
     //无mcrypt扩展时
     $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-=_";
     $nh = rand(0, 64);
     $ch = $chars[$nh];
     $mdKey = md5($key . $ch);
     $mdKey = substr($mdKey, $nh % 8, $nh % 8 + 7);
     $txt = base64_encode($txt);
     $tmp = '';
     $i = 0;
     $j = 0;
     $k = 0;
     for ($i = 0; $i < strlen($txt); $i++) {
         $k = $k == strlen($mdKey) ? 0 : $k;
         $j = ($nh + strpos($chars, $txt[$i]) + ord($mdKey[$k++])) % 64;
         $tmp .= $chars[$j];
     }
     return $ch . $tmp;
 }
Exemplo n.º 6
0
<?php

header('Content-Type:text/html;charset=utf-8');
require "../include/common.inc.php";
include "httpclient.php";
$db = new DB_test();
$now = strtotime(date("Y-m-d H:i:s"));
$au_token = desencrypt($now, 'E', 'mstongfubao');
//����
$query = "select * from tb_version  where fd_version_apptype ='1'";
$db->query($query);
if ($db->nf()) {
    //判断查询到的记录是否为空
    $db->next_record();
    //读取记录数据
    $versionno = $db->f(fd_version_no);
    //编号
}
switch ($paytype) {
    case "qqrecharge":
        $api_name_func = 'checkRechaMoneyStatus';
        $api_name = 'ApiQQRechangeInfo';
        break;
    case "mobilerecharge":
        $api_name_func = 'CheckTransStatus';
        $api_name = 'ApiMobileRechargeInfoV2';
        break;
    default:
        break;
}
$xmlcontent = "<?xml version=1.0 encoding=UTF-8 standalone=yes ?>\n<operation_request>\n<msgheader version=1.0>\n<req_bkenv>01</req_bkenv>\n<req_appenv>1</req_appenv>\n<req_time>20140429051128</req_time>\n<req_token>9bmeJASBBDGwq5d9r4oSWlTqi5XIG17AByJ4kMn3q0gj4yi+meD5aUnSq/TSUMsj+lOfvv1I91PYdK06OBWkqqQ==</req_token>\n<channelinfo>\n<authorid>" . $authorid . "</authorid>\n<api_name_func>" . $api_name_func . "</api_name_func>\n<api_name>" . $api_name . "</api_name>\n</channelinfo>\n<au_token>" . $au_token . "</au_token>\n<req_version>" . $versionno . "</req_version>\n</msgheader>\n<msgbody>\n<result>success</result>\n<bkntno>" . $bkntno . "</bkntno>\n</msgbody>\n</operation_request>\n";