Avancing in profile.php module to show public profile

* Get urlargs correctly (username from URL)
* Validate the username by the regex
* Get $actor to be used in page HTML
This commit is contained in:
Niko 2022-02-11 01:50:52 +01:00
parent 7706c71f6d
commit 553c7d17a5
1 changed files with 13 additions and 1 deletions

View File

@ -1,3 +1,15 @@
<?php require 'base.php' ?>
<?php require 'database.php' ?>
<?php <?php
echo 'PROFILE'; $args = urlargs();
$database = new DB();
$username = substr($args[0], 1);
if (!validate_username($username))
$username = false;
$actor = null;
if ($username !== false)
$actor = $database->getActorByUsername($username);
echo json_encode($actor);