Skip to content

Commit

Permalink
fixed first time visit bug (without cache)
Browse files Browse the repository at this point in the history
  • Loading branch information
bigsk05 committed Aug 20, 2022
1 parent e5702a2 commit 7c868cb
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@
} else {
$donor_object = json_decode($local_donor, true);
}
} else {
// Request for data
$donor_data = @file_get_contents("https://api.foldingathome.org/user/".$donor, false, stream_context_create($arr_context_options)) or die("api failed");
$donor_object = json_decode($donor_data, true);
if (array_key_exists("status", $donor_object)) {
exit("api failed");
}
if ($DEBUG) var_dump($donor_object);
}
if (file_exists("teams/".$team)) {
$local_team = file_get_contents("teams/".$team);
Expand All @@ -55,6 +63,14 @@
} else {
$team_object = json_decode($local_donor, true);
}
} else {
// Request for data
$team_data = @file_get_contents("https://api.foldingathome.org/team/".$team, false, stream_context_create($arr_context_options)) or die("api failed");
$team_object = json_decode($team_data, true);
if (array_key_exists("status", $team_object)) {
exit("api failed");
}
if ($DEBUG) var_dump($team_object);
}

// Save record
Expand Down

0 comments on commit 7c868cb

Please sign in to comment.