Exemplo n.º 1
0
/**
 * PHP implementation of Bob Jenkins hash function taken from some answer I can't find anymore on stackoverflow.com
 */
function jenkins_hash($inputString)
{
    $firstCheck = str2num($inputString, 0x1505, 0x21);
    $secondCheck = str2num($inputString, 0, 0x1003f);
    $firstCheck >>= 2;
    $firstCheck = $firstCheck >> 4 & 0x3ffffc0 | $firstCheck & 0x3f;
    $firstCheck = $firstCheck >> 4 & 0x3ffc00 | $firstCheck & 0x3ff;
    $firstCheck = $firstCheck >> 4 & 0x3c000 | $firstCheck & 0x3fff;
    $t1 = (($firstCheck & 0x3c0) << 4 | $firstCheck & 0x3c) << 2 | $secondCheck & 0xf0f;
    $t2 = (($firstCheck & 4294950912.0) << 4 | $firstCheck & 0x3c00) << 0xa | $secondCheck & 0xf0f0000;
    return $t1 | $t2;
}
Exemplo n.º 2
0
function handleScan($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);
    //
    //用户扫描带场景值二维码
    $cid = str2num(canteenid_content, $postObj->EventKey);
    $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, $postObj->EventKey, $rs[0]["cname"], $rs[0]["picurl"], $rs[0]["newsid"]);
}
Exemplo n.º 3
0
/**
 * 处理扫描场景值关注
 * 1.若未关注公众号,则会触发subscrible事件,EventKey中带有场景值(如:qrscene_Qggg)
 * 2.若已关注公众号,则会触发scan事件,EventKey中带有场景值(如:Qggg)
 * 3.注意两者区别
 * @param $postObj
 */
function handleScan($postObj)
{
    $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);
    //用户扫描带场景值二维码
    $scenestr = explode("-", $postObj->EventKey);
    $uid_from = str2num(CFG_ID_USER, $scenestr[0]);
    $cid = str2num(CFG_ID_CAR, $scenestr[1]);
    log_file("scan, 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);
    //查询分享发起人信息
    $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);
}
Exemplo n.º 4
0
?>
<!DOCTYPE html>
<html>
<head>
    <?php 
include_once "meta.php";
?>
</head>
<body>
<div class="body">
    <div style="height:5px;"></div>
    <?php 
//处理新用户加入餐厅提醒,链接中的cids
if (isset($_REQUEST["cids"])) {
    echo '<div class="headerCnameTips">' . $_SESSION["cname"] . '</div>';
    $_SESSION["cid"] = str2num(canteenid_content, $_REQUEST["cids"]);
}
?>
    <div class="jf-body">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
                <th align="center" width="20%">头像</th>
                <th align="center" width="30%">姓名</th>
                <th align="center" width="20%">管理员</th>
                <th align="center" width="20%">状态</th>
            </tr>
            <?php 
$params = array(array(intval($_SESSION["cid"]), SQLSRV_PARAM_IN));
$sp = "{call web_get_canteen_user(?)}";
$rs = sp_execute($sp, $params);
foreach ($rs as $row) {
Exemplo n.º 5
0
 * Created by PhpStorm.
 * User: Applexiang
 * Date: 2015/6/22 0022
 * Time: 17:26
 * Fun: 查看餐厅二维码
 */
require_once "../config.php";
require_once "../conn.php";
require_once "../include/php_funs.php";
require_once "../db_weixin_funs.php";
require_once "admin_filter.php";
//检查权限
if (!filter_canteenadmin()) {
    exit;
}
$cid = str2num(canteenid_content, $_REQUEST["cids"]);
$verurl = $_REQUEST["verurl"];
if ($verurl == "") {
    /* 根据餐厅编号生成带场景二维码 */
    //餐厅编号
    $str = num2str(canteenid_content, $cid);
    $token = db_get_token_ticket(CFG_APPID, CFG_SECRET)["token"];
    $url = "https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token={$token}";
    /*
     * 永久二维码请求说明
     * http请求方式: POST
     * URL: https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=TOKEN
     * POST数据格式:json
     * POST数据例子:{"action_name": "QR_LIMIT_SCENE", "action_info": {"scene": {"scene_id": 123}}}
     * 或者也可以使用以下POST数据创建字符串形式的二维码参数:
     * {"action_name": "QR_LIMIT_STR_SCENE", "action_info": {"scene": {"scene_str": "123"}}}
Exemplo n.º 6
0
    <meta name="viewport" content="initial-scale=1, width=device-width, maximum-scale=1, user-scalable=no">
    <title><?php 
echo $rs1[0]["tname"];
?>
</title>
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="css/common-dfdd7f5e76.css?v=22">
    <script src="../js/jquery-1.11.1.min.js"></script>
    <script src="js/m_init.js?v=1"></script>
    <!- 引入对应版本的MuPlayer,要置于jQuery之后。->
    <script src="plugins/muplayer/dist/player.js"></script>
</head>
<body>
<?php 
if (isset($_REQUEST["vids"])) {
    $vid = str2num(CFG_ID_VOICE, $_REQUEST["vids"]);
    $params = array(array(intval($_SESSION["tid"]), SQLSRV_PARAM_IN), array($vid, SQLSRV_PARAM_IN));
    $rs = sp_execute("{call app_get_tbv_list(?,?)}", $params);
}
?>
<div style="margin-bottom:60px;">
    <ul class="panel-img-list">
        <li>
            <div class="detail">
                <div class="panel-img-left">
                    <img src="<?php 
echo strlen($rs[0]["purl"]) > 0 ? CFG_HTTP . "upload/voice/" . $rs[0]["purl"] : CFG_HTTP . CFG_VOICE_DEFAULT;
?>
" alt="">
                </div>
                <div class="panel-img-content">
    public function toHTML($readonly = false)
    {
        $sliders = array();
        $html_id = $this->htmlID();
        $html = '';
        $html .= '<script type="text/javascript">
			function setSlider(slider_name_, value_) {
				slider_name_.setValue(value_);
			}
		</script>';
        $html .= '<table border="0" cellspacing="1" cellpadding="3">';
        $html .= '<tr>';
        $html .= '<td>';
        $html .= '<h2 style="text-align: center;">' . _('Factor impact') . '</h2>';
        $html .= '<table border="0" cellspacing="1" cellpadding="3">';
        $i_init = 100 * str2num($this->id);
        $i = $i_init;
        $html .= '<tr>';
        $html .= '<td></td>';
        $html .= '<td>';
        $html .= '<div style="width: 50px; float: left; text-align: left;"><span style="font-weight: bold;">' . _('less') . '</span></div> <div style="width: 50px; float: right; text-align: right;"><span style="font-weight: bold;">' . _('more') . '</span></div>';
        $html .= '</td>';
        $html .= '</td><td>';
        $html .= '</tr>';
        $content_load_balancing = array();
        foreach ($this->content as $key1 => $value1) {
            if (array_key_exists($i, $sliders)) {
                $sliders[$i] = array();
            }
            $label3 = $html_id . $this->formSeparator . $i . $this->formSeparator;
            $criterion_class_name = 'DecisionCriterion_' . $key1;
            $c = new $criterion_class_name(NULL);
            // ugly
            $content_load_balancing[] = $c->default_value();
            $sliders[$i_init][$i] = $c->default_value();
            $html .= '<tr>';
            $html .= '<td>';
            $html .= '<strong>' . $key1 . '</strong>';
            $html .= '<input type="hidden" id="' . $label3 . 'key" name="' . $label3 . 'key" value="' . $key1 . '" size="25" />';
            $html .= '</td>';
            $html .= '<td>';
            $html .= '<div id="' . $html_id . $this->formSeparator . $key1 . '_divb">';
            // horizontal slider control
            $html .= '<script type="text/javascript">';
            $html .= '
				var slider' . $i . ';
				Event.observe(window, \'load\', function() {
					slider' . $i . ' = new Control.Slider(\'handle' . $i . '\', \'track' . $i . '\', {
						range: $R(0,100),';
            if ($readonly == true) {
                $html .= 'disabled: true,';
            }
            $html .= 'values: [';
            for ($buf5 = 0; $buf5 < 100; $buf5++) {
                $html .= $buf5 . ',';
            }
            $html .= $buf5;
            $html .= '],
						sliderValue: ' . $value1 . ',
						onSlide: function(v) {
							$(\'slidetxt' . $i . '\').innerHTML = v;
							$(\'' . $label3 . 'value\').value = v;
						},
						onChange: function(v) {
							$(\'slidetxt' . $i . '\').innerHTML = v;
							$(\'' . $label3 . 'value\').value = v;
						}
					});
				});
				';
            $html .= '</script>';
            $html .= '<div id="track' . $i . '" style="width: 200px; background-color: rgb(204, 204, 204); height: 10px;"><div class="selected" id="handle' . $i . '" style="width: 10px; height: 15px; background-color: #004985; cursor: move; left: 190px; position: relative;"></div></div>';
            $html .= '<input type="hidden" id="' . $label3 . 'value" name="' . $label3 . 'value" value="' . $value1 . '" size="25" />';
            $html .= '</div>';
            $html .= '</td>';
            $html .= '<td>';
            $html .= '<div id="slidetxt' . $i . '" style="float: right; width: 25px;">' . $value1 . '</div>';
            $html .= '</td>';
            $html .= '</tr>';
            $i += 1;
        }
        $html .= '</table>';
        $html .= '<script type="text/javascript">
function resetLoadBalancing' . $i_init . '() {' . "\n";
        foreach ($sliders[$i_init] as $r2 => $d2) {
            $html .= '	setSlider(slider' . $r2 . ',' . $d2 . ');' . "\n";
        }
        $html .= '}
</script>';
        $html .= '<br /><input type="button" id="reset_loadbalancing" value="' . _('Back to default') . '" onclick="resetLoadBalancing' . $i_init . '(); return false;" />';
        $html .= '</td>';
        $html .= '<td style="width: 100%; vertical-align: top; border-left: 1px solid #999;">';
        $html .= '<table style="width: 50%; margin-left: auto; margin-right: auto;" border="0" cellspacing="1" cellpadding="3">';
        $html .= '<tr>';
        $html .= '<td>';
        $html .= '<h2 style="text-align: center;">' . _('Examples') . '</h2>';
        $html .= '</td>';
        $html .= '</tr>';
        $html .= '<tr>';
        $html .= '<td style="text-align: center; vertical-align: middle;">';
        $html .= '<img src="media/image/loadbalancing/full-cpu.png" alt="" title="" />';
        $html .= '</td>';
        $html .= '</tr>';
        $html .= '<tr>';
        $html .= '<td style="text-align: center; vertical-align: middle;">';
        $html .= _('Full CPU: only CPU usage is used as a criteria to choose the best
server to use for an incoming user.');
        $html .= '</td>';
        $html .= '</tr>';
        $html .= '<tr>';
        $html .= '<td>&nbsp;</td>';
        $html .= '</tr>';
        $html .= '<tr>';
        $html .= '<td style="text-align: center; vertical-align: middle;">';
        $html .= '<img src="media/image/loadbalancing/both-cpu-ram-with-random.png" alt="" title="" />';
        $html .= '</td>';
        $html .= '</tr>';
        $html .= '<tr>';
        $html .= '<td style="text-align: center; vertical-align: middle;">';
        $html .= _('Both CPU and RAM are used as criterias, with a little randomization...');
        $html .= '</td>';
        $html .= '</tr>';
        $html .= '</table>';
        $html .= '</td>';
        $html .= '</tr>';
        $html .= '</table>';
        return $html;
    }
Exemplo n.º 8
0
<?php

/**
 * Created by PhpStorm.
 * User: Applexiang
 * Date: 2015/9/1
 * Time: 10:35
 * Fun: 查看主题二维码
 */
require_once "../config.php";
require_once "../conn.php";
require_once "../wxp_funs.php";
require_once "../include/php_funs.php";
if (isset($_REQUEST["tids"]) && isset($_REQUEST["tname"])) {
    $_SESSION["tid"] = str2num(CFG_ID_TOPIC, $_REQUEST["tids"]);
    $_SESSION["tname"] = $_REQUEST["tname"];
}
?>
<!DOCTYPE html>
<html>
<head>
    <?php 
include_once "meta.php";
?>
    <style>
        .msgTips{position:fixed; left:20%; top:0px; width:700px; height:80px; padding-top:5px; color:#fff; font-size:22px; text-align:center; background:url('') no-repeat scroll right top rgba(0,0,0,0.5); z-index:9999;}
        .copy{  float:left;  margin-left:10px;  background: url(images/ico_copy.gif) no-repeat left; ;  display: block;  width: 86px;  height: 16px;  text-indent:18px;  color:#0099CC;}
    </style>
</head>
<body>
<div class="msgTips" id="msgTips" onClick="hideTip()" style="display:none;"></div>
Exemplo n.º 9
0
$cid = str2num(canteenid_content, $_REQUEST["cids"]);
$ctitle = "添加";
$picurl = $_REQUEST["picurl"];
if ($cid > 0) {
    $ctitle = "修改";
    if (strstr($picurl, "upload/shop")) {
        $picurl = substr(strrchr($picurl, "/"), 1);
    } else {
        $picurl = "";
    }
} else {
    $picurl = "";
}
if ($_REQUEST["editflag"] == "yes") {
    $picurl = $_POST["picurl"];
    $cid = str2num(canteenid_content, $_POST["cids"]);
    $cname = htmlspecialchars(trim($_POST["cname"]));
    $account = htmlspecialchars(trim($_POST["account"]));
    $show = $_POST["show"];
    $mode = $_POST["mode"];
    $telnum = $_POST["telnum"];
    $addr = $_POST["addr"];
    //修改
    if ($cid > 0) {
        $params = array(array($cid, SQLSRV_PARAM_IN), array($cname, SQLSRV_PARAM_IN), array($picurl, SQLSRV_PARAM_IN), array($telnum, SQLSRV_PARAM_IN), array($account, SQLSRV_PARAM_IN), array($addr, SQLSRV_PARAM_IN), array($show, SQLSRV_PARAM_IN), array($mode, SQLSRV_PARAM_IN));
        $sp = "{call web_set_canteen(?,?,?,?,?,?,?,?)}";
    } else {
        $params = array(array($cname, SQLSRV_PARAM_IN), array($account, SQLSRV_PARAM_IN), array($addr, SQLSRV_PARAM_IN), array($picurl, SQLSRV_PARAM_IN), array($telnum, SQLSRV_PARAM_IN), array($show, SQLSRV_PARAM_IN), array($mode, SQLSRV_PARAM_IN), array($cid, SQLSRV_PARAM_OUT));
        $sp = "{call web_add_canteen(?,?,?,?,?,?,?,?)}";
    }
    sp_execute($sp, $params);
Exemplo n.º 10
0
         $time = md5(time());
         //裁剪图片
         my_image_resize($_FILES["file"]["tmp_name"], $uploadPath . $time . $ext, 430, 430);
         $picurl = $time . $ext;
         $verurl = "qrcode/" . $picurl;
         //保存
         $params = array(array(intval($_SESSION["cid"]), SQLSRV_PARAM_IN), array("", SQLSRV_PARAM_IN), array("", SQLSRV_PARAM_IN), array($verurl, SQLSRV_PARAM_IN));
         sp_execute("{call web_set_canteen_verify(?,?,?,?)}", $params);
         $status = "ok";
         $info = $picurl;
     }
     //
 } 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";
Exemplo n.º 11
0
<?php

/**
 * Created by PhpStorm.
 * User: Applexiang
 * Date: 2015/8/18
 * Time: 22:32
 * Fun: 查询车辆信息,并显示常用操作
 */
require_once "../config.php";
require_once "../conn.php";
require_once "../wxp_funs.php";
require_once "../include/php_funs.php";
//
if (isset($_REQUEST["cids"]) && isset($_REQUEST["carnum"])) {
    $_SESSION["cid"] = str2num(CFG_ID_CAR, $_REQUEST["cids"]);
    $_SESSION["carnum"] = $_REQUEST["carnum"];
}
?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1, width=device-width, maximum-scale=1, user-scalable=no">
    <title><?php 
echo $_SESSION["carnum"];
?>
</title>
    <link rel="icon" href="../images/favicon.ico" type="image/x-icon">
    <link href="css/style.css?v=23" rel="stylesheet">
    <link href="css/global.css?v=6" rel="stylesheet">
Exemplo n.º 12
0
require_once "../conn.php";
require_once "../include/php_funs.php";
//
include_once "check_cookie_with_wid.php";
//
if (isset($_REQUEST["act"])) {
    $_SESSION["act"] = $_REQUEST["act"];
    if ($_REQUEST["act"] == 'precanteen') {
    } else {
        if ($_REQUEST["act"] == 'preoids' && isset($_REQUEST["cids"]) && isset($_REQUEST["oids"])) {
            $_SESSION["cid"] = str2num(canteenid_content, $_REQUEST["cids"]);
            $_SESSION["oid"] = str2num_x(orderid_content_x, $_REQUEST["oids"]);
        } else {
            if ($_REQUEST["act"] == 'preuids' && isset($_REQUEST["cids"]) && isset($_REQUEST["uids"])) {
                $_SESSION["cid"] = str2num(canteenid_content, $_REQUEST["cids"]);
                $_SESSION["uidx"] = str2num(userid_content, $_REQUEST["uids"]);
            } else {
                unset($_SESSION["act"]);
                echo 'unknow action' . $_REQUEST["act"];
                exit;
            }
        }
    }
} else {
    if (!isset($_SESSION["act"])) {
        echo '';
        exit;
    }
}
//
if ($_SESSION["act"] == 'precanteen') {
Exemplo n.º 13
0
 * Time: 14:07
 * Fun: 保存主题信息
 */
require_once "../config.php";
require_once "../conn.php";
require_once "../include/php_funs.php";
$t_title = "添加";
if (isset($_REQUEST["tids"]) && $_REQUEST["editflag"] != "yes") {
    $t_title = "修改";
    $tid = str2num(CFG_ID_TOPIC, $_REQUEST["tids"]);
    $params = array(array(intval($_SESSION["uid"]), SQLSRV_PARAM_IN), array($tid, SQLSRV_PARAM_IN));
    $rs = sp_execute("{call web_get_topic_list(?,?)}", $params);
}
if ($_REQUEST["editflag"] == "yes") {
    $title = $_POST["title"];
    $tid = str2num(CFG_ID_TOPIC, $_POST["tids"]);
    //修改
    if ($tid > 0) {
        $sp = "{call web_set_tbv(?,?,?)}";
        $params = array(array(intval($_SESSION["uid"]), SQLSRV_PARAM_IN), array($tid, SQLSRV_PARAM_IN), array($title, SQLSRV_PARAM_IN));
    } else {
        $sp = "{call web_add_tbv(?,?,?)}";
        $params = array(array(intval($_SESSION["uid"]), SQLSRV_PARAM_IN), array($title, SQLSRV_PARAM_IN), array($tid, SQLSRV_PARAM_OUT));
    }
    sp_execute($sp, $params);
    echo "<script>location.href='topic.php'</script>";
}
?>
<!DOCTYPE html>
<html>
<head>
Exemplo n.º 14
0
/*==========================================================
  ARQUIVO : cursos/aplic/batepapo/marcar_sessao2.php
  ========================================================== */
$bibliotecas = "../bibliotecas/";
include $bibliotecas . "geral.inc";
include "batepapo.inc";
$cod_ferramenta = 10;
$cod_ferramenta_ajuda = $cod_ferramenta;
$cod_pagina_ajuda = 1;
$tipo = "I";
include "../topo_tela.php";
/* Pega a informação da possivel avaliacao */
if (is_numeric($_POST['ValorAval'])) {
    $valor = $_POST['ValorAval'];
} else {
    $valor = str2num($_POST['ValorAval']);
}
$objetivos = $_POST['ObjetivosAval'];
$criterios = $_POST['CriteriosAval'];
$com_avaliacao = $valor != NULL;
$data_inicio = DataHora2Unixtime($data . " " . $hora_inicio . ":00");
$data_fim = DataHora2Unixtime($data . " " . $hora_fim . ":00");
$e_formador = EFormador($sock, $cod_curso, $cod_usuario);
echo "    <script type=\"text/javascript\" language=\"javascript\">\n";
echo "      function Iniciar() \n";
echo "      {\n";
echo "        startList();\n";
echo "      }\n";
echo "      function OpenWindow() \n";
echo "      {\n";
echo "        window.open(\"entrar_sala.php?" . RetornaSessionID() . "&cod_curso=" . $cod_curso . "\",\"Batepapo\",\"width=1000,height=700,top=50,left=50,scrollbars=no,status=yes,toolbar=no,menubar=no,resizable=no\");\n";