Fancy URLs settings option
This commit is contained in:
parent
4d0deabb16
commit
c8123de470
10
config.php
10
config.php
|
@ -1,16 +1,8 @@
|
|||
<?php
|
||||
include("include/header.php");
|
||||
session_start();
|
||||
|
||||
if($_SESSION["login"] === true){
|
||||
echo($_SESSION["uid"] . " - ");
|
||||
echo("<a href='/logout'>logout</a>");
|
||||
echo(" - <a href='/config'>config</a>'");
|
||||
}
|
||||
else{
|
||||
header("Location: /login"); die();
|
||||
}
|
||||
?>
|
||||
|
||||
<html>
|
||||
<h1>Config</h1>
|
||||
</html>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
include("settings.php");
|
||||
session_start();
|
||||
|
||||
$db = new SQLite3('ask.db');
|
||||
|
@ -29,12 +30,26 @@ if($_SESSION["login"] === true){
|
|||
echo("<a href='/'>LibreCat</a>");
|
||||
echo(" | ");
|
||||
$user = $db->query("SELECT * FROM users WHERE id = ".$_SESSION["uid"].";")->fetchArray(SQLITE3_ASSOC);
|
||||
echo("<a href='/user/" . $user["username"] . "'>". $user["username"] . "</a>");
|
||||
echo(" | ");
|
||||
echo("<a href='/logout'>logout</a>");
|
||||
if($fancy_urls){
|
||||
echo("<a href='/user/" . $user["username"] . "'>". $user["username"] . "</a>");
|
||||
echo(" | ");
|
||||
echo("<a href='/logout'>logout</a>");
|
||||
}
|
||||
else {
|
||||
echo("<a href='/user.php?q=" . $user["username"] . "'>" . $user["username"] . "</a>");
|
||||
echo(" | ");
|
||||
echo("<a href='/logout.php'>logout</a>");
|
||||
}
|
||||
}
|
||||
else{
|
||||
echo("<a href='/login'>Login</a>");
|
||||
echo("<a href='/'>LibreCat</a>");
|
||||
echo(" | ");
|
||||
if($fancy_urls){
|
||||
echo("<a href='/login'>Login</a>");
|
||||
}
|
||||
else{
|
||||
echo("<a href='/login.php'>Login</a>");
|
||||
}
|
||||
//header("Location: /login.php"); die();
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
// To activate this you have to put
|
||||
// NGINX's redirect directives. The
|
||||
// service is perfectly functional
|
||||
// with this as false
|
||||
|
||||
$fancy_urls = false;
|
||||
|
||||
?>
|
9
user.php
9
user.php
|
@ -43,7 +43,14 @@ if(isset($_POST["post-submit"])){
|
|||
<?php include("include/header.php"); ?>
|
||||
<h2><?= $p_user["username"] ?></h2>
|
||||
<p><?= $p_user["bio"] ?></p>
|
||||
<?php if($is_current_user) echo("<a href='/config'>config</a>"); ?>
|
||||
<?php
|
||||
if($is_current_user){
|
||||
if($fancy_urls)
|
||||
echo("<a href='/config'>config</a>");
|
||||
else
|
||||
echo("<a href='/config.php'>config</a>");
|
||||
}
|
||||
?>
|
||||
|
||||
<form name="input" action="" method="post">
|
||||
<p>Ask me anything</p>
|
||||
|
|
Loading…
Reference in New Issue