Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2014
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. function mv_vote_times() {
  2. global $mvdb;
  3. // WHERE (`user` = '%1:s' OR `ip` = '%2:s')
  4. $data = $mvdb->escapedAllResultsAssoc("SELECT `".DBPRE."votes`.`id`,
  5. `".DBPRE."votes`.`site`,
  6. `".DBPRE."sites`.`waittime`,
  7. `".DBPRE."votes`.`callbackdate`,
  8. `".DBPRE."votes`.`fulfilled`,
  9. (`callbackdate` > UTC_TIMESTAMP() - INTERVAL `waittime` HOUR) `outoftime`
  10. FROM `".DBPRE."votes`
  11. INNER JOIN
  12. (SELECT max(`id`) AS `id`, `site` FROM `".DBPRE."votes`
  13. WHERE (`user` = '%1:s' OR `ip` = '%2:s')
  14. GROUP BY `site` ORDER BY `callbackdate` DESC) `dest`
  15. ON `dest`.`id` = `".DBPRE."votes`.`id`
  16. INNER JOIN `".DBPRE."sites` ON `".DBPRE."sites`.`id` = `".DBPRE."votes`.`site`
  17. WHERE `callbackdate` IS NOT NULL AND ((`callbackdate` > UTC_TIMESTAMP() - INTERVAL `waittime` HOUR) OR `fulfilled` = 0) AND (`user` = '%3:s' OR `ip` = '%4:s')",
  18. $_SESSION['user'], $_SERVER['REMOTE_ADDR'], $_SESSION['user'], $_SERVER['REMOTE_ADDR']);
  19. return $data;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement