Advertisement
Guest User

Untitled

a guest
Sep 24th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.20 KB | None | 0 0
  1. HelloNewDay.ph
  2. <?php
  3. include_once("services/StatsUpdater.php");
  4.  
  5.  
  6. //if($_SERVER['REMOTE_ADDR'] == '88.190.221.31') {
  7. $statsUpdater = new StatsUpdater();
  8. $statsUpdater->update();
  9.  
  10. /*} else {
  11. mail('jerome.birembaut@gmail.com', 'Alert', 'Appel non autorisé du script de mise à jour par l\'IP '.$_SERVER['REMOTE_ADDR'].'.');
  12. }*/
  13. ?>
  14.  
  15. StatsUpdater.php
  16. <?php
  17. include_once("Secure.php");
  18. include_once("Utils.php");
  19. include_once("Config.php");
  20. include_once("Query.php");
  21. class StatsUpdater
  22. {
  23. var $oSecure;
  24. var $oUtils;
  25. var $oConfig;
  26. var $oQuery;
  27. function StatsUpdater()
  28. {
  29. $this->oUtils = new Utils();
  30. $this->oConfig = new Config();
  31. $this->oQuery = new Query ();
  32.  
  33.  
  34. }
  35. function update() {
  36. $this->oQuery->open ($this->oConfig->host(),$this->oConfig->user(),$this->oConfig->pass(),$this->oConfig->name());
  37. $s = "SELECT * FROM eyp_game_stats WHERE id=1";
  38. $r = $this->oQuery->request($s);
  39. while ($row = mysql_fetch_assoc($r)){
  40.  
  41. $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"]));
  42. $result = $this->oQuery->request($sql);
  43. }
  44. $s = "UPDATE eyp_game_stats set device_registered=0, game_played=0,game_opened=0 WHERE id=1";
  45. $result = $this->oQuery->request($s);
  46. $this->oQuery->close ();
  47.  
  48. }
  49.  
  50.  
  51. }
  52. ?>
  53.  
  54. Config.php
  55. <?php
  56. class Config
  57. {
  58.  
  59. var $dbhost = 'mysql5-4.pro'; // localhost ou nom du domaine où se trouve la base de donnée
  60. var $dbuser = 'hgfhgf_wp'; // login de la bdd
  61. var $dbpass = 'fghfgh'; // mot de passe de la bdd
  62. var $dbname = 'fghfg_wp'; // nom de la bdd
  63. var $cookie = 'gfhgfh_wp_eyp'; // nom du cookie
  64. var $hashl = 15; // nombre de lettre aleatoire
  65.  
  66. function Config ()
  67. {
  68.  
  69. }
  70.  
  71. function host ()
  72. {
  73. return $this->dbhost;
  74. }
  75.  
  76. function user ()
  77. {
  78. return $this->dbuser;
  79. }
  80.  
  81. function pass ()
  82. {
  83. return $this->dbpass;
  84. }
  85.  
  86. function name ()
  87. {
  88. return $this->dbname;
  89. }
  90.  
  91. function cookieName ()
  92. {
  93. return $this->cookie;
  94. }
  95.  
  96. function hashLength ()
  97. {
  98. return $this->hashl;
  99. }
  100. }
  101. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement