This repository has been archived by the owner on May 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcron.php
60 lines (44 loc) · 1.66 KB
/
cron.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
// make this file run often with a cron
require "init.php";
$database->insert("Executions", ["Time" => time()]);
$rank = 0;
$exe = $database->count("Executions");
while($rank < 12){
$rank++;
$junk = topmclist_rank_grab($rank);
$Name = $junk->data->name;
$ID = $junk->data->ID;
$database->insert("Server_Ranks", ["Server_ID" => $ID, "Rank" => $rank, "Execution" => $exe]);
$Server_Ranks_By_Server_ID = $database->select("Server_Ranks", ["Server_ID","Rank", "Execution"] , ["Server_ID" => $ID]);
$index="old";
// check if we have more than execution with data for this server first!
$server_execution_count = 0;
foreach ($Server_Ranks_By_Server_ID as $Grab) {
$server_execution_count++;
}
if($server_execution_count > 1){
// This makes an array with the last two excution collections
foreach ($Server_Ranks_By_Server_ID as $Grab) {
if($Grab["Execution"] == $exe || $Grab["Execution"] == $exe -1){
$server_snapshot[$index] = $Grab;
if($index == "old"){
$index = "new";
}
}
}
if($server_snapshot["old"]["Rank"] > $server_snapshot["new"]["Rank"]){
$Tweeter_Template = rand(1,3);
if($Tweeter_Template == 1){
tweet("it appears ".$Name." moved from position ". $server_snapshot["old"]["Rank"]." to position ". $server_snapshot["new"]["Rank"] ." http://topmclist.com/server_id/".$ID);
}
if($Tweeter_Template == 2){
tweet("Hey! ".$Name." moved up to #". $server_snapshot["new"]["Rank"] ." on @Topmclist http://topmclist.com/server_id/".$ID);
}
if($Tweeter_Template == 3){
tweet("Check out ".$Name." they are now number". $server_snapshot["new"]["Rank"] ." http://topmclist.com/server_id/".$ID);
}
}
}
}
?>