Example #1
0
ini_set('error_log', dirname(__FILE__) . "/../error.log");
date_default_timezone_set('America/Los_Angeles');
include dirname(__DIR__) . "/config.php";
fclose(STDIN);
fclose(STDOUT);
fclose(STDERR);
$STDIN = fopen('/dev/null', 'r');
$STDOUT = fopen(dirname(__FILE__) . "/application.log", 'a+');
$STDERR = fopen(dirname(__FILE__) . "/../error.log", 'a+');
$dbName = "marketing";
$gaprofile = new gaprofiles();
$profile = $gaprofile::makezine;
$yesterday = date("Y-m-d", strtotime("yesterday"));
$current_time = date("Y-m-d H:i:s", time());
printf("\ncurrent time: %s. script for: %s\n", $current_time, $yesterday);
$dbconnection = new mysqlconnect();
$dbconnection->connect($dbName);
$mysqli = $dbconnection->connection;
$insertquery = "insert into mz_sessioncount(record_date, metric) values (?, ?) on duplicate key update \n    record_date=values(record_date), metric=values(metric)";
if ($stmt = $mysqli->prepare($insertquery)) {
    $stmt->bind_param("si", $datetime, $metric);
    $mysqli->query("start");
} else {
    printf("error: %s\n", $mysqli->error);
}
$analytics = getService();
//$profile = getFirstProfileId($analytics);
$profile = '8515';
$sessioncount = getResults($analytics, $profile);
if (count($sessioncount->getRows()) > 0) {
    $rowCount = count($sessioncount->getRows());
Example #2
0
 private function dbconnect()
 {
     $conn = new mysqlconnect();
     $conn->connect();
 }
Example #3
0
<?php

include "../inc/class/connClass.php";
$conn = new mysqlconnect();
$conn->connect();
$Query = "SELECT destinations, rate FROM temprate WHERE unbeatableRate =1 ORDER BY destinations LIMIT 0 , 4 ";
$unbeatableRate = mysql_query($Query) or die(mysql_error());
?>

 <table width="218" border="0" cellspacing="0" cellpadding="0">
            <?php 
while ($row = mysql_fetch_array($unbeatableRate)) {
    ?>
			<tr>
            <td class="destination"><?php 
    list($destinationName, $operator) = split(" ", $row["destinations"]);
    printf("%s", $destinationName);
    ?>
 
            </td>
            <td class="rates"><?php 
    printf("%-06s", $row["rate"]);
    ?>
</td>
            </tr>
			<?php 
}
?>
</table>

Example #4
0
<?php

error_reporting(E_ALL);
ini_set('display_errors', 1);
date_default_timezone_set('America/Los_Angeles');
include dirname(__FILE__) . "/config.php";
$dbName = 'marketing';
$dbconnection = new mysqlconnect();
$dbconnection->connect($dbName);
$mysqli = $dbconnection->connection;
$jsondata = file_get_contents('data.json');
$datarows = json_decode($jsondata, true);
//print_r($datarows["rows"]);
$query = "insert into adsensedata(statdate, pageviews, impressions, clicks, revenue) value (?,?,?,?,?)";
$stmt = $mysqli->prepare($query);
$stmt->bind_param("siiid", $statdate, $pageviews, $impressions, $clicks, $revenue);
$mysqli->query("start query");
for ($i = 0; $i < 243; $i++) {
    $datarow = $datarows["rows"][$i];
    $statdate = date('Y-m-d', strtotime($datarow[0]));
    $pageviews = (int) $datarow[1];
    $impressions = (int) $datarow[2];
    $clicks = (int) $datarow[3];
    $revenue = number_format($datarow[4], 2);
    $stmt->execute();
    printf("date: %s; revenue: %d.\n", $statdate, $revenue);
}
$stmt->close();
$mysqli->query("done");
$mysqli->close();
Example #5
0
 public function __construct()
 {
     $conn = new mysqlconnect();
     $conn->connect();
 }