auth api
This commit is contained in:
parent
383473e4bc
commit
b27b98fe3f
2 changed files with 14 additions and 2 deletions
5
docs/auth.php
Normal file
5
docs/auth.php
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
require("../libs/auth.php");
|
||||||
|
global $username;
|
||||||
|
echo $username;
|
||||||
|
?>
|
|
@ -30,7 +30,14 @@
|
||||||
$stmt->execute([$user,$token]);
|
$stmt->execute([$user,$token]);
|
||||||
|
|
||||||
setcookie("token", $token, time()+3600*24);
|
setcookie("token", $token, time()+3600*24);
|
||||||
|
|
||||||
|
if (isset($_GET['next'])) {
|
||||||
|
$gett = htmlspecialchars($_GET['next'] . '?token=' . $token);
|
||||||
|
echo "<script>window.location.href = '$gett'</script>";
|
||||||
|
page_footer();
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
header("Location: /");
|
header("Location: /");
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
@ -45,4 +52,4 @@
|
||||||
));
|
));
|
||||||
|
|
||||||
page_footer();
|
page_footer();
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in a new issue