Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- HelloNewDay.ph
- <?php
- include_once("services/StatsUpdater.php");
- //if($_SERVER['REMOTE_ADDR'] == '88.190.221.31') {
- $statsUpdater = new StatsUpdater();
- $statsUpdater->update();
- /*} else {
- mail('jerome.birembaut@gmail.com', 'Alert', 'Appel non autorisé du script de mise à jour par l\'IP '.$_SERVER['REMOTE_ADDR'].'.');
- }*/
- ?>
- StatsUpdater.php
- <?php
- include_once("Secure.php");
- include_once("Utils.php");
- include_once("Config.php");
- include_once("Query.php");
- class StatsUpdater
- {
- var $oSecure;
- var $oUtils;
- var $oConfig;
- var $oQuery;
- function StatsUpdater()
- {
- $this->oUtils = new Utils();
- $this->oConfig = new Config();
- $this->oQuery = new Query ();
- }
- function update() {
- $this->oQuery->open ($this->oConfig->host(),$this->oConfig->user(),$this->oConfig->pass(),$this->oConfig->name());
- $s = "SELECT * FROM eyp_game_stats WHERE id=1";
- $r = $this->oQuery->request($s);
- while ($row = mysql_fetch_assoc($r)){
- $sql = sprintf("INSERT INTO eyp_users (`device_registered`,`game_played`,`game_opened`) VALUES ( %d,%d,%d);",$this->oQuery->quote($row["device_registered"]),$this->oQuery->quote($row["game_played"]),$this->oQuery->quote($row["game_opened"]));
- $result = $this->oQuery->request($sql);
- }
- $s = "UPDATE eyp_game_stats set device_registered=0, game_played=0,game_opened=0 WHERE id=1";
- $result = $this->oQuery->request($s);
- $this->oQuery->close ();
- }
- }
- ?>
- Config.php
- <?php
- class Config
- {
- var $dbhost = 'mysql5-4.pro'; // localhost ou nom du domaine où se trouve la base de donnée
- var $dbuser = 'hgfhgf_wp'; // login de la bdd
- var $dbpass = 'fghfgh'; // mot de passe de la bdd
- var $dbname = 'fghfg_wp'; // nom de la bdd
- var $cookie = 'gfhgfh_wp_eyp'; // nom du cookie
- var $hashl = 15; // nombre de lettre aleatoire
- function Config ()
- {
- }
- function host ()
- {
- return $this->dbhost;
- }
- function user ()
- {
- return $this->dbuser;
- }
- function pass ()
- {
- return $this->dbpass;
- }
- function name ()
- {
- return $this->dbname;
- }
- function cookieName ()
- {
- return $this->cookie;
- }
- function hashLength ()
- {
- return $this->hashl;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement