1
0

check_expire.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. /*
  3. *
  4. * OGP - Open Game Panel
  5. * Copyright (C) 2008 - 2018 The OGP Development Team
  6. *
  7. * http://www.opengamepanel.org/
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License
  11. * as published by the Free Software Foundation; either version 2
  12. * of the License, or any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  22. *
  23. */
  24. function exec_ogp_module()
  25. {
  26. global $db;
  27. $expired_servers = $db->resultQuery("SELECT home_name, home_id, server_expiration_date FROM OGP_DB_PREFIXserver_homes WHERE server_expiration_date NOT LIKE 'X' AND server_expiration_date <= ".time().";");
  28. if($expired_servers)
  29. {
  30. foreach($expired_servers as $expired_server)
  31. {
  32. $db->logger(date('d/m/Y H:i:s', $expired_server['server_expiration_date'])." : SERVER EXPIRED: HOME ID:" . $expired_server['home_id'] . " (" . $expired_server['home_name'] . ")");
  33. $db->check_expire_date(0, $expired_server['home_id'], array('server'));
  34. }
  35. }
  36. $expired_users = $db->resultQuery("SELECT user_id, home_id, user_expiration_date FROM OGP_DB_PREFIXuser_homes WHERE user_expiration_date NOT LIKE 'X' AND user_expiration_date <= ".time().";");
  37. if($expired_users)
  38. {
  39. foreach($expired_users as $expired_user)
  40. {
  41. $db->logger(date('d/m/Y H:i:s', $expired_user['user_expiration_date'])." : USER ASSIGNATION EXPIRED : HOME ID:" . $expired_user['home_id'] . " TO USER ID:" . $expired_user['user_id']);
  42. $db->check_expire_date($expired_user['user_id'], $expired_user['home_id'], array('user'));
  43. }
  44. }
  45. $expired_groups = $db->resultQuery("SELECT g.group_id, g.home_id, g.user_group_expiration_date, ug.user_id
  46. FROM OGP_DB_PREFIXuser_group_homes g
  47. INNER JOIN
  48. OGP_DB_PREFIXuser_groups ug
  49. ON ug.group_id=g.group_id
  50. WHERE g.user_group_expiration_date NOT LIKE 'X' AND g.user_group_expiration_date <= ".time()." GROUP BY g.home_id;");
  51. if($expired_groups)
  52. {
  53. foreach($expired_groups as $expired_group)
  54. {
  55. $db->logger(date('d/m/Y H:i:s', $expired_group['user_group_expiration_date'])." : GROUP ASSIGNATION EXPIRED : HOME ID:" . $expired_group['home_id'] . " TO GROUP ID:" . $expired_group['group_id']);
  56. $db->check_expire_date($expired_group['user_id'], $expired_group['home_id'], array('user_group'));
  57. }
  58. }
  59. }
  60. ?>