Fancy URLs settings option
This commit is contained in:
parent
4d0deabb16
commit
c8123de470
10
config.php
10
config.php
|
@ -1,16 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
|
include("include/header.php");
|
||||||
session_start();
|
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>
|
<html>
|
||||||
<h1>Config</h1>
|
<h1>Config</h1>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
include("settings.php");
|
||||||
session_start();
|
session_start();
|
||||||
|
|
||||||
$db = new SQLite3('ask.db');
|
$db = new SQLite3('ask.db');
|
||||||
|
@ -29,12 +30,26 @@ if($_SESSION["login"] === true){
|
||||||
echo("<a href='/'>LibreCat</a>");
|
echo("<a href='/'>LibreCat</a>");
|
||||||
echo(" | ");
|
echo(" | ");
|
||||||
$user = $db->query("SELECT * FROM users WHERE id = ".$_SESSION["uid"].";")->fetchArray(SQLITE3_ASSOC);
|
$user = $db->query("SELECT * FROM users WHERE id = ".$_SESSION["uid"].";")->fetchArray(SQLITE3_ASSOC);
|
||||||
|
if($fancy_urls){
|
||||||
echo("<a href='/user/" . $user["username"] . "'>". $user["username"] . "</a>");
|
echo("<a href='/user/" . $user["username"] . "'>". $user["username"] . "</a>");
|
||||||
echo(" | ");
|
echo(" | ");
|
||||||
echo("<a href='/logout'>logout</a>");
|
echo("<a href='/logout'>logout</a>");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
echo("<a href='/user.php?q=" . $user["username"] . "'>" . $user["username"] . "</a>");
|
||||||
|
echo(" | ");
|
||||||
|
echo("<a href='/logout.php'>logout</a>");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
echo("<a href='/'>LibreCat</a>");
|
||||||
|
echo(" | ");
|
||||||
|
if($fancy_urls){
|
||||||
echo("<a href='/login'>Login</a>");
|
echo("<a href='/login'>Login</a>");
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
echo("<a href='/login.php'>Login</a>");
|
||||||
|
}
|
||||||
//header("Location: /login.php"); die();
|
//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"); ?>
|
<?php include("include/header.php"); ?>
|
||||||
<h2><?= $p_user["username"] ?></h2>
|
<h2><?= $p_user["username"] ?></h2>
|
||||||
<p><?= $p_user["bio"] ?></p>
|
<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">
|
<form name="input" action="" method="post">
|
||||||
<p>Ask me anything</p>
|
<p>Ask me anything</p>
|
||||||
|
|
Loading…
Reference in New Issue