Advertisement
Guest User

Untitled

a guest
Jun 18th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. [07:31:28] tiger45: Whats the best DB that you'd use for that
  2. [07:31:31] tiger45: I mean, the structure
  3. [07:31:56] Shane Mackenzie: sam probs
  4. [07:32:01] Shane Mackenzie: Ahh structure
  5. [07:32:35] tiger45: Making 1 table for each person, is a bitchy thing
  6. [07:32:36] tiger45: lol
  7. [07:33:26] Shane Mackenzie: How you want to display the info
  8. [07:33:36] tiger45: i want to make a site for it
  9. [07:33:39] tiger45: or just a page
  10. [07:33:41] tiger45: and on irc
  11. [07:33:42] tiger45: can be called
  12. [07:33:44] Shane Mackenzie: I mean, 24h max, or longer
  13. [07:34:15] tiger45: oh, want to keep them all
  14. [07:34:25] tiger45: so i can do something like !play 1w
  15. [07:34:29] Shane Mackenzie: The best way to do it would be like this:
  16. [07:34:30] tiger45: like my current mirc one
  17. [07:35:21] Shane Mackenzie: gLogs -> Growth Logs.
  18. Username / TFF / UnixTimeStamp
  19.  
  20. Each update, You use insert into gLogs set....    
  21. Set username/unixtimestamp as index
  22. [07:35:32] Shane Mackenzie: So,  You update everyone, You get 6k new rows
  23. [07:35:38] Shane Mackenzie: You then do this:
  24. [07:37:51] Shane Mackenzie: $now = time();
  25. $old = time() - $hours * (60*60)
  26.  
  27. Select * from gLogs where unixtime > $now -3600   --> Put this in array 1
  28. Select * from gLogs where unixtime > $old < $old+3600   (Should get 1 result for each player,   mostly?
  29. [07:38:16] Shane Mackenzie: Then compare arrays
  30. [07:39:50] Shane Mackenzie: Makes sense?
  31. [07:40:11] Shane Mackenzie: The maths maybe wrong in the example, but thoery isnt
  32. [07:41:11] tiger45: brb
  33. [07:46:44] Shane Mackenzie: 5 hours growth
  34. $hour = 5;
  35. $now = time();
  36. $old = time() - ($hour * (60 * 60));
  37. $s = " select  * from gLogs where unixtime > $now-3600   --> will return one row for each user in db....
  38.  
  39. $ss = " select * from gLogs where unixtime > $old and unixtime < $old+3600  - -> should return 1 row for each user in db, thats 5 hours old,   I think
  40. [07:46:52] Shane Mackenzie: then ermmm
  41. [07:47:52] Shane Mackenzie: $array['Shane'] = 1000
  42. $array2['Shane'] = 1337
  43.  
  44. echo "Growth for: $user = ($array[$user] - $array2[$user])
  45. [07:48:06] Shane Mackenzie: Hope it makes sense, wrote in a shit way on Skype
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement