コード例 #1
0
ファイル: index.php プロジェクト: conversionstudio/cpatracker
 $out_ids = array();
 // ID офферов
 foreach ($rules_item as $cur_item) {
     $item = $rules_item[$i];
     $out_id = $rule_values[$i];
     $out_ids[] = intval($out_id);
     if ($item['val'] != '') {
         $q = "insert into tbl_rules_items (rule_id, parent_id, type, value) values ('" . mysql_real_escape_string($rule_id) . "', '0', '" . mysql_real_escape_string($item['type']) . "', '" . mysql_real_escape_string($item['val']) . "')";
         db_query($q);
         $parent_id = mysql_insert_id();
         $q = "insert into tbl_rules_items (rule_id, parent_id, type, value) values ('" . mysql_real_escape_string($rule_id) . "', '" . mysql_real_escape_string($parent_id) . "', 'redirect', '" . mysql_real_escape_string($out_id) . "')";
         db_query($q);
     }
     $i++;
 }
 $out = cache_rules_update($rule_name);
 // Добавляем в вывод названия первых трёх офферов
 if (!empty($out_ids)) {
     $out_ids = array_unique($out_ids);
     $outs_all = array();
     $q = "select `id`, `offer_name`\n                    from `tbl_offers`\n                    where `id` in (" . join(',', $out_ids) . ")";
     $rs = db_query($q);
     while ($r = mysql_fetch_assoc($rs)) {
         $outs_all[$r['id']] = $r['offer_name'];
     }
     $i = 0;
     $outs = array();
     foreach ($out_ids as $out_id) {
         $outs[] = $outs_all[$out_id];
         if (++$i >= 3) {
             break;
コード例 #2
0
ファイル: index.php プロジェクト: conversionstudio/cpatracker
     cache_remove_rule($rule_name);
     // Add new rules
     $i = 0;
     foreach ($rules_item as $cur_item) {
         $item = $rules_item[$i];
         $out_id = $rule_values[$i];
         if ($item['val'] != '') {
             $sql = "insert into tbl_rules_items (rule_id, parent_id, type, value) values ('" . mysql_real_escape_string($rule_id) . "', '0', '" . mysql_real_escape_string($item['type']) . "', '" . mysql_real_escape_string($item['val']) . "')";
             mysql_query($sql);
             $parent_id = mysql_insert_id();
             $sql = "insert into tbl_rules_items (rule_id, parent_id, type, value) values ('" . mysql_real_escape_string($rule_id) . "', '" . mysql_real_escape_string($parent_id) . "', 'redirect', '" . mysql_real_escape_string($out_id) . "')";
             mysql_query($sql);
         }
         $i++;
     }
     $out = cache_rules_update();
     echo json_encode($out);
     // Create rule in tracker cache
     //cache_set_rule ($rule_name);
     exit;
     break;
 case 'add_offer':
     $category_id = $_REQUEST['category_id'];
     $link_name = $_REQUEST['link_name'];
     $link_url = $_REQUEST['link_url'];
     edit_offer($category_id, $link_name, $link_url);
     // Redirect to links page with category_id
     if ($category_id != '') {
         header("Location: " . _HTML_ROOT_PATH . "/?page=links&category_id={$category_id}");
     } else {
         header("Location: " . _HTML_ROOT_PATH . "/?page=links");
コード例 #3
0
function delete_rule($rule_id, $status = 1)
{
    // Get rule name
    $q = "select id, link_name from tbl_rules where id='" . _str($rule_id) . "'";
    $rs = db_query($q);
    $r = mysql_fetch_assoc($rs);
    if ($r['id'] > 0) {
        $q = "update tbl_rules set status='" . $status . "' where id='" . _str($rule_id) . "'";
        db_query($q);
        $q = "update tbl_rules_items set status='" . $status . "' where rule_id='" . _str($rule_id) . "'";
        db_query($q);
        // Обновление кэша
        cache_rules_update($row['link_name']);
    }
    return;
}