Example #1
0
function download_all($tab, $dirname)
{
    if (file_exists($dirname) === FALSE) {
        @mkdir($dirname);
    }
    foreach ($tab as $s) {
        $dst = $dirname . '/' . end(explode('/', $s));
        down_img($s, $dst);
    }
}
Example #2
0
$ownerElem = $XPath->query('/html/body/div[17]/font[2]/font[2]');
$wotdName = $nameElem->item(0)->nodeValue;
$wotdOwner = $ownerElem->item(0)->nodeValue;
if ($wotdRecords[$wrCount - 1]['wotdName'] == $wotdName) {
    $wotdCount = $wotdRecords[$wrCount - 1]['wotdCount'];
} else {
    $wotdCount = $wotdRecords[$wrCount - 1]['wotdCount'] + 1;
}
if ($wotdRecords[$wrCount - 1]['wotdDay'] === date('d')) {
    echo "Already Added";
    exit;
}
if ($useJSON) {
    $wotdCurrent = array('id' => $wrCount + 1, 'wotdCount' => $wotdCount, 'wotdName' => $wotdName, 'wotdOwner' => $wotdOwner, 'wotdDate' => date('m/d/y'), 'wotdDay' => date('d'), 'wotdMonth' => date('m'), 'wotdYear' => date('y'));
} else {
    if (!$useJSON) {
        $wotdCurrent = array('id' => $wrCount + 1, 'wotdCount' => $wotdCount, 'wotdName' => $wotdName, 'wotdOwner' => $wotdOwner, 'wotdDate' => date('Y/m/d'), 'wotdDay' => date('d'), 'wotdMonth' => date('m'), 'wotdYear' => date('y'));
    }
}
echo $wotdCurrent['wotdName'] . " | " . $wotdCurrent['wotdOwner'] . " | " . $wotdCurrent['wotdMonth'] . "/" . $wotdCurrent['wotdDay'] . "/" . $wotdCurrent['wotdYear'] . " | ";
if ($useJSON === true) {
    $wotdRecords[] = $wotdCurrent;
    echo file_put_contents('inc/wotd.json', json_encode($wotdRecords, JSON_PRETTY_PRINT)) . " | ";
} else {
    if ($useJSON === false) {
        echo DB::insert('wotd', $wotdCurrent);
    }
}
$lowerCaseName = strtolower($wotdCurrent['wotdName']);
echo down_img('https://growtopiagame.com/worlds/' . $lowerCaseName . '.png', $image_path . $lowerCaseName . '.png');
Example #3
0
<?php

require_once 'inc/functions.inc.php';
if (file_exists('inc/wotd.json')) {
    $wotdRecords = json_decode(file_get_contents('inc/wotd.json'), true);
} else {
    $wotdRecords = array();
}
$wrCount = (int) count($wotdRecords);
for ($i = 0; $i < $wrCount; $i++) {
    $exist = file_exists('/usr/local/nginx/www/1conan.com/wr/worlds/' . strtolower($wotdRecords[$i]['wotdName']) . '.png');
    if ($exist === false) {
        echo '/usr/local/nginx/www/1conan.com/wr/worlds/' . $wotdRecords[$i]['wotdName'] . '.png';
        echo $exist . ' ' . $wotdRecords[$i]['wotdName'] . ' | ';
        echo down_img('http://growtopiagame.com/worlds/' . strtolower($wotdRecords[$i]['wotdName']) . '.png', 'worlds/' . strtolower($wotdRecords[$i]['wotdName']) . '.png');
    }
}