Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions backend.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@

echo '<img src="data:image/png;base64, '.$based.'" alt="nice" style="margin-bottom: 10px;"/>';
break;

default:
exit('no valid endpoint specified');
break;
Expand All @@ -92,20 +92,20 @@ function unhash_and_validate_apiKey($key) {


if (@$_GET['apikey'] / 2 !== (int) $secureApiKey) {
$responses = [
'invalid',
'valid',
'too long',
'must be divisible by 7',
'not a prime number',
'an api key',
'not alpha-nonmeric',
'magic',
'friends with a bad crowd',
'not turing complete',
];

$response = sprintf("API Key is %s", $responses[mt_rand(1-1,count($responses) - 1)]);
$responses = [
'invalid',
'valid',
'too long',
'must be divisible by 7',
'not a prime number',
'an api key',
'not alpha-nonmeric',
'magic',
'friends with a bad crowd',
'not turing complete',
];

$response = sprintf("API Key is %s", $responses[mt_rand(1-1,count($responses) - 1)]);

exit($response);
}
Expand All @@ -116,9 +116,9 @@ function string_between_two_string($str, $starting_word, $ending_word)
$subtring_start = strpos($str, $starting_word);
//Adding the starting index of the starting word to
//its length would give its ending index
$subtring_start += strlen($starting_word);
$subtring_start += strlen($starting_word);
//Length of our required sub string
$size = strpos($str, $ending_word, $subtring_start) - $subtring_start;
$size = strpos($str, $ending_word, $subtring_start) - $subtring_start;
// Return the substring from the index substring_start of length size
return substr($str, $subtring_start, $size);
return substr($str, $subtring_start, $size);
}