当前位置: 首页>>代码示例>>PHP>>正文


PHP debug_print函数代码示例

本文整理汇总了PHP中debug_print函数的典型用法代码示例。如果您正苦于以下问题:PHP debug_print函数的具体用法?PHP debug_print怎么用?PHP debug_print使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了debug_print函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_basket

function get_basket($argument1, $argument2 = NULL)
{
    global $connection;
    // If we received two arguments, they are $member_id and $delivery_id
    if (is_numeric($argument1) && is_numeric($argument2)) {
        $query_where = 'WHERE
          member_id = "' . mysql_real_escape_string($argument1) . '"
          AND delivery_id = "' . mysql_real_escape_string($argument2) . '"';
    } elseif (is_numeric($argument1)) {
        $query_where = 'WHERE
          basket_id = "' . mysql_real_escape_string($argument1) . '"';
    }
    $basket_fields = array('basket_id', 'member_id', 'delivery_id', NEW_TABLE_BASKETS . '.site_id', 'site_short', 'site_long', NEW_TABLE_BASKETS . '.delivery_postal_code', NEW_TABLE_BASKETS . '.delivery_type', 'delivery_cost', 'order_cost', 'order_cost_type', 'customer_fee_percent', 'order_date', 'checked_out', 'locked');
    // Get the basket information...
    $query = '
      SELECT
        ' . implode(",\n        ", $basket_fields) . '
      FROM ' . NEW_TABLE_BASKETS . '
      LEFT JOIN ' . NEW_TABLE_SITES . ' USING(site_id)
      ' . $query_where;
    $result = mysql_query($query, $connection) or die(debug_print("ERROR: 892305 ", array($query, mysql_error()), basename(__FILE__) . ' LINE ' . __LINE__));
    if ($row = mysql_fetch_array($result)) {
        return $row;
    } else {
        // Error... no basket found
        // die(debug_print('ERROR: 502 ', 'basket does not exist', basename(__FILE__).' LINE '.__LINE__));
    }
}
开发者ID:vanboingy,项目名称:OFS_trunk,代码行数:28,代码来源:func.get_basket.php

示例2: get_basket_item

function get_basket_item($argument1, $product_id = NULL, $delivery_id = NULL)
{
    global $connection;
    $selected_fields = array('bpid', 'basket_id', 'product_id', 'product_version', 'quantity', 'total_weight', NEW_TABLE_BASKET_ITEMS . '.product_fee_percent', NEW_TABLE_BASKET_ITEMS . '.subcategory_fee_percent', NEW_TABLE_BASKET_ITEMS . '.producer_fee_percent', 'taxable', 'out_of_stock', 'date_added', 'producer_id', 'product_name', 'product_description', 'subcategory_id', 'unit_price', 'pricing_unit', 'ordering_unit', 'random_weight', 'meat_weight_type', 'minimum_weight', 'maximum_weight', 'extra_charge', 'image_id', 'listing_auth_type', 'created', 'modified', 'tangible', 'sticky', 'storage_id', 'checked_out', 'message');
    if (is_numeric($argument1) && is_numeric($product_id) && is_numeric($delivery_id)) {
        $query_where = 'RIGHT JOIN ' . NEW_TABLE_BASKETS . ' USING (basket_id)
        WHERE
          member_id = "' . mysql_real_escape_string($argument1) . '"
          AND product_id = "' . mysql_real_escape_string($product_id) . '"
          AND delivery_id = "' . mysql_real_escape_string($delivery_id) . '"';
    } elseif (is_numeric($argument1) && is_numeric($product_id)) {
        $query_where = 'WHERE
          basket_id = "' . mysql_real_escape_string($argument1) . '"
          AND product_id = "' . mysql_real_escape_string($product_id) . '"';
    } elseif (is_numeric($argument1)) {
        $query_where = 'WHERE
          bpid = "' . mysql_real_escape_string($argument1) . '"';
    } else {
        die(debug_print('ERROR: 101 ', 'unexpected request', basename(__FILE__) . ' LINE ' . __LINE__));
    }
    $query = '
      SELECT
        ' . implode(",\n        ", $selected_fields) . '
      FROM ' . NEW_TABLE_BASKET_ITEMS . '
      LEFT JOIN ' . NEW_TABLE_PRODUCTS . ' USING(product_id,product_version)
      LEFT JOIN ' . NEW_TABLE_MESSAGES . ' ON
        (' . NEW_TABLE_MESSAGES . '.message_type_id = 1
        AND ' . NEW_TABLE_BASKET_ITEMS . '.bpid = ' . NEW_TABLE_MESSAGES . '.referenced_key1)
      ' . $query_where;
    $result = mysql_query($query, $connection) or die(debug_print("ERROR: 799031 ", array($query, mysql_error()), basename(__FILE__) . ' LINE ' . __LINE__));
    if ($row = mysql_fetch_array($result)) {
        return $row;
    }
}
开发者ID:vanboingy,项目名称:OFS_trunk,代码行数:34,代码来源:func.get_basket_item.php

示例3: execute

function execute($request)
{
    $language_info = api_autograder_get_language_info($request['path_parts'][1]);
    if ($language_info == null) {
        return build_response_not_found("Language not found.");
    }
    $language_key = $language_info['key'];
    $language_id = $language_info['language_id'];
    $problems = api_autograder_menu_get_problems($request['user_id'], 'practice', 0, $language_id);
    debug_print($problems);
    if ($problems['OK']) {
        $output = array('<h1>' . htmlspecialchars($language_info['name']) . ' Practice Problems</h1>');
        if (count($problems['ordered_problem_ids']) == 0) {
            array_push($output, "<div>Empty!</div>");
        }
        foreach ($problems['ordered_problem_ids'] as $problem_id) {
            $problem_info = $problems['problem_' . $problem_id];
            array_push($output, '<div><a href="/practice/' . $language_key . '/' . $problem_id . '">');
            array_push($output, htmlspecialchars($problem_info['title']));
            array_push($output, '</a></div>');
        }
        return build_response_ok($language_info['title'] . " Practice Problems", implode("\n", $output));
    } else {
        if ($problems['message'] == 'INVALID_LANGUAGE') {
            return build_response_not_found("Language not found.");
        }
    }
}
开发者ID:blakeohare,项目名称:nerdparadise,代码行数:28,代码来源:problem_list.php

示例4: later

 /**
  *
  * */
 public function later()
 {
     $this->useModel('later');
     $data = Request::post();
     $data['ipAddress'] = $_SERVER['REMOTE_ADDR'];
     $data['createdAt'] = date('Y-m-d H:i:s');
     $save = $this->model->later->saveData($data, true);
     debug_print($save, true);
 }
开发者ID:varyan,项目名称:namecpaseSystem,代码行数:12,代码来源:Action.php

示例5: prdcr_contact_info

function prdcr_contact_info($start, $half)
{
    global $connection;
    $query = '
      SELECT
        ' . TABLE_PRODUCER . '.producer_id,
        ' . TABLE_PRODUCER . '.business_name,
        ' . TABLE_PRODUCER . '.member_id,
        ' . TABLE_MEMBER . '.first_name,
        ' . TABLE_MEMBER . '.first_name,
        ' . TABLE_MEMBER . '.last_name,
        ' . TABLE_MEMBER . '.address_line1,
        ' . TABLE_MEMBER . '.address_line2,
        ' . TABLE_MEMBER . '.city,
        ' . TABLE_MEMBER . '.state,
        ' . TABLE_MEMBER . '.zip,
        ' . TABLE_PRODUCER . '.unlisted_producer
      FROM
        ' . TABLE_PRODUCER . ',
        ' . TABLE_MEMBER . '
      WHERE
        ' . TABLE_PRODUCER . '.member_id = ' . TABLE_MEMBER . '.member_id
        AND ' . TABLE_PRODUCER . '.unlisted_producer = "0"
        AND ' . TABLE_MEMBER . '.membership_discontinued != "1"
      ORDER BY
        ' . TABLE_PRODUCER . '.business_name ASC
      LIMIT ' . mysql_real_escape_string($start) . ', ' . mysql_real_escape_string($half);
    $result = @mysql_query($query, $connection) or die(debug_print("ERROR: 869302 ", array($query, mysql_error()), basename(__FILE__) . ' LINE ' . __LINE__));
    while ($row = mysql_fetch_array($result)) {
        $producer_id = $row['producer_id'];
        $business_name = $row['business_name'];
        $first_name = $row['first_name'];
        $last_name = $row['last_name'];
        $address_line1 = $row['address_line1'];
        $address_line2 = $row['address_line2'];
        $city = $row['city'];
        $state = $row['state'];
        $zip = $row['zip'];
        $display .= $business_name . '</b><br>';
        $display .= $first_name . ' ' . $last_name . '</b><br>';
        $display .= $address_line1 . '<br>';
        if ($address_line2) {
            $display .= $address_line2 . '<br>';
        }
        $display .= $city . ', ' . $state . ' ' . $zip . '<br>';
        $display .= '<br>';
    }
    return $display;
}
开发者ID:vanboingy,项目名称:OFS_trunk,代码行数:49,代码来源:producers_labels.php

示例6: get_member

function get_member($member_id)
{
    global $connection;
    // Expose additional parameters as they become needed.
    $selected_fields = array('pending', 'username', 'password', 'auth_type', 'business_name', 'preferred_name', 'membership_type_id', 'membership_date', 'last_renewal_date', 'membership_discontinued', 'mem_taxexempt', 'mem_delch_discount', 'notes', 'order_cost', 'order_cost_type');
    $query = '
      SELECT
        ' . implode(",\n        ", $selected_fields) . '
      FROM ' . TABLE_MEMBER . '
      LEFT JOIN ' . TABLE_MEMBERSHIP_TYPES . ' USING(membership_type_id)
      WHERE
        member_id = "' . mysql_real_escape_string($member_id) . '"';
    $result = mysql_query($query, $connection) or die(debug_print("ERROR: 740293 ", array($query, mysql_error()), basename(__FILE__) . ' LINE ' . __LINE__));
    if ($row = mysql_fetch_array($result)) {
        return $row;
    }
}
开发者ID:vanboingy,项目名称:OFS_trunk,代码行数:17,代码来源:func.get_member.php

示例7: get_producer

function get_producer($producer_id)
{
    // Expose additional parameters as they become needed.
    global $connection;
    $producer_fields = array('producer_id', 'producer_link', 'pending', 'member_id', 'business_name', 'producer_fee_percent', 'unlisted_producer', 'pub_address', 'pub_email', 'pub_email2', 'pub_phoneh', 'pub_phonew', 'pub_phonec', 'pub_phonet', 'pub_fax', 'pub_web');
    $query = '
      SELECT
        ' . implode(",\n        ", $producer_fields) . ',
        (SELECT GROUP_CONCAT(site_id)
         FROM ' . TABLE_AVAILABILITY . '
         WHERE producer_id = ' . TABLE_PRODUCER . '.producer_id) AS available_site_ids
      FROM ' . TABLE_PRODUCER . '
      WHERE producer_id = "' . mysql_real_escape_string($producer_id) . '"';
    $result = mysql_query($query, $connection) or die(debug_print("ERROR: 895053 ", array($query, mysql_error()), basename(__FILE__) . ' LINE ' . __LINE__));
    if ($row = mysql_fetch_array($result)) {
        return $row;
    }
}
开发者ID:vanboingy,项目名称:OFS_trunk,代码行数:18,代码来源:func.get_producer.php

示例8: codesword_macd

function codesword_macd($real, $fastPeriod = 12, $slowPeriod = 26)
{
    $fastEma = codesword_ema($real, $fastPeriod);
    $slowEma = codesword_ema($real, $slowPeriod);
    $ctrFastOffset = 0;
    $macd = [];
    for ($i = 0; $i < count($slowEma); $i++) {
        if ($i == 0) {
            for ($j = 0; $j < $slowPeriod; $j++) {
                if ($fastEma[$j][0] == $slowEma[0][0]) {
                    $ctrFastOffset = $j;
                    debug_print("start of comparison: {$ctrFastOffset} <Br>");
                    break;
                }
            }
        }
        $macd[$i][0] = $slowEma[$i][0];
        $macd[$i][1] = $fastEma[$i + $ctrFastOffset][1] - $slowEma[$i][1];
    }
    // The signal is a 9-day EMA
    $signal = codesword_ema($macd, 9);
    $ctrMacdOffset = 0;
    $histogram = [];
    $macdFull = [];
    for ($i = 0; $i < count($signal); $i++) {
        if ($i == 0) {
            for ($j = 0; $j < $slowPeriod; $j++) {
                if ($macd[$j][0] == $signal[0][0]) {
                    $ctrMacdOffset = $j;
                    debug_print("start of comparison: {$ctrMacdOffset} <Br>");
                    break;
                }
            }
        }
        $histogram[$i][0] = $signal[$i][0];
        $histogram[$i][1] = $macd[$i + $ctrMacdOffset][1] - $signal[$i][1];
        $macdFull[$i][0] = $signal[$i][0];
        $macdFull[$i][1] = $macd[$i + $ctrMacdOffset][1];
        $macdFull[$i][2] = $signal[$i][1];
        $macdFull[$i][3] = $macd[$i + $ctrMacdOffset][1] - $signal[$i][1];
    }
    return $macdFull;
}
开发者ID:panbognot,项目名称:stana,代码行数:43,代码来源:codesword_macd.php

示例9: sql_query

function sql_query($query, $print = false)
{
    $db = sql_get_db();
    if ($print) {
        debug_print($query);
    }
    $start = microtime(true);
    $output = $db->query(trim($query));
    $end = microtime(true);
    $diff = $end - $start;
    sql_log_query($query, $end - $start);
    if ($db->errno == 0) {
        return $output;
    }
    echo '<div style="padding:8px; background-color:#f88; color:#400; font-weight:bold; font-size:12px; font-family: &quot;Courier New&quot;, monospace;">';
    echo htmlspecialchars($db->error);
    echo '<br /><br />';
    echo nl2br(str_replace(' ', '&nbsp;', htmlspecialchars($query)));
    echo '</div>';
    exit;
}
开发者ID:blakeohare,项目名称:nerdparadise,代码行数:21,代码来源:database.php

示例10: get_account_name

function get_account_name($account_type, $account_key)
{
    global $connection;
    switch ($account_type) {
        case 'member':
            $query = '
          SELECT preferred_name AS name
          FROM ' . TABLE_MEMBER . '
          WHERE member_id = "' . mysql_real_escape_string($account_key) . '"';
            break;
        case 'producer':
            $query = '
          SELECT business_name AS name
          FROM ' . TABLE_PRODUCER . '
          WHERE producer_id = "' . mysql_real_escape_string($account_key) . '"';
            break;
        case 'tax':
            $query = '
          SELECT CONCAT_WS(" ", postal_code, region_name, region_type) AS name
          FROM ' . NEW_TABLE_TAX_RATES . '
          WHERE tax_id = "' . mysql_real_escape_string($account_key) . '"';
            break;
        case 'internal':
            $query = '
          SELECT description AS name
          FROM ' . NEW_TABLE_ACCOUNTS . '
          WHERE account_id = "' . mysql_real_escape_string($account_key) . '"';
            break;
    }
    $result = mysql_query($query, $connection) or die(debug_print("ERROR: 753093 ", array($query, mysql_error()), basename(__FILE__) . ' LINE ' . __LINE__));
    if ($row = mysql_fetch_array($result)) {
        return $row['name'];
    } else {
        die(debug_print("ERROR: 786304 ", "Account {$account_type}::{$account_key} was not found", basename(__FILE__) . ' LINE ' . __LINE__));
    }
}
开发者ID:vanboingy,项目名称:OFS_trunk,代码行数:36,代码来源:func.get_account_info.php

示例11: debug_print

 $tpl['data']['currency_name'] = $tpl['currency_list'][$tpl['data']['currency_id']];
 // проверим, не голосовали ли мы за это в последние 30 минут
 $repeated = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\t\t\tSELECT `id`\n\t\t\t\tFROM `" . DB_PREFIX . MY_PREFIX . "my_tasks`\n\t\t\t\tWHERE `type` = 'promised_amount' AND\n\t\t\t\t\t\t\t `id` = {$tpl['data']['id']} AND\n\t\t\t\t\t\t\t `time` > " . (time() - TASK_TIME) . "\n\t\t\t\t", 'fetch_one');
 //print '<!--'.$db->printsql()."\n".TASK_TIME."-->";
 if ($repeated) {
     //print '<!--repeated-->';
     require_once ABSPATH . 'templates/tasks.tpl';
     break;
 }
 // если нету видео на ютубе, то получаем host юзера, где брать видео
 if ($tpl['data']['video_url_id'] == 'null') {
     $tpl['data']['host'] = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\t\t\tSELECT `host`\n\t\t\t\tFROM `" . DB_PREFIX . "miners_data`\n\t\t\t\tWHERE `user_id` = {$tpl['data']['user_id']}\n\t\t\t\tLIMIT 1\n\t\t\t\t", 'fetch_one');
 }
 // каждый раз обязательно проверяем, где находится юзер
 $tpl['data']['user_info'] = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\t\t\tSELECT `latitude`,\n\t\t\t\t\t\t\t `user_id`,\n\t\t\t\t\t\t\t `longitude`,\n\t\t\t\t\t\t\t `photo_block_id`,\n\t\t\t\t\t\t\t `photo_max_miner_id`,\n\t\t\t\t\t\t\t `miners_keepers`,\n\t\t\t\t\t\t\t `host`\n\t\t\t\tFROM `" . DB_PREFIX . "miners_data`\n\t\t\t\tWHERE `user_id` = {$tpl['data']['user_id']}\n\t\t\t\tLIMIT 1\n\t\t\t\t", 'fetch_array');
 debug_print($tpl['data']['user_info'], __FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__);
 // получим ID майнеров, у которых лежат фото нужного нам юзера
 /*$miners_ids = ParseData::get_miners_keepers($tpl['data']['user_info']['photo_block_id'], $tpl['data']['user_info']['photo_max_miner_id'],  $tpl['data']['user_info']['miners_keepers'], true);
 		debug_print($miners_ids, __FILE__, __LINE__,  __FUNCTION__,  __CLASS__, __METHOD__);
 		// берем 1 случайный из 10-и ID майнеров
 		$r = array_rand($miners_ids, 1);
 		$miner_id = $miners_ids[$r];
 		// получаем хост, где будем брать фото лица проверяемого нами майнера
 		$tpl['data']['miner_host'] = $db->query( __FILE__, __LINE__,  __FUNCTION__,  __CLASS__, __METHOD__, "
 				SELECT `host`
 				FROM `".DB_PREFIX."miners_data`
 				WHERE `miner_id` = {$miner_id}
 				", 'fetch_one' );*/
 // получим ID майнеров, у которых лежат фото нужного нам юзера
 $miners_ids = ParseData::get_miners_keepers($tpl['data']['user_info']['photo_block_id'], $tpl['data']['user_info']['photo_max_miner_id'], $tpl['data']['user_info']['miners_keepers'], true);
 if ($miners_ids) {
开发者ID:scuba323,项目名称:dcoin,代码行数:31,代码来源:tasks.php

示例12: unset

$binary_tx = $aes->decrypt($encrypted_tx_set);
unset($aes);
debug_print('$binary_tx=' . $binary_tx, __FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__);
// разберем полученные тр-ии
do {
    $tx_size = ParseData::decode_length($binary_tx);
    $tx_binary_data = ParseData::string_shift($binary_tx, $tx_size);
    debug_print('$tx_binary_data=' . $tx_binary_data, __FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__);
    list(, $tx_hex) = unpack("H*", $tx_binary_data);
    if (!$tx_binary_data) {
        continue;
    }
    // проверим размер
    if (strlen($tx_binary_data) > $variables['max_tx_size']) {
        debug_print('strlen($binary_tx) > $variables[max_tx_size]', __FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__);
        die("error tx size");
    }
    // точно ли выдали то
    /*if ( md5($tx_binary_data) != $new_data['tx_hash'] ) {
    		debug_print("error tx_hash (".md5($tx_binary_data)."!={$new_data['tx_hash']})", __FILE__, __LINE__,  __FUNCTION__,  __CLASS__, __METHOD__);
    		die ("error tx_hash (".md5($tx_binary_data)."!={$new_data['tx_hash']})");
    	}*/
    // временно для тестов
    $new_data['high_rate'] = 0;
    $tx_hash = md5($tx_binary_data);
    // заливаем тр-ию в БД
    $file = save_tmp_644('FTB', "{$tx_hash}\t{$new_data['high_rate']}\t{$tx_hex}");
    debug_print("hash={$tx_hash}\ndata={$tx_hex}", __FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__);
    $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\t\tLOAD DATA LOCAL INFILE  '{$file}'\n\t\t\tIGNORE INTO TABLE `" . DB_PREFIX . "queue_tx`\n\t\t\tFIELDS TERMINATED BY '\t'\n\t\t\t(@hash, `high_rate`, @data)\n\t\t\tSET  `hash` = UNHEX(@hash),\n\t\t\t\t    `data` = UNHEX(@data)\n\t\t\t");
    unlink($file);
} while ($binary_tx);
开发者ID:scuba323,项目名称:dcoin,代码行数:31,代码来源:gate_hashes.php

示例13: open_basket

function open_basket(array $data)
{
    global $connection;
    // Expose additional parameters as they become needed. Call with:
    $basket_fields = array('basket_id', 'member_id', 'delivery_id', 'site_id', 'delivery_type', 'delivery_postal_code', 'delivery_cost', 'order_cost', 'order_cost_type', 'customer_fee_percent', 'order_date', 'checked_out', 'locked');
    // At a minimum, we need to know the member_id and the delivery_id
    if (!$data['member_id'] || !$data['delivery_id']) {
        die(debug_print('ERROR: 504 ', 'call to create basket without all parameters', basename(__FILE__) . ' LINE ' . __LINE__));
    }
    // See if a basket already exists
    $query_basket_info = '
      SELECT
        ' . implode(",\n        ", $basket_fields) . '
      FROM ' . NEW_TABLE_BASKETS . '
      WHERE
        member_id = "' . mysql_real_escape_string($data['member_id']) . '"
        AND delivery_id = "' . mysql_real_escape_string($data['delivery_id']) . '"';
    $result_basket_info = mysql_query($query_basket_info, $connection) or die(debug_print("ERROR: 892122 ", array($query_basket_info, mysql_error()), basename(__FILE__) . ' LINE ' . __LINE__));
    if ($row_basket_info = mysql_fetch_array($result_basket_info)) {
        // Done with nothing to do. Return the information...
        return $row_basket_info;
    }
    // Now we need site_id and delivery_type. If we already have them, good. Otherwise make a best-guess
    if (!$data['site_id']) {
        // See what site_id this member used prior to the target delivery_id
        $query_site_guess = '
          SELECT
            ' . NEW_TABLE_BASKETS . '.site_id,
            ' . NEW_TABLE_BASKETS . '.delivery_type
          FROM ' . NEW_TABLE_BASKETS . '
          LEFT JOIN ' . NEW_TABLE_SITES . ' USING(site_id)
          WHERE
            ' . NEW_TABLE_BASKETS . '.delivery_id < "' . mysql_real_escape_string($data['delivery_id']) . '"
            AND ' . NEW_TABLE_BASKETS . '.member_id = "' . mysql_real_escape_string($data['member_id']) . '"
            AND ' . NEW_TABLE_SITES . '.inactive = 0
            AND ' . NEW_TABLE_SITES . '.site_type = "customer"
          ORDER BY ' . NEW_TABLE_BASKETS . '.delivery_id DESC
          LIMIT 1';
        $result_site_guess = mysql_query($query_site_guess, $connection) or die(debug_print("ERROR: 902524 ", array($query_site_guess, mysql_error()), basename(__FILE__) . ' LINE ' . __LINE__));
        // If we get a result back, then we will use it
        if ($row_site_guess = mysql_fetch_array($result_site_guess)) {
            $data['site_id'] = $row_site_guess['site_id'];
            // If we already have a delivery_type value, then do not clobber it
            if (!$data['delivery_type']) {
                $data['delivery_type'] = $row_site_guess['delivery_type'];
            }
            $data['site_selection'] = 'revert';
        } else {
            // We could try some other things to make successively poor guesses, but for now
            // this will be the end of the line
            $data['site_selection'] = 'unset';
            return $data;
            // die(debug_print('ERROR: 505 ', 'create basket with no remaining good guesses', basename(__FILE__).' LINE '.__LINE__));
        }
    }
    // Get additional basket data for opening this basket
    $query_basket_data = '
      SELECT
        ' . NEW_TABLE_SITES . '.delivery_postal_code,
        ' . NEW_TABLE_SITES . '.delivery_charge AS delivery_cost,
        ' . NEW_TABLE_SITES . '.site_long,
        ' . TABLE_MEMBERSHIP_TYPES . '.order_cost,
        ' . TABLE_MEMBERSHIP_TYPES . '.order_cost_type,
        ' . TABLE_MEMBER . '.customer_fee_percent,
        ' . TABLE_MEMBER . '.zip AS home_zip,
        ' . TABLE_MEMBER . '.work_zip
      FROM ' . NEW_TABLE_SITES . '
      INNER JOIN ' . TABLE_MEMBER . '
      LEFT JOIN ' . TABLE_MEMBERSHIP_TYPES . ' USING(membership_type_id)
      WHERE
        ' . NEW_TABLE_SITES . '.site_id = "' . mysql_real_escape_string($data['site_id']) . '"
        AND ' . TABLE_MEMBER . '.member_id = "' . mysql_real_escape_string($data['member_id']) . '"';
    $result_basket_data = mysql_query($query_basket_data, $connection) or die(debug_print("ERROR: 983134 ", array($query_basket_data, mysql_error()), basename(__FILE__) . ' LINE ' . __LINE__));
    if ($row_basket_data = mysql_fetch_array($result_basket_data)) {
        $data['delivery_postal_code'] = $row_basket_data['delivery_postal_code'];
        $data['delivery_cost'] = $row_basket_data['delivery_cost'];
        $data['order_cost'] = $row_basket_data['order_cost'];
        $data['order_cost_type'] = $row_basket_data['order_cost_type'];
        $data['customer_fee_percent'] = $row_basket_data['customer_fee_percent'];
        $data['site_long'] = $row_basket_data['site_long'];
        $home_zip = $row_basket_data['home_zip'];
        $work_zip = $row_basket_data['work_zip'];
    } else {
        die(debug_print('ERROR: 506 ', 'create basket failure to gather information', basename(__FILE__) . ' LINE ' . __LINE__));
    }
    // If the delivery is not 'P' (pickup) then set the clobber $delivery_postal_code with the correct value
    if ($data['delivery_type'] == 'H') {
        $data['delivery_postal_code'] = $home_zip;
    } elseif ($data['delivery_type'] == 'W') {
        $data['delivery_postal_code'] = $work_zip;
    } elseif ($data['delivery_type'] != 'P') {
        die(debug_print('ERROR: 507 ', 'create basket invalid delivery_type', basename(__FILE__) . ' LINE ' . __LINE__));
    }
    // Check if there is a delivery_postal code provided This should possibly check against
    // the tax_rates table to see that the postal code is included there...?
    if (!$data['delivery_postal_code']) {
        die(debug_print('ERROR: 508 ', 'create basket invalid delivery_postal_code', basename(__FILE__) . ' LINE ' . __LINE__));
    }
    // Now open a basket with the provided (or guessed) information
    $query_open_basket = '
//.........这里部分代码省略.........
开发者ID:vanboingy,项目名称:OFS_trunk,代码行数:101,代码来源:func.open_basket.php

示例14: debug_print

    // для тестов получим что там есть
    $tmp_testblock_data = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\t\tSELECT *\n\t\t\tFROM `" . DB_PREFIX . "testblock`\n\t\t\t", 'fetch_array');
    debug_print($tmp_testblock_data, __FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__);
    debug_print("LOAD DATA LOCAL INFILE  '{$file}' REPLACE INTO TABLE `" . DB_PREFIX . "testblock`", __FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__);
    // т.к. эти данные создали мы сами, то пишем их сразу в таблицу проверенных данных, которые будут отправлены другим нодам
    $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\t\tLOAD DATA LOCAL INFILE  '{$file}' REPLACE INTO TABLE `" . DB_PREFIX . "testblock`\n\t\t\tFIELDS TERMINATED BY '\t'\n\t\t\t(`block_id`,`time`,`level`,`user_id`, @header_hash, @signature, @mrkl_root)\n\t\t\tSET `header_hash` = UNHEX(@header_hash),\n\t\t\t\t   `signature` = UNHEX(@signature),\n\t\t\t\t   `mrkl_root` = UNHEX(@mrkl_root)\n\t\t\t");
    unlink($file);
    // иногда не вставлялось, т.к. уже что-то было в testblock . добавил REPLACE
    debug_print('AffectedRows=' . $db->getAffectedRows(), __FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__);
    /// #######################################
    // Отмечаем транзакции, которые попали в transactions_testblock
    // Пока для эксперимента
    // если не отмечать, то получается, что и в transactions_testblock и в transactions будут провернные тр-ии, которые откатятся дважды
    if ($used_transactions) {
        $used_transactions = substr($used_transactions, 0, -1);
        $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\t\t\tUPDATE `" . DB_PREFIX . "transactions`\n\t\t\t\tSET `used`=1\n\t\t\t\tWHERE `hash` IN ({$used_transactions})\n\t\t\t\t");
        // для теста тупо удаляем, т.к. она уже есть в transactions_testblock
        /*  $db->query( __FILE__, __LINE__,  __FUNCTION__,  __CLASS__, __METHOD__, "
        				DELETE FROM `".DB_PREFIX."transactions`
        				WHERE `hash` IN ({$used_transactions})
        				");*/
    }
    // ############################################
    main_unlock();
    debug_print('end<<<<<<<<<<<<<<<<<<<<<<<', __FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__);
    unset($testBlock, $data, $for_sign, $mrkl_root_binary, $mrkl_root, $mrkl_array, $data_hex, $row, $transactions);
    //ob_save();
    sleep(1);
    // временно
    //exit;
} while (true);
开发者ID:scuba323,项目名称:dcoin,代码行数:31,代码来源:testblock_generator.php

示例15: debug_print

            debug_print($urls, __FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__);
            $rez = m_curl($urls, $to_be_sent, $db, 'data', 20, true);
            debug_print($rez, __FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__);
        }
    } else {
        // если просто юзер или работаю в защищенном режиме, то шлю тр-ии целиком. слать блоки не имею права.
        if ($my_config['local_gate_ip']) {
            $gate = 'protected_gate_tx.php';
            // Чтобы protected_gate_tx.php мог понять, какому ноду слать эту тр-ию, пишем в первые 100 байт host
            $remote_node_host = $node_data['host'];
        } else {
            $gate = 'gate_tx.php';
            $remote_node_host = '';
        }
        for ($i = 0; $i < sizeof($hosts); $i++) {
            $urls[$i] = array('url' => $hosts[$i]['host'] . $gate, 'node_public_key' => $hosts[$i]['node_public_key'], 'user_id' => $hosts[$i]['user_id']);
        }
        debug_print($urls, __FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__);
        // возьмем хэши и сами тр-ии
        $tx_data = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\t\t\tSELECT `hash`, `data`\n\t\t\t\tFROM `" . DB_PREFIX . "transactions`\n\t\t\t\tWHERE `sent` = 0\n\t\t\t\t", 'fetch_array');
        debug_print('$tx_data: ' . print_r_hex($tx_data), __FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__);
        if ($tx_data['hash']) {
            $hex_hash = bin2hex($tx_data['hash']);
            $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\t\t\t\tUPDATE `" . DB_PREFIX . "transactions`\n\t\t\t\t\tSET `sent` = 1\n\t\t\t\t\tWHERE `hash` = 0x{$hex_hash}\n\t\t\t\t\t");
            // в первые 5 байт tx_data['data'] m_curl допишет user_id получателя, если вдруг там пул
            $rez = m_curl($urls, $tx_data['data'], $db, 'data', 20, true, true, $remote_node_host);
            debug_print($rez, __FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__);
        }
    }
    sleep(1);
}
开发者ID:scuba323,项目名称:dcoin,代码行数:31,代码来源:disseminator.php


注:本文中的debug_print函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。