PageRenderTime 40ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

/cron/cron.php

https://github.com/modulargaming/kittokittokitto
PHP | 66 lines | 22 code | 8 blank | 36 comment | 0 complexity | ee58fd40eef9aae52b48f39ba498343a MD5 | raw file
  1. <?php
  2. /**
  3. * Cron Script to update Users Buildings
  4. *
  5. * @author Copy112 copy112@gail.com
  6. * @link http://copy112.se
  7. * @copyright Copy112
  8. * @version 0.0.0.1
  9. *
  10. **/
  11. include "includes/config.inc.php";
  12. $time = date("Y-m-d H:i:s");
  13. //This add 1 to you lumberjack lvl, but only if you are building lumberjack and if your building time has ended. :)
  14. mysql_query("UPDATE city SET lumberjack = lumberjack+(1)
  15. WHERE b_building = 'lumberjack' AND b_time < '$time'");
  16. //This add 1 to you claymine lvl, but only if you are building claymine and if your building time has ended. :)
  17. mysql_query("UPDATE city SET clay_mine = clay_mine+(1)
  18. WHERE b_building = 'claymine' AND b_time < '$time'");
  19. //This add 1 to you stone_break lvl, but only if you are building stone_break and if your building time has ended. :)
  20. mysql_query("UPDATE city SET stone_break = stone_break+(1)
  21. WHERE b_building = 'stonebreak' AND b_time < '$time'");
  22. //This add 1 to you iron_mine lvl, but only if you are building iron_mine and if your building time has ended. :)
  23. mysql_query("UPDATE city SET iron_mine = iron_mine+(1)
  24. WHERE b_building = 'ironmine' AND b_time < '$time'");
  25. //This add 1 to you gold_mine lvl, but only if you are building gold_mine and if your building time has ended. :)
  26. mysql_query("UPDATE city SET gold_mine = gold_mine+(1)
  27. WHERE b_building = 'goldmine' AND b_time < '$time'");
  28. //this resets the building time, building lvl and building-building so we donīt update the users building again :P
  29. mysql_query("UPDATE city SET b_time = ''
  30. WHERE b_time < '$time'");
  31. mysql_query("UPDATE city SET b_lvl = ''
  32. WHERE b_time < '$time'");
  33. mysql_query("UPDATE city SET b_building = ''
  34. WHERE b_time < '$time'");
  35. mysql_query($query);
  36. echo $time;
  37. /*
  38. $city = new City($db);
  39. $city = $city->findBy(array(
  40. array(
  41. 'table' => 'city',
  42. 'column' => 'b_lvl',
  43. 'search_type' => '=',
  44. 'value' => '2',
  45. ),
  46. ));
  47. $CITY = array(
  48. 'bbuilding' => $city->getB_building(),
  49. 'btime' => $city->getB_Time(),
  50. 'blvl' => $city->getB_Lvl(),
  51. 'lumberjack' => $city->getLumberjack(),
  52. 'clay_mine' => $city->getClayMine(),
  53. );
  54. echo $CITY['blvl'];
  55. */
  56. ?>