Fixed bug REDIRECT_URL not exists + views base Layout

This commit is contained in:
Bofh 2021-11-25 13:54:55 +01:00
parent edd8ffb317
commit 381a188082
4 changed files with 40 additions and 17 deletions

View File

@ -1,6 +1,9 @@
<?php require_once '/src/base.php' ?> <?php require_once '/src/base.php' ?>
<?php <?php
$signup_method = null;
if (isset($_SERVER['REDIRECT_URL'])) {
# process URI # process URI
$path = trim($_SERVER['REDIRECT_URL'], '/'); $path = trim($_SERVER['REDIRECT_URL'], '/');
$args = explode('/', $path); $args = explode('/', $path);
@ -11,10 +14,17 @@ if (count($args) === 0) {
} }
# get the signup method from URL # get the signup method from URL
$signup_method = $args[0]; $signup_method = $args[1];
if (!in_array($signup_method, ['mastodon'])) { if (!in_array($signup_method, ['mastodon'])) {
die('The given arguments are not correct'); die('The given arguments are not correct');
} }
}
# show arguments ?>
var_dump($signup_method); <?php require '/src/views/head.php' ?>
<?php require '/src/views/public/head.php' ?>
<main>
SIGNUP: <?php echo $signup_method ?>
</main>
<?php require '/src/views/public/foot.php' ?>
<?php require '/src/views/foot.php' ?>

View File

@ -1,6 +1,10 @@
<?php require_once '/src/base.php' ?> <?php require_once '/src/base.php' ?>
<?php <?php
if (!isset($_SERVER['REDIRECT_URL'])) {
header('Location: /'); die;
}
# process URI # process URI
$path = trim($_SERVER['REDIRECT_URL'], '/'); $path = trim($_SERVER['REDIRECT_URL'], '/');
$args = explode('/', $path); $args = explode('/', $path);
@ -22,6 +26,11 @@ if (!preg_match('/^@[a-zA-Z0-9_]+@[a-z0-9\-\.]+$/', $fediverse_id)) {
} }
$args = array_splice($args, 1); $args = array_splice($args, 1);
# show arguments ?>
var_dump($fediverse_id); <?php require '/src/views/head.php' ?>
var_dump($args); <?php require '/src/views/public/head.php' ?>
<main>
USER: <?php echo $fediverse_id ?>
</main>
<?php require '/src/views/public/foot.php' ?>
<?php require '/src/views/foot.php' ?>

View File

@ -0,0 +1,2 @@
<?php

View File

@ -0,0 +1,2 @@
<?php