Ejemplo n.º 1
0
/**
 * Created by PhpStorm.
 * User: Ben
 * Date: 8/14/2015
 * Time: 10:24 PM
 */
function parseWhey($wheyArray)
{
    $sql = "INSERT INTO protein ( title, description, details, rating, supportedGoal, mainIngredient, servings, pricePerServing, percentOff, totalPrice, bodyBuildingPrice )\n            VALUES ( :title, :description, :details, :rating, :supportedGoal, :mainIngredient, :servings, :pricePerServing, :percentOff, :totalPrice, :bodyBuildingPrice )";
    $rating = array_shift(explode(' ', $wheyArray[2]));
    $goal = end(explode(':', $wheyArray[3]));
    $mainIngredient = end(explode(':', $wheyArray[4]));
    $servings = trim(end(explode(':', $wheyArray[5])));
    $ppServing = end(explode(':', $wheyArray[6]));
    $percentOff = array_shift(explode('%', $wheyArray[7]));
    $vars = array(':title' => $wheyArray['title'], ':description' => $wheyArray[0], ':details' => $wheyArray[1], ':rating' => $rating, ':supportedGoal' => $goal, ':mainIngredient' => $mainIngredient, ':servings' => $servings, ':pricePerServing' => $ppServing, ':percentOff' => $percentOff, ':totalPrice' => $wheyArray[8], ':bodyBuildingPrice' => $wheyArray[9]);
    $res = pdoInsert($sql, $vars);
    return $res;
}
Ejemplo n.º 2
0
session_start();
$_SESSION['signInTable'] = 'user_tbl';
if (isset($_POST['nameReady'])) {
    //新用户注册提交
    if ($_POST['nameReady'] == 1 && $_POST['password'] == $_POST['password2']) {
        $token = getRandStr();
        $insertId = pdoInsert($_SESSION['signInTable'], array('name' => $_POST['name'], 'password' => md5($_POST['password']), 'app_id' => $_POST['app_id'], 'app_secret' => $_POST['app_secret'], 'weixin_id' => $_POST['weixin_id'], 'token' => $token));
        $initJson = '{"access_token":"null","expires_in":7200,"gettedTime":0}';
        file_put_contents($GLOBALS['mypath'] . '/tokens/' . $_POST['weixin_id'] . '.token', $initJson);
        $defaultModule = pdoQuery('module_tbl', array('path'), null, ' limit 1');
        $data = $defaultModule->fetch();
        $duty = array($data['path']);
        //        $prejson=array('dutyContent'=>$duty);
        $json = json_encode(array('dutyContent' => $duty));
        $json = addslashes($json);
        $moduleId = pdoInsert('duty_tbl', array('weixin_id' => $_POST['weixin_id'], 'duty' => $json));
        $_SESSION['weixinId'] = $_POST['weixin_id'];
        $_SESSION['login'] = true;
        $_SESSION['userName'] = $_POST['name'];
        header('location: ../admin');
        exit;
    } else {
        include 'signup.html.php';
        exit;
    }
}
if (isset($_GET['signup'])) {
    include 'signup.html.php';
    exit;
}
if (isset($_POST['login'])) {
Ejemplo n.º 3
0
    echo $row['inf'];
    exit;
}
if (isset($_POST['addToCart'])) {
    if (isset($_SESSION['customerId'])) {
        //            mylog(('insert'));
        $cartId = pdoInsert('cart_tbl', array('c_id' => $_SESSION['customerId'], 'g_id' => $_POST['g_id'], 'd_id' => $_POST['d_id'], 'number' => $_POST['number']), 'update');
        $value = array();
        foreach ($_SESSION['buyNow']['partsList'] as $k => $v) {
            $value[] = array('cart_id' => $cartId, 'part_id' => $k, 'part_number' => $v);
        }
        pdoBatchInsert('part_cart_tbl', $value);
        if (isset($_SESSION['tempCart'])) {
        }
        if (!isset($_SESSION['customerLogin'])) {
            pdoInsert('custom_login_tbl', array('id' => $_SESSION['customerId']), ' ignore');
            $_SESSION['customerLogin'] = true;
        }
    } else {
        $_SESSION['tempCart'][] = array('g_id' => $_POST['g_id'], 'd_id' => $_POST['d_id'], 'number' => $_POST['number']);
    }
}
if (isset($_POST['adFilter'])) {
    $adQuery = pdoQuery('(select * from user_ad_filt_view order by sale asc) p', null, array('mc_id' => $_POST['mc_id']), ' group by g_id limit 10');
    $inf = array();
    foreach ($adQuery as $row) {
        $inf[] = $row;
    }
    echo json_encode($inf);
    exit;
}
Ejemplo n.º 4
0
function getWechatMode($customerId)
{
    $query = pdoQuery('wechat_mode_tbl', null, array('c_id' => $customerId), ' limit 1');
    if ($row = $query->fetch()) {
        $mode = $row['mode'];
    } else {
        $mode = 'normal';
        pdoInsert('wechat_mode_tbl', array('c_id' => $customerId, 'mode' => $mode), 'ignore');
    }
    return $mode;
}
Ejemplo n.º 5
0
<?php

error_reporting(-1);
ini_set('display_errors', 'On');
require 'vendor/autoload.php';
require 'time_since.php';
require 'db/aurasql.php';
require 'get_incidents.php';
$incidents = getIncidents();
foreach ($incidents as $incident) {
    $select = $query_factory->newSelect();
    $select->cols(array('id', 'status'))->from('incidents')->where('incident_id = :incident_id')->bindValue('incident_id', $incident['incident_id'])->limit(1);
    $data = pdoSelect($select);
    if (count($data)) {
        $data = $data[0];
        if ($incident['status'] !== $data['status']) {
            $update_data = array('status' => $incident['status'], 'duration' => $incident['duration']);
            if ($incident['status'] === 'resolved') {
                $update_data['resolved'] = $incident['resolved'];
            }
            d(pdoUpdate('incidents', $data['id'], $update_data));
        }
    } else {
        d(pdoInsert('incidents', $incident));
    }
    //    d($data);
}
Ejemplo n.º 6
0
 private function exeContent()
 {
     if (isset($_POST['newsEdit'])) {
         $id = pdoInsert('news_tbl', array('md5' => $this->newsId, 'weixin_id' => $_SESSION['weixinId'], 'content' => addslashes($_POST['newsEdit']), 'update_time' => time()));
     }
 }
Ejemplo n.º 7
0
<?php

//$mypath = $_SERVER['DOCUMENT_ROOT'] . '/wechat';
//include_once $mypath . '/includes/magicquotes.inc.php';
//include_once $mypath . '/includes/db.inc.php';
//include_once $mypath . '/includes/helpers.inc.php';
//include_once $mypath . '/class/wechat.php';
include_once $mypath . '/contrller/serveManager.php';
wxlog('include wechatWall ok');
$userInf = getUnionId($msg['from'], $msg['me']);
$userName = $userInf['nickname'];
$userIcon = $userInf['headimgurl'];
$sex = $userInf['sex'];
$url = 'insert into wechat_wall_tbl set user_name="' . $userName . '",sex="' . $sex . '",user_icon="' . $userIcon . '",content=:content,img_url=:imgUrl,upload_time=:uploadTime';
if ($msg['type'] == 'text') {
    pdoInsert('wechat_wall_tbl', array('owner' => $msg['me'], 'user_name' => $userName, 'sex' => $sex, 'user_icon' => $userIcon, 'content' => $msg['content'], 'upload_time' => time()));
}
if ($msg['type'] == 'image') {
    pdoInsert('wechat_wall_tbl', array('owner' => $msg['me'], 'user_name' => $userName, 'sex' => $sex, 'user_icon' => $userIcon, 'img_url' => $msg['PicUrl'], 'upload_time' => time()));
}
$echoMsg = $weixin->prepareTextMsg($msg['from'], $msg['me'], '收到了');
echo $echoMsg;
exit;
Ejemplo n.º 8
0
 }
 if (isset($_POST['del_parm'])) {
     //        mylog($_POST['cate']);
     pdoDelete('par_col_tbl', array('sc_id' => $_POST['sc_id'], 'par_category' => $_POST['cate']));
     echo 'ok';
     exit;
 }
 if (isset($_POST['cateRemark'])) {
     pdoUpdate('sub_category_tbl', array('remark' => $_POST['content']), array('id' => $_POST['sc_id']));
     echo 'ok';
     exit;
 }
 if (isset($_POST['hostGoodsSet'])) {
     //        mylog($_POST['situation']);
     if ($_POST['situation'] == 'true') {
         pdoInsert('part_tbl', array('g_id' => $_POST['g_id'], 'part_g_id' => $_POST['part_g_id']), 'ignore');
     } else {
         //            mylog('delete');
         pdoDelete('part_tbl', array('g_id' => $_POST['g_id'], 'part_g_id' => $_POST['part_g_id']));
     }
     echo 'ok';
     exit;
 }
 if (isset($_POST['del_g_img'])) {
     $urlquery = pdoQuery('g_image_tbl', array('url'), array('g_id' => $_POST['g_id'], 'remark' => $_POST['md5']), 'limit 1');
     $url = $urlquery->fetch();
     pdoDelete('g_image_tbl', array('g_id' => $_POST['g_id'], 'remark' => $_POST['md5']));
     $query = pdoQuery('g_image_tbl', array('id'), array('remark' => $_POST['md5']), ' limit 1');
     if (!$query->fetch()) {
         unlink('../' . $url['url']);
     }
Ejemplo n.º 9
0
    if (isset($_GET['wechat'])) {
        include_once '../wechat/serveManager.php';
        if (isset($_GET['createButton'])) {
            createButtonTemp();
            exit;
        }
        if (isset($_GET['sendTemplateMsg'])) {
            //            mylog($re);
            exit;
        }
    }
    if (isset($_GET['imgUpdate'])) {
        mylog('update');
    }
    if (isset($_GET['goodsSituation'])) {
        pdoUpdate('g_inf_tbl', array('situation' => $_GET['goodsSituation']), array('id' => $_GET['g_id']));
        $g_id = $_GET['g_id'];
        header('location:index.php?goods-config=1&g_id=' . $g_id);
        exit;
    }
    if (isset($_GET['updateParm'])) {
        $value['g_id'] = $_GET['g_id'];
        foreach ($_POST as $k => $v) {
            $value[$k] = $v;
        }
        pdoInsert('parameter_tbl', $value, 'update');
        $g_id = $_GET['g_id'];
        header('location:index.php?goods-config=1&g_id=' . $g_id);
        exit;
    }
}
Ejemplo n.º 10
0
     //        header('contentType:application/json');
     $jsonInf = json_encode($inf, JSON_UNESCAPED_UNICODE);
     mylog('imgUploaded:' . $jsonInf);
     echo $jsonInf;
     exit;
 }
 if (isset($_FILES['parts-img-up'])) {
     $uploader = new uploader('parts-img-up');
     $uploader->upFile($_GET['g_id'] . '_' . time() . rand(1000, 9999));
     $inf = $uploader->getFileInfo();
     $jsonInf = json_encode($inf, JSON_UNESCAPED_UNICODE);
     if ('SUCCESS' == $inf['state']) {
         mylog('success');
         $temp = pdoQuery('g_image_tbl', null, array('g_id' => $_GET['g_id']), 'limit 1');
         if (!($row = $temp->fetch())) {
             pdoInsert('g_image_tbl', array('g_id' => $_GET['g_id'], 'url' => $inf['url'], 'remark' => $inf['md5']), 'ignore');
             mylog("create record");
         } else {
             pdoUpdate('g_image_tbl', array('remark' => $inf['md5'], 'url' => $inf['url']), array('g_id' => $_GET['g_id']));
             $query = pdoQuery('image_view', null, array('remark' => $row['remark']), ' limit 1');
             if (!($t = $query->fetch())) {
                 unlink('../' . $row['url']);
                 mylog('unlink"../' . $row['url']);
             } else {
                 mylog('not unlink');
             }
         }
     }
     mylog($jsonInf);
     echo $jsonInf;
     exit;
Ejemplo n.º 11
0
function reflashAutoReply()
{
    $replyinf = $GLOBALS['mInterface']->getByCurl('https://api.weixin.qq.com/cgi-bin/get_current_autoreply_info?access_token=ACCESS_TOKEN');
    //    output(addslashes($replyinf));
    //    exit;
    $replyRule = json_decode($replyinf, true);
    if ($replyRule['is_autoreply_open'] == 1) {
        if (isset($replyRule['add_friend_autoreply_info'])) {
            $readyContent = formatContent($replyRule['add_friend_autoreply_info']['type'], $replyRule['add_friend_autoreply_info']['content']);
            $readyContent['request_type'] = 'event';
            $readyContent['key_word'] = 'add_friend_autoreply_info';
            $readyContent['update_time'] = time();
            pdoInsert('default_reply_tbl', $readyContent, ' ON DUPLICATE KEY UPDATE content="' . $readyContent['content'] . '",update_time=' . time());
        }
        foreach ($replyRule['keyword_autoreply_info']['list'] as $row) {
            $readyContent = formatContent($row['reply_list_info'][0]['type'], $row['reply_list_info'][0]['news_info']['list']);
            $readyContent['key_word'] = $row['keyword_list_info'][0]['content'];
            pdoInsert('default_reply_tbl', $readyContent, ' ON DUPLICATE KEY UPDATE content="' . $readyContent['content'] . '",update_time=' . time());
            //            $reContent = json_encode(array('news_item' => $content));
        }
    }
}
Ejemplo n.º 12
0
        $_SESSION['customerId'] = $userId['openid'];
        $_SESSION['userInf'] = getUnionId($userId['openid']);
    } else {
        mylog('cannot get Code');
    }
    $rand = rand(1000, 9999);
    $_SESSION['rand'] = $rand;
    header('location:index.php?rand=' . $rand);
    if (isset($_SESSION['userInf'])) {
        foreach ($_SESSION['userInf'] as $k => $v) {
            if ('subscribe_time' == $k) {
                $v = date('Y-m-d H:i:s', $v);
            }
            $data[$k] = addslashes($v);
        }
        $re = pdoInsert('custom_inf_tbl', $data, 'update');
        //        mylog($re);
    }
    exit;
}
//获取主分类
if (isset($_GET['getFcList'])) {
    $father_id = $_GET['fc_id'];
    $cate = pdoQuery('category_view', null, null, '');
    $maincate = array();
    $cateList = array();
    foreach ($cate as $caRow) {
        $maincate[$caRow['father_id']] = array('name' => $caRow['father_name'], 'id' => $caRow['father_id']);
        if ($father_id == $caRow['father_id']) {
            $cateList[] = $caRow;
        }
Ejemplo n.º 13
0
<?php

$mypath = $_SERVER['DOCUMENT_ROOT'] . '/wechat';
include_once $mypath . '/includes/magicquotes.inc.php';
include_once $mypath . '/includes/db.inc.php';
include_once $mypath . '/includes/helpers.inc.php';
include_once $mypath . '/contrller/serveManager.php';
include_once $mypath . '/class/newsEdit.php';
session_start();
if (isset($_SESSION['login']) && $_SESSION['login']) {
    if (isset($_GET['uedit'])) {
        //        $_POST['uEdit'];
        $id = pdoInsert('news_tbl', array('md5' => md5($_POST['uEdit']), 'weixin_id' => $_SESSION['weixinId'], 'content' => addslashes($_POST['uEdit']), 'update_time' => time()));
        $query = pdoQuery('news_tbl', null, array('id' => $id), null);
        $row = $query->fetch();
        output($row['content']);
        //        echo $row('content');
        echo 'OK';
        exit;
    }
    if (isset($_GET['newsedit'])) {
        if (!isset($_SESSION['temp_name'])) {
            $_SESSION['temp_name'] = getRandStr();
        }
        $news = new newsEdit($_SESSION['temp_name']);
    }
    if (isset($_GET['upload'])) {
        include 'upload.html.php';
        exit;
    }
    if (isset($_FILES['loadIn'])) {
Ejemplo n.º 14
0
            foreach ($mediaList['item'] as $row) {
                $allList[] = json_encode($row, JSON_UNESCAPED_UNICODE);
            }
        }
        if (isset($_POST['content'])) {
            $_POST['key_word'] = trim($_POST['key_word']);
            $key = $_POST['key_word'] == '' ? '.' : preg_replace('/,|,/', '\\|', $_POST['key_word']);
            $content = addslashes($_POST['content']);
            switch ($_POST['type']) {
                case 'news':
                    $postjsondata = json_encode(array('media_id' => $_POST['content']));
                    $content = getMedia($postjsondata);
                    $content = addslashes($content);
                    break;
            }
            pdoInsert('default_reply_tbl', array('weixin_id' => $_SESSION['weixinId'], 'reply_type' => $_POST['type'], 'key_word' => $key, 'content' => $content), ' ON DUPLICATE KEY UPDATE content="' . $content . '"');
            header('location: ?auto_reply=1');
        }
        if (isset($_GET['deleteAutoReply'])) {
            $sql = 'delete from default_reply_tbl where weixin_id="' . $_SESSION['weixinId'] . '" and id=' . $_GET['deleteAutoReply'];
            $pdo->exec($sql);
            header('location: ?auto_reply=1');
        }
        $query = pdoQuery('default_reply_tbl', null, array('weixin_id' => $_SESSION['weixinId']), null);
        printView('/admin/view/autoreply.html.php', '自动回复设置');
    }
    if (isset($_GET['getDefultReply'])) {
        reflashAutoReply();
        header('location: ?auto_reply=1');
    }
}
Ejemplo n.º 15
0
 /**
  * 链接图文信息与图片,便于管理
  * @param $news_id
  * @param $md5
  */
 private function addImgToNews($news_id, $md5)
 {
     pdoInsert('news_img_tbl', array('news_id' => $news_id, 'img_id' => $md5), 'ignore');
 }