Exemplo n.º 1
0
function make_cache($type, $from, $to, $cache_time, $rewrite = false)
{
    $hour_key = date('H', $from);
    // Кэш дневной ленты переходов
    $params = array('type' => 'basic', 'part' => 'hour', 'filter' => array(), 'group_by' => $type, 'subgroup_by' => $type, 'conv' => 'all', 'mode' => '', 'col' => 'sale_lead', 'from' => date('Y-m-d H:i:s', $from), 'to' => date('Y-m-d H:i:s', $to), 'cache' => 2);
    $arr_report_data = get_clicks_report_grouped2($params);
    /*
    		dmp($params);
    		dmp($arr_report_data);
    		die();*/
    $str = join('', $arr_report_data['click_params']) . join('', $arr_report_data['campaign_params']);
    echo $str . '<br />';
    if (empty($arr_report_data['data'])) {
        return false;
    }
    foreach ($arr_report_data['data'] as $k => $v) {
        $r = $v[$hour_key];
        $ins = array('type' => $type, 'id' => $r['id'], 'time' => $cache_time, 'name' => $r['name'], 'price' => $r['price'], 'unique' => $r['unique'], 'income' => $r['income'], 'direct' => $r['direct'], 'sale' => $r['sale'], 'lead' => $r['lead'], 'act' => $r['act'], 'out' => $r['out'], 'cnt' => $r['cnt'], 'sale_lead' => $r['sale_lead'], 'rebuild' => 0, 'params' => bindec($str));
        $q = insertsql($ins, 'tbl_clicks_cache_hour', true);
        echo $q . '<br />';
        db_query($q);
    }
    if ($rewrite) {
        $q = "update `tbl_clicks_cache_hour` set `rebuild` = '0' where `time` = '" . $cache_time . "'";
        db_query($q);
    }
    return true;
}
Exemplo n.º 2
0
function addCom($nid, $message, $uid)
{
    $cid = insertSQL("insert into comments (content,uid,time) values('{$message}',{$uid},now())");
    if ($cid) {
        insertsql("insert into com_news(cid,nid) values({$cid},{$nid})");
    }
    return $cid;
}
Exemplo n.º 3
0
function addAlly($name, $tag, $descr = "", $url = "", $irc = "")
{
    if (!$name) {
        echo "db.ally::addAlly: name fehlt";
        return;
    }
    if (!$tag) {
        echo "db.ally::addAlly: name fehlt";
        return;
    }
    return insertsql("\n    insert into alliance (name,tag,descr,irc,url)\n    values ('{$name}','{$tag}','{$descr}','{$irc}','{$url}')\n  ");
}
Exemplo n.º 4
0
<?
	include "../setup.php";

	$dbname = "board_manager";

if ($mode=="add"){
	$max_sql = mysql_query("select max(bbs_cd) from $dbname");
	$max = @mysql_result($max_sql, 0);

	if ($max >= 1){
		$max = $max + 1;
	}else{
		$max = $max;
	}

	insertsql($dbname, "set board_name='$board_name', bbs_cd='$max'");

	$bmno = "";
	$mode = "";

?>
<SCRIPT LANGUAGE="JavaScript">
<!--
	top.amenu.location.href="/security/left.html";	
//-->
</SCRIPT>
<?

}elseif ($mode=="mody" && $bmno){

	updatesql($dbname, "set board_name='$board_name'","where seq_no='$bmno'");
Exemplo n.º 5
0
function updateUserOnline($id)
{
    Assert::isId($id);
    $result = selectsqlLine("select * from useronline where uid = {$id}");
    if ($result) {
        query("update useronline set time = now() where uid = {$id}");
    } else {
        insertsql("insert into useronline (uid,time) values({$id},Now())");
    }
}
    $lightStatus = $data[lightStatus];
    $irStatus = $data[irStatus];
    $devId = $data[devId];
}
echo "test";
die;
//发送查询设备id,如果不存在则在数据库里面进行注册
if ($msgType == "queryDevId") {
    $retDevId = "retDevId";
    //查询数据库,获取返回的设备ID
    $devId = (int) querysql($chipId);
    //  echo $devId;
    // die;
    if (empty($devId)) {
        //将值写入数据库
        $devId = (int) insertsql($chipId, $devType);
    }
    //返回json数据
    $data = json_encode(array('msgType' => $retDevId, 'seq' => $seq, 'devId' => $devId));
    echo $data;
    die;
}
//发送设备状态更新信息
if ($msgType == "updateData") {
    $retUpdateData = "retUpdateData";
    $notify = "no";
    //notify表示服务器是否有主动消息通知设备
    $notifyBody = "无更新";
    //notifyBody表示消息实体
    //更新数据库,返回对应的数据消息
    //目前处理逻辑为,更新请求全部设置为更新数据库中该设备的状态
Exemplo n.º 7
0
	alertNgo("수정이 완료되었습니다.", "location", "list.php?".$para);

}elseif ($rbno && $reply=="Y"){

	$data = fetch_array($dbname, "where seq_no='$rbno'");

	$max = $data[list_num];
	$renum = $data[ref]+1;
	$relevel = $data[re_level]+1;

	if ($relevel == 0){
		$parno = $data[seq_no];
	}else{
		$parno = $data[par_no];
	}

	updatesql($dbname, "set ref=ref+1", "where list_num='$max' and ref>='$renum'");

	$fields = array('', 'list_num', 'ref', 're_level', 'par_no', 'code_num', 'name', 'email', 'subject', 'content', 'file1', 'passwd', 'crt_date', 'udt_date', 'bbs_cd');

	$keys = array('', $max, $renum, $relevel, $parno, $code_num, $name, $email, $subject, $content, $rfile1, $passwd, 'now()', 'now()', $bbs_cd);
	
	$set = autoset($fields, $keys);

	insertsql($dbname, $set);

	alertNgo("답글이 등록되었습니다.", "location", "list.php?".$para);

}	
foot();
?>
Exemplo n.º 8
0
 function process_conversion($data)
 {
     // Default account currency id: 16; RUB
     $main_currency_id = 16;
     $cnt = count($this->params);
     $i = 0;
     $is_lead = isset($data['is_lead']) ? 1 : 0;
     $is_sale = isset($data['is_sale']) ? 1 : 0;
     unset($data['is_lead']);
     unset($data['is_sale']);
     $arr_currencies = get_active_currencies();
     $conversion_currency_code = strtoupper($data['txt_param20']);
     if ($conversion_currency_code == 'RUB') {
         $conversion_currency_code = 'RUR';
     }
     $conversion_currency_id = 0;
     foreach ($arr_currencies as $id => $cur) {
         if ($cur['code'] == $conversion_currency_code) {
             $conversion_currency_id = $id;
         }
     }
     // Currency is not found in active, use default currency
     if ($conversion_currency_id == 0) {
         $conversion_currency_id = $main_currency_id;
     }
     if ($conversion_currency_id == $main_currency_id) {
         $conversion_profit = $data['profit'];
     } else {
         $conversion_profit = convert_currency($data['profit'], $conversion_currency_id, $main_currency_id, date('Y-m-d'));
     }
     $conversion_profit_currency = $data['profit'];
     // Специальная обработка "статусного постбэка" от сети CTR.
     // В этом случае приходит только статус, связанный с остальными данными через order_id (i3)
     // и нужно поменять статус соостветствующей конвертации.
     $ctr_order = false;
     // флаг, о том, что некоторые операции (замену логов) выполнять не нужно,
     // так как это не полный запрос, а только статус
     if ($data['network'] == 'CTR' and !empty($data['status'])) {
         $q = 'SELECT * FROM `tbl_conversions` WHERE (`i3` = "' . mysql_real_escape_string($data['i3']) . '"
         AND `network` = "CTR") LIMIT 1';
         if ($rs = db_query($q) and mysql_num_rows($rs) > 0) {
             $r = mysql_fetch_assoc($rs);
             $data['subid'] = $r['subid'];
         }
         dmp($data);
         foreach ($data as $k => $v) {
             if (!in_array($k, array('network', 'i3', 'status', 'txt_status', 'ak', 'date_add', 'subid'))) {
                 unset($data[$k]);
             }
         }
         $ctr_order = true;
     }
     if (isset($data['subid']) && $data['subid'] != '') {
         $table = 'tbl_clicks';
         $subid = $data['subid'];
         // мы скоро обнулим массив data, а subid нам ещё понадобится
         $status = $data['status'];
         // Проверяем есть ли клик с этим SibID
         $q = 'SELECT `id`, `is_sale`, `is_lead` FROM `' . $table . '` WHERE `subid` = "' . mysql_real_escape_string($subid) . '"';
         $r = mysql_query($q) or die($q . '<br />' . mysql_error());
         if (mysql_num_rows($r) > 0) {
             $f = mysql_fetch_assoc($r);
             $click_id = $f['id'];
             if ($data['profit'] > 0) {
                 $is_lead = $f['is_lead'] > 0 ? 1 : 0;
                 $is_sale = 1;
             } else {
                 $is_lead = 1;
                 $is_sale = $f['is_sale'] > 0 ? 1 : 0;
             }
             $q = "UPDATE `" . $table . "` SET\n                `is_sale` = " . intval($is_sale) . ",\n                `is_lead` = " . intval($is_lead) . ",\n                `conversion_currency_sum` = '" . mysql_real_escape_string($conversion_profit_currency) . "',\n                `conversion_currency_id` = '" . mysql_real_escape_string($conversion_currency_id) . "',\n                `conversion_price_main` = '" . mysql_real_escape_string($conversion_profit) . "'\n                WHERE `id` = '" . mysql_real_escape_string($click_id) . "'";
             mysql_query($q) or die(mysql_error());
         }
         // ----------------------------
         // Готовим данные для конверсии
         // ----------------------------
         $upd = array();
         // Инициализируем массив для запроса на обновление
         // Дополнительные поля, которых нет в $params, но которые нам нужны в БД
         $additional_fields = array('date_add', 'txt_status', 'status', 'network', 'type');
         foreach ($data as $name => $value) {
             if (array_key_exists($name, $this->params) or in_array($name, $additional_fields)) {
                 $upd[$name] = $value;
                 unset($data[$name]);
             }
         }
         $upd['date_add'] = mysql_now();
         // date('Y-m-d H:i:s');
         $upd['profit'] = $conversion_profit;
         $upd['currency_id'] = $conversion_currency_id;
         $upd['profit_currency'] = $conversion_profit_currency;
         // Проверяем, есть ли уже конверсия с таким SubID
         $q = "SELECT * FROM `tbl_conversions` WHERE `subid` = '" . mysql_real_escape_string($subid) . "' LIMIT 1";
         $r = db_query($q) or die(mysql_error());
         if (mysql_num_rows($r) > 0) {
             $f = mysql_fetch_assoc($r);
             $upd['id'] = $conv_id = $f['id'];
             $q = updatesql($upd, 'tbl_conversions', 'id');
             db_query($q);
             // Чистим логи
             if (!$ctr_order) {
                 db_query('DELETE FROM `tbl_postback_params` WHERE `conv_id` = ' . $f['id']) or die(mysql_error());
             }
         } else {
             $q = insertsql($upd, 'tbl_conversions');
             db_query($q);
             $conv_id = mysql_insert_id();
         }
         // Нужно ли нам отменить продажу?
         if ($status == 2) {
             delete_sale($click_id, $conv_id, 'sale');
         }
         // Пишем postback логи
         foreach ($data as $name => $value) {
             if (strpos($name, 'pbsave_') !== false) {
                 $name = str_replace('pbsave_', '', $name);
                 $ins = array('conv_id' => $conv_id, 'name' => $name, 'value' => value);
                 $q = insertsql($ins, 'tbl_postback_params');
                 db_query($q);
             }
         }
     }
 }
Exemplo n.º 9
0
 function process_conversion($data)
 {
     $cnt = count($this->params);
     $i = 0;
     $is_lead = isset($data['is_lead']) ? 1 : 0;
     $is_sale = isset($data['is_sale']) ? 1 : 0;
     unset($data['is_lead']);
     unset($data['is_sale']);
     switch ($data['txt_param20']) {
         case 'UAH':
         case 'uah':
             $data['profit'] = convert_to_usd('uah', $data['profit']);
             break;
         case 'USD':
         case 'usd':
             $data['profit'] = convert_to_usd('usd', $data['profit']);
             break;
         default:
             $data['profit'] = convert_to_usd('rub', $data['profit']);
             break;
     }
     // Специальная обработка "статусного постбэка" от сети CTR. В этом случае приходит только статус, связанный с остальными данными через order_id (i3) и нужно поменять статус соостветствующей конвертации.
     // https://uniquedesign.teamworkpm.net/tasks/3679474
     $ctr_order = false;
     // флаг, о том, что некоторые операции (замену логов) выполнять не нужно, так как это не полный запрос, а только статус
     if ($data['network'] == 'CTR' and !empty($data['status'])) {
         $q = 'SELECT * FROM `tbl_conversions` WHERE (`i3` = "' . mysql_real_escape_string($data['i3']) . '" AND `network` = "CTR") LIMIT 1';
         if ($rs = db_query($q) and mysql_num_rows($rs) > 0) {
             $r = mysql_fetch_assoc($rs);
             $data['subid'] = $r['subid'];
         }
         dmp($data);
         foreach ($data as $k => $v) {
             if (!in_array($k, array('network', 'i3', 'status', 'txt_status', 'ak', 'date_add', 'subid'))) {
                 unset($data[$k]);
             }
         }
         $ctr_order = true;
     }
     dmp($data);
     if (isset($data['subid']) && $data['subid'] != '') {
         //to_log('data', $data);
         $subid = $data['subid'];
         // мы скоро обнулим массив data, а subid нам ещё понадобится
         $status = $data['status'];
         $click_info = array();
         // информация о клике
         //Проверяем есть ли клик с этим SibID
         $q = 'SELECT * FROM `tbl_clicks` WHERE `subid` = "' . mysql_real_escape_string($subid) . '"';
         $r = mysql_query($q) or die(mysql_error());
         if (mysql_num_rows($r) > 0) {
             $click_info = mysql_fetch_assoc($r);
             $click_id = $click_info['id'];
             if ($data['profit'] > 0) {
                 $is_lead = $click_info['is_lead'] > 0 ? 1 : 0;
                 $is_sale = 1;
             } else {
                 $is_lead = 1;
                 $is_sale = $click_info['is_sale'] > 0 ? 1 : 0;
             }
             mysql_query('UPDATE `tbl_clicks` SET `is_sale` = ' . $is_sale . ', `is_lead` = ' . intval($is_lead) . ', `conversion_price_main` = "' . mysql_real_escape_string($data['profit']) . '" WHERE `id` = ' . $click_id) or die(mysql_error());
         }
         // ----------------------------
         // Готовим данные для конверсии
         // ----------------------------
         $upd = array();
         // Инициализируем массив для запроса на обновление
         // Дополнительные поля, которых нет в $params, но которые нам нужны в БД
         $additional_fields = array('date_add', 'txt_status', 'status', 'network', 'type');
         foreach ($data as $name => $value) {
             if (array_key_exists($name, $this->params) or in_array($name, $additional_fields)) {
                 $upd[$name] = $value;
                 unset($data[$name]);
             }
         }
         //if (empty($upd['date_add'])) {
         $upd['date_add'] = mysql_now();
         // date('Y-m-d H:i:s');
         //}
         // Проверяем, есть ли уже конверсия с таким SubID
         $q = 'SELECT * FROM `tbl_conversions` WHERE `subid` = "' . mysql_real_escape_string($subid) . '" LIMIT 1';
         $r = db_query($q) or die(mysql_error());
         if (mysql_num_rows($r) > 0) {
             $f = mysql_fetch_assoc($r);
             $upd['id'] = $conv_id = $f['id'];
             $q = updatesql($upd, 'tbl_conversions', 'id');
             db_query($q);
             // Чистим логи
             if (!$ctr_order) {
                 db_query('DELETE FROM `tbl_postback_params` WHERE `conv_id` = ' . $f['id']) or die(mysql_error());
             }
         } else {
             $q = insertsql($upd, 'tbl_conversions');
             db_query($q);
             $conv_id = mysql_insert_id();
         }
         // Нужно ли нам отменить продажу?
         if ($status == 2) {
             delete_sale($click_id, $conv_id, 'sale');
             //return false;
         }
         // S2S сети
         // https://uniquedesign.teamworkpm.net/tasks/4160565
         $q = "select * \n            \tfrom `tbl_adnets` \n            \twhere `status` = '0' \n            \tand `name` = '" . mysql_real_escape_string($data['n']) . "'";
         if ($rs = db_query($q) and mysql_num_rows($rs) > 0) {
             // Подставляем переменные в ссылку
             $replace = array('[SUBID]' => $subid, '[PROFIT_USD]' => $this->source_data['profit'], '[PROFIT_RUB]' => convert_usd_to('rub', $this->source_data['profit']), '[PROFIT_EUR]' => convert_usd_to('eur', $this->source_data['profit']), '[PROFIT_UAH]' => convert_usd_to('uah', $this->source_data['profit']));
             // Добавляем параметры Postback
             foreach ($this->source_data as $name => $value) {
                 $replace['[POSTBACK_' . $name . ']'] = $value;
             }
             // Добавляем параметры перехода
             for ($i = 1; $i <= 15; $i++) {
                 if (!empty($click_info['click_param_name' . $i])) {
                     $replace['[CLICK_' . $click_info['click_param_name' . $i] . ']'] = $click_info['click_param_value' . $i];
                 }
             }
             dmp($replace);
             while ($r = mysql_fetch_assoc($rs)) {
                 $url = $r['url'];
                 // Поставляем все переменные
                 foreach ($replace as $k => $v) {
                     $url = str_ireplace($k, $v, $url);
                 }
                 // Cleaning not used []-params
                 $url = preg_replace('/\\ = (\\[[a-z\\_0-9]+\\])/i', ' = ', $url);
                 $result = send_post_request($url, array());
                 // Сохраняем S2S лог
                 $str = date('Y-m-d H:i:s') . ' SubID: ' . $subid . "\nURL:" . $url . "\\Result:" . $result[1] . "\n\n";
                 dmp(htmlspecialchars($str));
                 file_put_contents(_CACHE_PATH . '/log/' . '.s2s_' . date('Y-m-d'), $str, FILE_APPEND | LOCK_EX);
             }
         }
         // Пишем postback логи
         foreach ($data as $name => $value) {
             if (strpos($name, 'pbsave_') !== false) {
                 $name = str_replace('pbsave_', '', $name);
                 $ins = array('conv_id' => $conv_id, 'name' => $name, 'value' => value);
                 $q = insertsql($ins, 'tbl_postback_params');
                 db_query($q);
             }
         }
     }
 }
Exemplo n.º 10
0
    $new_id = mysql_insert_id();
    // Корректируем имя линка
    $link_name = 'lnk_' . $new_id;
    $upd = array('link_name' => $link_name, 'id' => $new_id);
    $q = updatesql($upd, 'tbl_rules', 'id');
    db_query($q);
    // Копируем правила из существующего линка в новый
    $links = array();
    $q = "select `type`, `value` \n        from `tbl_rules_items` \n        where `status` = '0' \n            and rule_id = '" . $old_id . "'\n            order by `id`";
    $rs = db_query($q);
    while ($r = mysql_fetch_assoc($rs)) {
        $links[] = $r;
    }
    foreach ($links as $link) {
        $ins = array('rule_id' => $new_id, 'parent_id' => $link['type'] == 'redirect' ? mysql_insert_id() : 0, 'type' => $link['type'], 'value' => $link['value'], 'status' => 0);
        $q = insertsql($ins, 'tbl_rules_items');
        db_query($q);
    }
    // Синхронизация кэша (временное имя)
    cache_rules_update($link_name);
    echo $new_id;
    exit;
}
if ($_REQUEST['ajax_act'] == 'get_source_link') {
    $source = rq('source');
    //if($source == 'source')
    $name = rq('name');
    $rule_id = rq('id', 1);
    $direct = rq('direct', 1);
    /*
     if($source == 'landing')
Exemplo n.º 11
0
/**
 * @return integer fid der Flotte
 * @param array $fleet
 * @desc F�gt eine Flotte hinzu
*/
function fleet_add($fleet = null)
{
    $insert = array();
    if ($fleet) {
        $checkfleet = array("jaeger", "bomber", "fregatten", "zerstoerer", "kreuzer", "schlachter", "traeger", "kleptoren", "cancris");
        foreach ($checkfleet as $key) {
            if ($fleet[$key]) {
                $insert[$key] = $fleet[$key];
            }
        }
    }
    return insertsql("\n    insert into fleet(" . join(",", array_keys($insert)) . ")\n    values (" . join(",", array_values($insert)) . ")\n  ");
}
Exemplo n.º 12
0
function targets_add($attid, $gala, $pos)
{
    if (!is_numeric($attid)) {
        return;
    }
    if (!is_numeric($gala)) {
        return;
    }
    if (!$pos) {
        return;
    }
    if (!is_array($pos)) {
        $pos = array($pos);
    }
    //vorhandene scans ermitteln
    $scans = selectsql("select * from scans where gala = {$gala} and pos IN (" . join(",", $pos) . ")");
    $sid_list = array();
    $pos_list = array();
    if ($scans) {
        foreach ($scans as $scan) {
            $sid_list[] = $scan['sid'];
            $pos_list[] = $scan['pos'];
        }
    }
    //noch zu erstellende scans
    $todo_list = array_diff($pos, $pos_list);
    if (count($todo_list)) {
        if ($list = addScans($gala, $todo_list)) {
            $sid_list = $sid_list + $list;
        }
    }
    // bereits eingetragene Ziele ermitteln
    $targets_sid = selectsql("select sid from attack_target", "sid");
    if ($targets_sid) {
        $todo_list = array_diff($sid_list, $targets_sid);
    } else {
        $todo_list = $sid_list;
    }
    foreach ($todo_list as $sid) {
        insertsql("insert into attack_target (attid,sid) values ({$attid},{$sid})");
    }
    return $todo_list;
}
/**
 * Создание нового спота для кликов
 */
function clicks_spot_add()
{
    $current_spot_id = clicks_spot_get();
    $q = "select max(`date_add`) as `max_time` from `tbl_clicks_s" . $current_spot_id . "`";
    $rs = db_query($q);
    $r = mysql_fetch_assoc($rs);
    $max_spot_time = $r['max_time'];
    // Завершаем текущий спот
    $q = "update tbl_clicks_map set `time_end` = '" . $max_spot_time . "', `current` = '0' where `id` = '" . $current_spot_id . "'";
    // Создание нового спота
    $ins = array('time_begin' => '2000-01-01 00:00:00', 'time_end' => '2020-01-01 00:00:00', 'current' => '1');
    $q = insertsql($ins, 'tbl_clicks_map');
    db_query($q);
    $new_spot_id = mysql_insert_id();
    $q = "CREATE TABLE IF NOT EXISTS `tbl_clicks_s" . $new_spot_id . "` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `date_add` datetime NOT NULL,\n  `user_ip` varchar(255) NOT NULL,\n  `user_agent` text CHARACTER SET utf8 NOT NULL,\n  `user_os` varchar(255) CHARACTER SET utf8 NOT NULL,\n  `user_os_version` varchar(255) CHARACTER SET utf8 NOT NULL,\n  `user_platform` varchar(255) CHARACTER SET utf8 NOT NULL,\n  `user_platform_info` varchar(255) CHARACTER SET utf8 NOT NULL,\n  `user_platform_info_extra` varchar(255) CHARACTER SET utf8 NOT NULL,\n  `user_browser` varchar(255) CHARACTER SET utf8 NOT NULL,\n  `user_browser_version` varchar(255) CHARACTER SET utf8 NOT NULL,\n  `is_mobile_device` tinyint(1) NOT NULL,\n  `is_phone` tinyint(1) NOT NULL,\n  `is_tablet` tinyint(1) NOT NULL,\n  `country` varchar(255) NOT NULL,\n  `state` varchar(255) CHARACTER SET utf8 NOT NULL,\n  `city` varchar(255) CHARACTER SET utf8 NOT NULL,\n  `region` varchar(255) CHARACTER SET utf8 NOT NULL,\n  `isp` varchar(255) CHARACTER SET utf8 NOT NULL,\n  `rule_id` int(11) NOT NULL,\n  `out_id` int(11) NOT NULL,\n  `subid` varchar(255) CHARACTER SET utf8 NOT NULL,\n  `subaccount` varchar(255) CHARACTER SET utf8 NOT NULL,\n  `source_name` varchar(255) CHARACTER SET utf8 NOT NULL,\n  `campaign_name` varchar(255) CHARACTER SET utf8 NOT NULL,\n  `ads_name` varchar(255) CHARACTER SET utf8 NOT NULL,\n  `referer` text CHARACTER SET utf8 NOT NULL,\n  `search_string` text CHARACTER SET utf8 NOT NULL,\n  `click_price` decimal(10,4) NOT NULL,\n  `conversion_price_main` decimal(10,4) NOT NULL,\n  `is_lead` tinyint(1) NOT NULL,\n  `is_sale` tinyint(1) NOT NULL,\n  `is_parent` tinyint(1) NOT NULL,\n  `is_connected` tinyint(1) NOT NULL,\n  `parent_id` int(11) NOT NULL,\n  `is_unique` tinyint(1) NOT NULL DEFAULT '0',\n  `campaign_param1` varchar(255) CHARACTER SET utf8 NOT NULL,\n  `campaign_param2` varchar(255) CHARACTER SET utf8 NOT NULL,\n  `campaign_param3` varchar(255) CHARACTER SET utf8 NOT NULL,\n  `campaign_param4` varchar(255) CHARACTER SET utf8 NOT NULL,\n  `campaign_param5` varchar(255) CHARACTER SET utf8 NOT NULL,\n  `click_param_name1` varchar(255) CHARACTER SET utf8 NOT NULL,\n  `click_param_value1` text CHARACTER SET utf8 NOT NULL,\n  `click_param_name2` varchar(255) CHARACTER SET utf8 NOT NULL,\n  `click_param_value2` text CHARACTER SET utf8 NOT NULL,\n  `click_param_name3` varchar(255) CHARACTER SET utf8 NOT NULL,\n  `click_param_value3` text CHARACTER SET utf8 NOT NULL,\n  `click_param_name4` varchar(255) CHARACTER SET utf8 NOT NULL,\n  `click_param_value4` text CHARACTER SET utf8 NOT NULL,\n  `click_param_name5` varchar(255) CHARACTER SET utf8 NOT NULL,\n  `click_param_value5` text CHARACTER SET utf8 NOT NULL,\n  `click_param_name6` varchar(255) CHARACTER SET utf8 NOT NULL,\n  `click_param_value6` text CHARACTER SET utf8 NOT NULL,\n  `click_param_name7` varchar(255) CHARACTER SET utf8 NOT NULL,\n  `click_param_value7` text CHARACTER SET utf8 NOT NULL,\n  `click_param_name8` varchar(255) CHARACTER SET utf8 NOT NULL,\n  `click_param_value8` text CHARACTER SET utf8 NOT NULL,\n  `click_param_name9` varchar(255) CHARACTER SET utf8 NOT NULL,\n  `click_param_value9` text CHARACTER SET utf8 NOT NULL,\n  `click_param_name10` varchar(255) CHARACTER SET utf8 NOT NULL,\n  `click_param_value10` text CHARACTER SET utf8 NOT NULL,\n  `click_param_name11` varchar(255) CHARACTER SET utf8 NOT NULL,\n  `click_param_value11` text CHARACTER SET utf8 NOT NULL,\n  `click_param_name12` varchar(255) CHARACTER SET utf8 NOT NULL,\n  `click_param_value12` text CHARACTER SET utf8 NOT NULL,\n  `click_param_name13` varchar(255) CHARACTER SET utf8 NOT NULL,\n  `click_param_value13` text CHARACTER SET utf8 NOT NULL,\n  `click_param_name14` varchar(255) CHARACTER SET utf8 NOT NULL,\n  `click_param_value14` text CHARACTER SET utf8 NOT NULL,\n  `click_param_name15` varchar(255) CHARACTER SET utf8 NOT NULL,\n  `click_param_value15` text CHARACTER SET utf8 NOT NULL,\n  PRIMARY KEY (`id`),\n  UNIQUE KEY `subid` (`subid`)\n) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;";
    db_query($q);
}
Exemplo n.º 14
0
function scan_add($gala, $pos, $values = null)
{
    if (!is_numeric($gala) || !is_numeric($pos)) {
        return false;
    }
    if ($values && is_array($values)) {
        $check = array("nick");
        $insert = array();
        foreach ($values as $key => $val) {
            if (in_array($key, $check)) {
                $insert[$key] = "'" . mysql_escape_string($val) . "'";
            }
        }
        if ($insert) {
            $sqlkeys = "," . join(",", array_keys($insert));
            $sqlvals = "," . join(",", array_values($insert));
        }
    }
    return insertsql("\n    insert into scans (gala,pos" . $sqlkeys . ") values ({$gala},{$pos}" . $sqlvals . ")");
}
$irStatus = $data[irStatus];
//echo $msgType;
echo $result;
//echo $data
die;
//发送查询设备id,如果不存在则在数据库里面进行注册
if ($msgType == "queryDevId") {
    $chipId = $data[chipId];
    $retDevId = "retDevId";
    //查询数据库,获取返回的设备ID
    $devId = querysql($chipId);
    //  echo $devId;
    // die;
    if (empty($devId)) {
        //将值写入数据库
        $devId = insertsql($chipId);
    }
    //返回json数据
    $data = json_encode(array('msgType' => $retDevId, 'seq' => $seq, 'devId' => $devId));
    echo $data;
    die;
}
//发送设备状态更新信息
if ($msgType == "updateData") {
    $retUpdateData = "retUpdateData";
    $notify = "no";
    //notify表示服务器是否有主动消息通知设备
    $notifyBody = "it's a test";
    //notifyBody表示消息实体
    //更新数据库,返回对应的数据消息
    //目前处理逻辑为,更新请求全部设置为更新数据库中该设备的状态