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


PHP phpAds_dbQuery函数代码示例

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


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

示例1: Plugin_AffiliatehistoryExecute

function Plugin_AffiliatehistoryExecute($affiliateid, $delimiter = ",")
{
    global $phpAds_config, $date_format;
    global $strAffiliate, $strTotal, $strDay, $strViews, $strClicks, $strCTRShort;
    header("Content-type: application/csv\nContent-Disposition: \"inline; filename=affiliatehistory.csv\"");
    $idresult = phpAds_dbQuery("\n\t\tSELECT\n\t\t\tzoneid\n\t\tFROM\n\t\t\t" . $phpAds_config['tbl_zones'] . "\n\t\tWHERE\n\t\t\taffiliateid = '" . $affiliateid . "'\n\t");
    while ($row = phpAds_dbFetchArray($idresult)) {
        $zoneids[] = "zoneid = " . $row['zoneid'];
    }
    $res_query = "\n\t\tSELECT\n\t\t\tDATE_FORMAT(day, '" . $date_format . "') as day,\n\t\t\tSUM(views) AS adviews,\n\t\t\tSUM(clicks) AS adclicks\n\t\tFROM\n\t\t\t" . $phpAds_config['tbl_adstats'] . "\n\t\tWHERE\n\t\t\t(" . implode(' OR ', $zoneids) . ")\n\t\tGROUP BY\n\t\t\tday\n\t";
    $res_banners = phpAds_dbQuery($res_query) or phpAds_sqlDie();
    while ($row_banners = phpAds_dbFetchArray($res_banners)) {
        $stats[$row_banners['day']]['views'] = $row_banners['adviews'];
        $stats[$row_banners['day']]['clicks'] = $row_banners['adclicks'];
    }
    echo $strAffiliate . ": " . strip_tags(phpAds_getAffiliateName($affiliateid)) . "\n\n";
    echo $strDay . $delimiter . $strViews . $delimiter . $strClicks . $delimiter . $strCTRShort . "\n";
    $totalclicks = 0;
    $totalviews = 0;
    if (isset($stats) && is_array($stats)) {
        for (reset($stats); $key = key($stats); next($stats)) {
            $row = array();
            //			$key = implode('/',array_reverse(split('[-]',$key)));
            $row[] = $key;
            $row[] = $stats[$key]['views'];
            $row[] = $stats[$key]['clicks'];
            $row[] = phpAds_buildCTR($stats[$key]['views'], $stats[$key]['clicks']);
            echo implode($delimiter, $row) . "\n";
            $totalclicks += $stats[$key]['clicks'];
            $totalviews += $stats[$key]['views'];
        }
    }
    echo "\n";
    echo $strTotal . $delimiter . $totalviews . $delimiter . $totalclicks . $delimiter . phpAds_buildCTR($totalviews, $totalclicks) . "\n";
}
开发者ID:miller-tamil,项目名称:openads-plus,代码行数:35,代码来源:affiliatehistory.plugin.php

示例2: phpAds_dbConnect

function phpAds_dbConnect()
{
    global $phpAds_config;
    global $phpAds_db_link;
    // Add port to connect, if needed
    if (!isset($phpAds_config['dbport']) || !$phpAds_config['dbport']) {
        $phpAds_config['dbport'] = 3306;
    }
    $host = $phpAds_config['dbhost'];
    if ((!isset($phpAds_config['dblocal']) || !$phpAds_config['dblocal']) && $host[0] != ':') {
        $host .= ':' . $phpAds_config['dbport'];
    }
    if ($phpAds_config['persistent_connections']) {
        $phpAds_db_link = @mysql_pconnect($host, $phpAds_config['dbuser'], $phpAds_config['dbpassword']);
    } else {
        $phpAds_db_link = @mysql_connect($host, $phpAds_config['dbuser'], $phpAds_config['dbpassword']);
    }
    if ($phpAds_config['mysql4_compatibility']) {
        phpAds_dbQuery("SET SESSION sql_mode='MYSQL40'");
    }
    if ($phpAds_config['compatibility_mode']) {
        return $phpAds_db_link;
    }
    if (@mysql_select_db($phpAds_config['dbname'], $phpAds_db_link)) {
        return $phpAds_db_link;
    }
}
开发者ID:henryhe514,项目名称:ChineseCommercial,代码行数:27,代码来源:lib-db.inc.php

示例3: phpAds_checkForUpdates

function phpAds_checkForUpdates($already_seen = 0, $send_sw_data = true)
{
    global $phpAds_config, $phpAds_updatesServer;
    global $xmlrpcerruser;
    // Create client object
    $client = new xmlrpc_client($phpAds_updatesServer['script'], $phpAds_updatesServer['host'], $phpAds_updatesServer['port']);
    $params = array(new xmlrpcval($GLOBALS['phpAds_productname'], "string"), new xmlrpcval($phpAds_config['config_version'], "string"), new xmlrpcval($already_seen, "string"), new xmlrpcval($phpAds_config['updates_dev_builds'] ? 'dev' : '', "string"), new xmlrpcval($phpAds_config['instance_id'], "string"));
    if ($send_sw_data) {
        // Prepare software data
        $params[] = phpAds_xmlrpcEncode(array('os_type' => php_uname('s'), 'os_version' => php_uname('r'), 'webserver_type' => isset($_SERVER['SERVER_SOFTWARE']) ? preg_replace('#^(.*?)/.*$#', '$1', $_SERVER['SERVER_SOFTWARE']) : '', 'webserver_version' => isset($_SERVER['SERVER_SOFTWARE']) ? preg_replace('#^.*?/(.*?)(?: .*)?$#', '$1', $_SERVER['SERVER_SOFTWARE']) : '', 'db_type' => $GLOBALS['phpAds_dbmsname'], 'db_version' => phpAds_dbResult(phpAds_dbQuery("SELECT VERSION()"), 0, 0), 'php_version' => phpversion(), 'php_sapi' => ucfirst(php_sapi_name()), 'php_extensions' => get_loaded_extensions(), 'php_register_globals' => (bool) ini_get('register_globals'), 'php_magic_quotes_gpc' => (bool) ini_get('magic_quotes_gpc'), 'php_safe_mode' => (bool) ini_get('safe_mode'), 'php_open_basedir' => (bool) strlen(ini_get('open_basedir')), 'php_upload_tmp_readable' => (bool) is_readable(ini_get('upload_tmp_dir') . DIRECTORY_SEPARATOR)));
    }
    // Create XML-RPC request message
    $msg = new xmlrpcmsg("Openads.Sync", $params);
    // Send XML-RPC request message
    if ($response = $client->send($msg, 10)) {
        // XML-RPC server found, now checking for errors
        if (!$response->faultCode()) {
            $ret = array(0, phpAds_xmlrpcDecode($response->value()));
            // Prepare cache
            $cache = $ret[1];
        } else {
            $ret = array($response->faultCode(), $response->faultString());
            // Prepare cache
            $cache = false;
        }
        // Save to cache
        phpAds_dbQuery("\n\t\t\tUPDATE\n\t\t\t\t" . $phpAds_config['tbl_config'] . "\n\t\t\tSET\n\t\t\t\tupdates_cache = '" . addslashes(serialize($cache)) . "',\n\t\t\t\tupdates_timestamp = " . time() . "\n\t\t");
        return $ret;
    }
    return array(-1, 'No response from the server');
}
开发者ID:henryhe514,项目名称:ChineseCommercial,代码行数:31,代码来源:lib-openadssync.inc.php

示例4: phpAds_LoadDbConfig

function phpAds_LoadDbConfig($agencyid = 0)
{
    global $phpAds_config, $phpAds_settings_information;
    if ((!empty($GLOBALS['phpAds_db_link']) || phpAds_dbConnect()) && isset($phpAds_config['tbl_config'])) {
        $query = "SELECT *" . " FROM " . $phpAds_config['tbl_config'] . " WHERE agencyid=" . $agencyid;
        if ($res = phpAds_dbQuery($query)) {
            if ($row = phpAds_dbFetchArray($res, 0)) {
                while (list($k, $v) = each($phpAds_settings_information)) {
                    if (!$v['sql'] || !isset($row[$k])) {
                        continue;
                    }
                    switch ($v['type']) {
                        case 'boolean':
                            $row[$k] = $row[$k] == 't';
                            break;
                        case 'integer':
                            $row[$k] = (int) $row[$k];
                            break;
                        case 'array':
                            $row[$k] = unserialize($row[$k]);
                            break;
                        case 'float':
                            $row[$k] = (double) $row[$k];
                            break;
                    }
                    $phpAds_config[$k] = $row[$k];
                }
                reset($phpAds_settings_information);
                return true;
            }
        }
    }
    return false;
}
开发者ID:miller-tamil,项目名称:openads-plus,代码行数:34,代码来源:lib-dbconfig.inc.php

示例5: Plugin_TrackerHistoryExecute

function Plugin_TrackerHistoryExecute($clientid, $start, $end, $delimiter = ",")
{
    global $phpAds_config, $date_format;
    global $strCampaign, $strTotal, $strDay, $strViews, $strClicks, $strCTRShort;
    header("Content-type: application/csv\nContent-Disposition: inline; filename=trackerhistory.csv");
    // get all trackers and group them by advertiser and campaign
    $res_trackers = phpAds_dbQuery("SELECT\n\t\t\t\t\t\t\t\t\t\ttrackers.trackerid,\n\t\t\t\t\t\t\t\t\t\ttrackers.trackername\n\t\t\t\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t\t\t\t" . $phpAds_config['tbl_trackers'] . " as trackers\n\t\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\t\ttrackers.clientid = " . $clientid . "\n\t\t\t\t\t\t\t\t\t");
    $trackers = array();
    while ($row = phpAds_dbFetchArray($res_trackers)) {
        $trackers[$row['trackerid']] = array();
        $trackers[$row['trackerid']]['name'] = $row['trackername'];
    }
    $res_total_conversions = phpAds_dbQuery("SELECT\n\t\t\t\t\t\t\t\t\t\t\ttrackers.trackerid,\n\t\t\t\t\t\t\t\t\t\t\tcount(conversions.conversionid) as hits\n\t\t\t\t\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t\t\t\t\t" . $phpAds_config['tbl_adconversions'] . " as conversions,\n\t\t\t\t\t\t\t\t\t\t\t" . $phpAds_config['tbl_trackers'] . " as trackers\n\t\t\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\t\t\ttrackers.trackerid = conversions.trackerid\n\t\t\t\t\t\t\t\t\t\t\tAND trackers.clientid = " . $clientid . "\n\t\t\t\t\t\t\t\t\t\t\tAND conversions.t_stamp >= '" . str_replace("/", "", $start) . "000000'\n\t\t\t\t\t\t\t\t\t\t\tAND conversions.t_stamp <= '" . str_replace("/", "", $end) . "235959'\n\t\t\t\t\t\t\t\t\t\tGROUP BY\n\t\t\t\t\t\t\t\t\t\t\tconversions.trackerid\n\t\t\t\t\t\t\t\t");
    while ($row = phpAds_dbFetchArray($res_total_conversions)) {
        $trackers[$row['trackerid']]['total_conversions'] = $row['hits'];
    }
    $res_conversions = phpAds_dbQuery("SELECT\n\t\t\t\t\t\t\t\t\t\t\ttrackers.trackerid,\n\t\t\t\t\t\t\t\t\t\t\tcount(*) as hits\n\t\t\t\t\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t\t\t\t\t" . $phpAds_config['tbl_conversionlog'] . " as conversions,\n\t\t\t\t\t\t\t\t\t\t\t" . $phpAds_config['tbl_trackers'] . " as trackers\n\t\t\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\t\t\ttrackers.trackerid = conversions.trackerid\n\t\t\t\t\t\t\t\t\t\t\tAND trackers.clientid = " . $clientid . "\n\t\t\t\t\t\t\t\t\t\t\tAND conversions.t_stamp >= '" . str_replace("/", "", $start) . "000000'\n\t\t\t\t\t\t\t\t\t\t\tAND conversions.t_stamp <= '" . str_replace("/", "", $end) . "235959'\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\tGROUP BY\n\t\t\t\t\t\t\t\t\t\t\tconversions.trackerid\n\t\t\t\t\t\t\t\t");
    while ($row = phpAds_dbFetchArray($res_conversions)) {
        $trackers[$row['trackerid']]['conversions'] = $row['hits'];
    }
    //echo "<pre>";
    //print_r($trackers);
    //echo "</pre>";
    echo "Client: " . strip_tags(phpAds_getClientName($clientid)) . " - " . $start . " - " . $end . "\n\n";
    echo $GLOBALS['strName'] . $delimiter . $GLOBALS['strID'] . $delimiter . "Conversions" . $delimiter . "Total Hits" . "\n";
    echo "\n";
    foreach ($trackers as $id => $tracker) {
        echo $tracker['name'] . $delimiter . $id . $delimiter . $tracker['conversions'] . $delimiter . $tracker['total_conversions'] . $delimiter . "\n";
    }
}
开发者ID:miller-tamil,项目名称:openads-plus,代码行数:30,代码来源:trackerhistory.plugin.php

示例6: Plugin_GlobalhistoryExecute

function Plugin_GlobalhistoryExecute($delimiter = ",")
{
    global $phpAds_config, $date_format;
    global $strGlobalHistory, $strTotal, $strDay, $strViews, $strClicks, $strCTRShort;
    header("Content-type: application/csv\nContent-Disposition: \"inline; filename=globalhistory.csv\"");
    if (phpAds_isUser(phpAds_Admin)) {
        $res_query = "\n\t\tSELECT\n\t\t\tDATE_FORMAT(day, '" . $date_format . "') as day,\n\t\t\tSUM(views) AS adviews,\n\t\t\tSUM(clicks) AS adclicks\n\t\tFROM\n\t\t\t" . $phpAds_config['tbl_adstats'] . "\n\t\tGROUP BY\n\t\t\tday\n\t";
    } else {
        $res_query = "SELECT\n\t\t\t\t\t\tDATE_FORMAT(s.day, '" . $date_format . "') as day,\n\t\t\t\t\t\tSUM(s.views) AS adviews,\n\t\t\t\t\t\tSUM(s.clicks) AS adclicks\n\t\t\t\t\tFROM\n\t\t\t\t\t\t" . $phpAds_config['tbl_adstats'] . " \tas s,\n\t\t\t\t\t\t" . $phpAds_config['tbl_banners'] . " \tas b,\n\t\t\t\t\t\t" . $phpAds_config['tbl_campaigns'] . " as m,\n\t\t\t\t\t\t" . $phpAds_config['tbl_clients'] . " \tas c\n\t\t\t\t\tWHERE\n\t\t\t\t\t\ts.bannerid \t\t= b.bannerid AND\n\t\t\t\t\t\tb.campaignid \t= m.campaignid AND\n\t\t\t\t\t\tm.clientid \t\t= c.clientid AND\n\t\t\t\t\t\tc.agencyid \t\t= " . phpAds_getUserID() . "\n\t\t\t\t\tGROUP BY\n\t\t\t\t\t\tday";
    }
    $res_banners = phpAds_dbQuery($res_query) or phpAds_sqlDie();
    while ($row_banners = phpAds_dbFetchArray($res_banners)) {
        $stats[$row_banners['day']]['views'] = $row_banners['adviews'];
        $stats[$row_banners['day']]['clicks'] = $row_banners['adclicks'];
    }
    echo $strGlobalHistory . "\n\n";
    echo $strDay . $delimiter . $strViews . $delimiter . $strClicks . $delimiter . $strCTRShort . "\n";
    $totalclicks = 0;
    $totalviews = 0;
    if (isset($stats) && is_array($stats)) {
        for (reset($stats); $key = key($stats); next($stats)) {
            $row = array();
            //$key = implode('/',array_reverse(split('[-]',$key)));
            $row[] = $key;
            $row[] = $stats[$key]['views'];
            $row[] = $stats[$key]['clicks'];
            $row[] = phpAds_buildCTR($stats[$key]['views'], $stats[$key]['clicks']);
            echo implode($delimiter, $row) . "\n";
            $totalclicks += $stats[$key]['clicks'];
            $totalviews += $stats[$key]['views'];
        }
    }
    echo "\n";
    echo $strTotal . $delimiter . $totalviews . $delimiter . $totalclicks . $delimiter . phpAds_buildCTR($totalviews, $totalclicks) . "\n";
}
开发者ID:miller-tamil,项目名称:openads-plus,代码行数:35,代码来源:globalhistory.plugin.php

示例7: phpAds_maintenanceReleaseLock

function phpAds_maintenanceReleaseLock($lock)
{
    switch ($lock['type']) {
        case 'db':
            phpAds_dbQuery("DO RELEASE('{$lock['id']}')");
            break;
    }
}
开发者ID:henryhe514,项目名称:ChineseCommercial,代码行数:8,代码来源:lib-locks.inc.php

示例8: phpAds_showBanners

function phpAds_showBanners()
{
    global $phpAds_config;
    global $strUntitled, $strName, $strID, $strWeight;
    global $strProbability, $strPriority, $strRecalculatePriority;
    global $phpAds_TextDirection;
    $res = phpAds_dbQuery("\n\t\tSELECT\n\t\t\t*\n\t\tFROM\n\t\t\t" . $phpAds_config['tbl_banners'] . "\n\t\tORDER BY\n\t\t\tpriority DESC\n\t");
    $rows = array();
    $prioritysum = 0;
    while ($tmprow = phpAds_dbFetchArray($res)) {
        if ($tmprow['priority']) {
            $prioritysum += $tmprow['priority'];
            $rows[$tmprow['bannerid']] = $tmprow;
        }
    }
    if (is_array($rows)) {
        $i = 0;
        // Header
        echo "<table width='100%' border='0' align='center' cellspacing='0' cellpadding='0'>";
        echo "<tr height='25'>";
        echo "<td height='25'><b>&nbsp;&nbsp;" . $strName . "</b></td>";
        echo "<td height='25'><b>" . $strID . "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></td>";
        echo "<td height='25'><b>" . $strPriority . "</b></td>";
        echo "<td height='25'><b>" . $strProbability . "</b></td>";
        echo "</tr>";
        echo "<tr height='1'><td colspan='5' bgcolor='#888888'><img src='images/break.gif' height='1' width='100%'></td></tr>";
        // Banners
        foreach (array_keys($rows) as $key) {
            $name = phpAds_getBannerName($rows[$key]['bannerid'], 60, false);
            if ($i > 0) {
                echo "<tr height='1'><td colspan='5' bgcolor='#888888'><img src='images/break-l.gif' height='1' width='100%'></td></tr>";
            }
            echo "<tr height='25' " . ($i % 2 == 0 ? "bgcolor='#F6F6F6'" : "") . ">";
            echo "<td height='25'>";
            echo "&nbsp;&nbsp;";
            // Banner icon
            if ($rows[$key]['storagetype'] == 'html') {
                echo "<img src='images/icon-banner-html.gif' align='absmiddle'>&nbsp;";
            } elseif ($rows[$key]['storagetype'] == 'url') {
                echo "<img src='images/icon-banner-url.gif' align='absmiddle'>&nbsp;";
            } else {
                echo "<img src='images/icon-banner-stored.gif' align='absmiddle'>&nbsp;";
            }
            // Name
            echo $name;
            echo "</td>";
            echo "<td height='25'>" . $rows[$key]['bannerid'] . "</td>";
            echo "<td height='25'>" . $rows[$key]['priority'] . "</td>";
            echo "<td height='25'>" . number_format($rows[$key]['priority'] / $prioritysum * 100, $phpAds_config['percentage_decimals']) . "%</td>";
            echo "</tr>";
            $i++;
        }
        // Footer
        echo "<tr height='1'><td colspan='5' bgcolor='#888888'><img src='images/break.gif' height='1' width='100%'></td></tr>";
        echo "</table>";
    }
}
开发者ID:henryhe514,项目名称:ChineseCommercial,代码行数:57,代码来源:maintenance-priority.php

示例9: phpAds_MaintenanceSelection

function phpAds_MaintenanceSelection($section)
{
    global $phpAds_config;
    global $phpAds_TextDirection;
    global $strChooseSection, $strPriority, $strCache, $strBanners, $strStats, $strStorage, $strMaintenance;
    if ($phpAds_config['compact_stats']) {
        // Determine left over verbose stats
        $viewresult = phpAds_dbQuery("SELECT COUNT(*) AS cnt FROM " . $phpAds_config['tbl_adviews']);
        $viewrow = phpAds_dbFetchArray($viewresult);
        if (isset($viewrow["cnt"]) && $viewrow["cnt"] != '') {
            $verboseviews = $viewrow["cnt"];
        } else {
            $verboseviews = 0;
        }
        $clickresult = phpAds_dbQuery("SELECT COUNT(*) AS cnt FROM " . $phpAds_config['tbl_adclicks']);
        $clickrow = phpAds_dbFetchArray($viewresult);
        if (isset($clickrow["cnt"]) && $clickrow["cnt"] != '') {
            $verboseclicks = $clickrow["cnt"];
        } else {
            $verboseclicks = 0;
        }
    }
    ?>
<script language="JavaScript">
<!--
function maintenance_goto_section()
{
	s = document.maintenance_selection.section.selectedIndex;

	s = document.maintenance_selection.section.options[s].value;
	document.location = 'maintenance-' + s + '.php';
}
// -->
</script>
<?php 
    echo "<table border='0' width='100%' cellpadding='0' cellspacing='0'>";
    echo "<tr><form name='maintenance_selection'><td height='35'>";
    echo "<b>" . $strChooseSection . ":&nbsp;</b>";
    echo "<select name='section' onChange='maintenance_goto_section();'>";
    echo "<option value='maintenance'" . ($section == 'maintenance' ? ' selected' : '') . ">" . $strMaintenance . "</option>";
    echo "<option value='banners'" . ($section == 'banners' ? ' selected' : '') . ">" . $strBanners . "</option>";
    echo "<option value='priority'" . ($section == 'priority' ? ' selected' : '') . ">" . $strPriority . "</option>";
    if ($phpAds_config['compact_stats'] && ($verboseviews > 0 || $verboseclicks > 0)) {
        echo "<option value='stats'" . ($section == 'stats' ? ' selected' : '') . ">" . $strStats . "</option>";
    }
    if ($phpAds_config['type_web_allow'] == true && ($phpAds_config['type_web_mode'] == 0 && $phpAds_config['type_web_dir'] != '' || $phpAds_config['type_web_mode'] == 1 && $phpAds_config['type_web_ftp'] != '') && $phpAds_config['type_web_url'] != '') {
        echo "<option value='storage'" . ($section == 'storage' ? ' selected' : '') . ">" . $strStorage . "</option>";
    }
    if ($phpAds_config['delivery_caching'] != 'none') {
        echo "<option value='cache'" . ($section == 'zones' ? ' selected' : '') . ">" . $strCache . "</option>";
    }
    echo "</select>&nbsp;<a href='javascript:void(0)' onClick='maintenance_goto_section();'>";
    echo "<img src='images/" . $phpAds_TextDirection . "/go_blue.gif' border='0'></a>";
    echo "</td></form></tr>";
    echo "</table>";
    phpAds_ShowBreak();
}
开发者ID:henryhe514,项目名称:ChineseCommercial,代码行数:57,代码来源:lib-maintenance.inc.php

示例10: phpAds_getCampaign

function phpAds_getCampaign($query)
{
    $campaigns = array();
    $res = phpAds_dbQuery($query) or phpAds_sqlDie();
    while ($row = phpAds_dbFetchArray($res)) {
        $campaigns[$row['campaignid']] = $row;
    }
    return $campaigns;
}
开发者ID:miller-tamil,项目名称:openads-plus,代码行数:9,代码来源:lib-data-campaigns.inc.php

示例11: Plugin_GlobalhistoryExecute

function Plugin_GlobalhistoryExecute($delimiter = 't', $quotes = '')
{
    global $phpAds_config, $date_format;
    global $strGlobalHistory, $strTotal, $strDay, $strViews, $strClicks, $strCTRShort;
    // Expand delimiter and quotes
    if ($delimiter == 't') {
        $delimiter = "\t";
    }
    if ($quotes == '1') {
        $quotes = "'";
    }
    if ($quotes == '2') {
        $quotes = '"';
    }
    header("Content-type: application/csv");
    header("Content-Disposition: inline; filename=\"publisherhistory.csv\"");
    if ($phpAds_config['compact_stats']) {
        $res_query = "\n\t\t\tSELECT\n\t\t\t\tDATE_FORMAT(day, '%Y%m%d') as date,\n\t\t\t\tDATE_FORMAT(day, '{$date_format}') as date_formatted,\n\t\t\t\tSUM(views) AS adviews,\n\t\t\t\tSUM(clicks) AS adclicks\n\t\t\tFROM\n\t\t\t\t" . $phpAds_config['tbl_adstats'] . "\n\t\t\tGROUP BY\n\t\t\t\tday\n\t\t\tORDER BY\n\t\t\t\tdate\n\t\t";
        $res_banners = phpAds_dbQuery($res_query) or phpAds_sqlDie();
        while ($row_banners = phpAds_dbFetchArray($res_banners)) {
            $stats[$row_banners['date_formatted']]['views'] = $row_banners['adviews'];
            $stats[$row_banners['date_formatted']]['clicks'] = $row_banners['adclicks'];
        }
    } else {
        $res_query = "\n\t\t\tSELECT\n\t\t\t\tDATE_FORMAT(t_stamp, '%Y%m%d') as date,\n\t\t\t\tDATE_FORMAT(t_stamp, '" . $date_format . "') as date_formatted,\n\t\t\t\tcount(bannerid) as adviews\n\t\t\tFROM\n\t\t\t\t" . $phpAds_config['tbl_adviews'] . "\n\t\t\tGROUP BY\n\t\t\t\tdate, date_formatted\n\t\t\tORDER BY\n\t\t\t\tdate\n\t\t";
        $res_banners = phpAds_dbQuery($res_query) or phpAds_sqlDie();
        while ($row_banners = phpAds_dbFetchArray($res_banners)) {
            $stats[$row_banners['date_formatted']]['views'] = $row_banners['adviews'];
            $stats[$row_banners['date_formatted']]['clicks'] = 0;
        }
        $res_query = "\n\t\t\tSELECT\n\t\t\t\tDATE_FORMAT(t_stamp, '%Y%m%d') as date,\n\t\t\t\tDATE_FORMAT(t_stamp, '" . $date_format . "') as date_formatted,\n\t\t\t\tcount(bannerid) as adclicks\n\t\t\tFROM\n\t\t\t\t" . $phpAds_config['tbl_adclicks'] . "\n\t\t\tGROUP BY\n\t\t\t\tdate, date_formatted\n\t\t\tORDER BY\n\t\t\t\tdate\n\t\t";
        $res_banners = phpAds_dbQuery($res_query) or phpAds_sqlDie();
        while ($row_banners = phpAds_dbFetchArray($res_banners)) {
            $stats[$row_banners['date_formatted']]['clicks'] = $row_banners['adclicks'];
        }
    }
    echo $quotes . $strGlobalHistory . $quotes . "\n\n";
    echo $quotes . $strDay . $quotes . $delimiter . $quotes . $strViews . $quotes . $delimiter;
    echo $quotes . $strClicks . $quotes . $delimiter . $quotes . $strCTRShort . $quotes . "\n";
    $totalclicks = 0;
    $totalviews = 0;
    if (isset($stats) && is_array($stats)) {
        foreach (array_keys($stats) as $key) {
            $row = array();
            $row[] = $quotes . $key . $quotes;
            $row[] = $quotes . $stats[$key]['views'] . $quotes;
            $row[] = $quotes . $stats[$key]['clicks'] . $quotes;
            $row[] = $quotes . phpAds_buildCTR($stats[$key]['views'], $stats[$key]['clicks']) . $quotes;
            echo implode($delimiter, $row) . "\n";
            $totalclicks += $stats[$key]['clicks'];
            $totalviews += $stats[$key]['views'];
        }
    }
    echo "\n";
    echo $quotes . $strTotal . $quotes . $delimiter . $quotes . $totalviews . $quotes . $delimiter;
    echo $quotes . $totalclicks . $quotes . $delimiter . $quotes . phpAds_buildCTR($totalviews, $totalclicks) . $quotes . "\n";
}
开发者ID:henryhe514,项目名称:ChineseCommercial,代码行数:57,代码来源:globalhistory.plugin.php

示例12: phpAds_cacheInfo

function phpAds_cacheInfo()
{
    global $phpAds_config;
    $result = array();
    $cacheres = phpAds_dbQuery("SELECT * FROM " . $phpAds_config['tbl_cache']);
    while ($cacherow = phpAds_dbFetchArray($cacheres)) {
        $result[$cacherow['cacheid']] = strlen($cacherow['content']);
    }
    return $result;
}
开发者ID:miller-tamil,项目名称:openads-plus,代码行数:10,代码来源:cache-db.inc.php

示例13: phpAds_cacheInfo

function phpAds_cacheInfo()
{
    global $phpAds_config;
    $result = array();
    $cacheres = phpAds_dbQuery("SELECT cacheid, LENGTH(content) AS len FROM " . $phpAds_config['tbl_cache']);
    while ($cacherow = phpAds_dbFetchArray($cacheres)) {
        $result[$cacherow['cacheid']] = $cacherow['len'];
    }
    return $result;
}
开发者ID:henryhe514,项目名称:ChineseCommercial,代码行数:10,代码来源:cache-db.inc.php

示例14: phpAds_DeleteTracker

function phpAds_DeleteTracker($trackerid)
{
    global $phpAds_config;
    // Delete Campaign
    $res = phpAds_dbQuery("DELETE FROM " . $phpAds_config['tbl_trackers'] . " WHERE trackerid=" . $trackerid) or phpAds_sqlDie();
    // Delete Campaign/Tracker links
    $res = phpAds_dbQuery("DELETE FROM " . $phpAds_config['tbl_campaigns_trackers'] . " WHERE trackerid=" . $trackerid) or phpAds_sqlDie();
    // Delete Conversions Logged to this Tracker
    $res = phpAds_dbQuery("DELETE FROM " . $phpAds_config['tbl_conversionlog'] . " WHERE trackerid=" . $trackerid) or phpAds_sqlDie();
    // Delete stats for each banner
    phpAds_deleteStatsByTrackerID($trackerid);
}
开发者ID:miller-tamil,项目名称:openads-plus,代码行数:12,代码来源:tracker-delete.php

示例15: phpAds_logConversion

function phpAds_logConversion($userid, $trackerid)
{
    global $HTTP_SERVER_VARS, $phpAds_config, $phpAds_geo;
    // Check if host is on list of hosts to ignore
    if ($host = phpads_logCheckHost()) {
        $log_country = $phpAds_config['geotracking_stats'] && $phpAds_geo && $phpAds_geo['country'] ? $phpAds_geo['country'] : '';
        $log_host = $phpAds_config['log_hostname'] ? $HTTP_SERVER_VARS['REMOTE_HOST'] : '';
        $log_host = $phpAds_config['log_iponly'] ? $HTTP_SERVER_VARS['REMOTE_ADDR'] : $log_host;
        phpAds_dbQuery("INSERT " . ($phpAds_config['insert_delayed'] ? 'DELAYED' : '') . " INTO " . $phpAds_config['tbl_adconversions'] . "(userid" . ",trackerid" . ",host" . ",country)" . " VALUES " . "('" . $userid . "'" . "," . $trackerid . ",'" . $log_host . "'" . ",'" . $log_country . "')");
        return phpAds_dbInsertID();
    }
}
开发者ID:miller-tamil,项目名称:openads-plus,代码行数:12,代码来源:lib-log.inc.php


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