echo "\n" . '--robot_humblebundle' . "\n\n"; echo "\nDebut du script: " . date("H:i:s", microtime(true)) . "\n"; $nb_result_total = 0; do { $file = 'https://www.humblebundle.com/store/api?request=1&page_size=20&sort=discount&platform=windows&page=' . $p; //echo $file.'<br />'; $homepage = @file_get_contents($file); $homepage = mb_convert_encoding($homepage, 'UTF-8', 'iso-8859-1'); $homepage = utf8_decode($homepage); $homepage = json_decode($homepage); $nb_result = count(@$homepage->results); $nb_result_total += $nb_result; $total_global += $nb_result; for ($i = 0; $i < $nb_result; $i++) { $titre = trim($homepage->results[$i]->human_name); $simple_titre = simple_format($titre); $link = 'https://www.humblebundle.com/store/p/' . trim($homepage->results[$i]->machine_name); $photo = 'https://www.humblebundle.com' . trim($homepage->results[$i]->storefront_featured_image_small); $prix_avant = str_replace(',', '.', $homepage->results[$i]->full_price[0]); $taux_full_price = @$taux[$homepage->results[$i]->full_price[1]]; if (!$taux_full_price) { $taux_full_price = 1; } $prix_avant = number_format($prix_avant / $taux_full_price, 2, '.', ''); //conversion GBP/EUR $prix_apres = str_replace(',', '.', $homepage->results[$i]->current_price[0]); $taux_current_price = @$taux[$homepage->results[$i]->current_price[1]]; if (!$taux_current_price) { $taux_current_price = 1; } $prix_apres = number_format($prix_apres / $taux_current_price, 2, '.', '');
<?php /** * Template Name: Recherche */ get_header(); require 'wp-content/plugins/MyPlugin/class/MyPDO.php'; require_once 'wp-content/plugins/MyPlugin/inc/functions.php'; $p=1; $nb_display = 50; if(isset($_GET["pagin"]) && is_numeric($_GET["pagin"])){ $p=$_GET["pagin"]; } $q = simple_format($_GET["q"]); if(!$q){ $q='jeuxenpromotion'; } $bdd = new MyPDO(); $sql ='SELECT SQL_CALC_FOUND_ROWS * from game where simple_titre like(\'%'.$q.'%\') order by creato desc, percent desc, prix_apres asc LIMIT '.(($p-1)*$nb_display).','.$nb_display; $data = null; $ret = $bdd->query($sql, $data ); $ret_max = $bdd->query('SELECT FOUND_ROWS() as max_result'); $max = (int) $ret_max[0]->max_result; if(count($ret)<$max){ $pagination = true; $max_page = ceil($max/$nb_display);
$email = trim($matches[1]); preg_match('/_field_20:([^▬]+)/', $toMail->data, $matches); $tag = trim($matches[1]); preg_match('/_field_19:([^▬]+)/', $toMail->data, $matches); $euro = trim($matches[1]); preg_match('/_field_21:([^▬]+)/', $toMail->data, $matches); $percent = trim($matches[1]); $id = $toMail->post_id; echo $id . ' ' . $email . ' ' . $tag . ' ' . $euro . '€ ' . $percent . '%' . "\n"; if (!$id) { continue; } $mot_cles = explode(' ', $tag); $nb_result_total = 0; foreach ($mot_cles as $mot_cle) { $mot_cle = simple_format($mot_cle); echo ' - recherche de ' . $mot_cle . "\n"; $ret_res = $bdd->query("SELECT titre, link,img,prix_avant,prix_apres,percent FROM `game` WHERE `simple_titre` LIKE '%" . $mot_cle . "%'\nAND creato = '" . date('Y-m-d') . "' AND (prix_apres<={$euro} OR percent>={$percent})"); $nb_result = count($ret_res); $nb_result_total += $nb_result; if ($nb_result) { $html = '<H1>Jeuxenpromotions.fr</H1>' . '<p>Bonjour ' . ucfirst($nom) . ' !</p>' . '<p>Vous avez demandé à être informé pour des jeux ayant pour mot(s)-clé : ' . $tag . '</p>' . '<p>Etant soit à moins de ' . $euro . '€ ou à plus de ' . $percent . '% de remise.</p>' . '<p>Jeux en promotion à la joie de vous faire par des résultats suivant :</p>'; foreach ($ret_res as $jeu) { $html .= '<p><a href="' . $jeu->link . '"><img src="' . $jeu->img . '" /></a><br /><a href="' . $jeu->link . '">' . $jeu->titre . '</a> à ' . $jeu->prix_apres . '€ (' . $jeu->percent . '%)</p>'; } $html .= '<br /><br /><hr />' . '<p>Attention, pour eviter tout spam, cette recherche par mot-clé vient d\'être désactivée ( vous ne recevrez plus de mail si une nouvelle correspondance ce fait). Si le résultat ne vous convient pas, je vous invite à refaire une alerte mail avec des mot-clés plus spécifiques, sur <a href="http://jeuxenpromotion.fr">jeuxenpromotion.fr</a></p>'; // Pour envoyer un mail HTML, l'en-tête Content-type doit être défini $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // En-têtes additionnels $headers .= 'To: ' . ucfirst($nom) . ' <' . $email . '>' . "\r\n";
?> <?php echo anchor('/fotos/' . $property['route'], pluralize($images_count, 'Bild', 'Bilder'), array('class' => 'btn _margin-bottom next photo-album')); ?> <?php } ?> <h2 class="title"><?php echo improve_type($property['title']); ?> </h2> <div class="abstract"> <?php echo simple_format($property['body']); ?> </div> <table class="default data" summary=""> <tbody> <tr> <th>Ort</th> <td> <?php echo $property['street'] != '' ? $property['street'] . '<br />' : ''; ?> <?php echo $property['zip']; ?> <?php