Skip to content

Commit

Permalink
validate data on unused API endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
causefx committed Jun 28, 2021
1 parent 2704ede commit 7ba6fe9
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions api/index.php
@@ -1,15 +1,22 @@
<?php
reset($_GET);
$function = (key($_GET) ? str_replace("/", "_", key($_GET)) : false);
function validateData($data)
{
$data = trim($data);
$data = stripslashes($data);
return htmlspecialchars($data);
}

switch ($function) {
case 'v1_auth':
$group = ($_GET['group']) ?? 0;
header('Location: v2/auth?group=' . $group);
header('Location: v2/auth?group=' . validateData($group));
exit;
default:
// Forward everything to v2 api
$result['status'] = "error";
$result['statusText'] = "Please Use api/v2";
break;
}
header('Location: v2/');
header('Location: v2/');

0 comments on commit 7ba6fe9

Please sign in to comment.