better config style, user config mockup and unlink tw account

This commit is contained in:
Pòsweg 2020-08-30 22:21:57 +02:00
parent 4a791af046
commit 1470309037
4 changed files with 64 additions and 12 deletions

13
action/tw-unlink.php Normal file
View File

@ -0,0 +1,13 @@
<?php
session_start();
$db = new SQLite3('../ask.db');
if(isset($_SESSION["uid"])){
$user = $db->exec("UPDATE users SET
tw_oauth_token = '', tw_oauth_verify = ''
WHERE id = ". $_SESSION["uid"] . ";");
header("Location: /config");
}
else echo("You have to be logged in to perform that action");
?>

View File

@ -8,9 +8,11 @@ if(!isset($_SESSION["uid"])){
include("include/header.php");
include("include/settings.php");
$db = new SQLite3('ask.db');
$p_user = $db->query("SELECT * FROM users WHERE username = '" . $_GET["q"] . "';")->fetchArray(SQLITE3_ASSOC);
//var_dump($p_user);
?>
<!DOCTYPE html>
<html>
@ -21,21 +23,40 @@ $db = new SQLite3('ask.db');
</head>
<body>
<div class="main-container">
<h1 class="title">Config</h1>
<h1>Config</h1>
<div class="section">
<h2>Account settings (WIP, doesn't work)</h2>
<form>
<p>Username</p>
<input label="name" type="text"/>
<p>Name</p>
<input label="username" type="text"/>
<p>Profile photo</p>
<input type="file"/>
</form>
</div>
<p>
<div class="section">
<h2>Posting to Twitter</h2>
<p>
For now this section is under construction, but
I have activated it to log vinculate accounts with
Twitter.
</p>
</p>
</div>
<?php
if(!$db->querySingle("SELECT tw_oauth_verify FROM users where id = " . $_SESSION["uid"] . ";")){
echo "<p><a href='/action/tw-login.php'>Login with Twitter</a></p>";
}
else echo "<p><a href='/action/tw-post-sample'>Post test tweet</a>";
else{
echo "<p><a href='/action/tw-post-sample'>Post test tweet</a></p>";
echo "<br/>";
echo "</p><a href='/action/tw-unlink.php'>Unlink account</a></p>";
}
?>
</div>
</body>
</html>

View File

@ -1,3 +1,4 @@
<?php
include("main.php");
echo('<link rel="stylesheet" type="text/css" href="/themes/minimalpunk/css/config.css.php">');
?>

View File

@ -13,6 +13,7 @@ body{
font-family: liberation-sans;
background-color: <?= $color_bg ?>;
color: white;
font-size: 15px;
}
a{
@ -23,7 +24,9 @@ input{
background-color: <?= $color_3 ?>;
color: white;
border: none;
padding: 10px 20px;
padding: 5px 10px;
margin: 5px 0px;
font-size: 10px;
}
body{
@ -36,3 +39,17 @@ body{
padding: 20px;
background-color: <?= $color_main ?>;
}
h1, h2{
font-weight: bold;
}
h1{
font-size:30px;
margin-bottom: 30px;
}
h2{
font-size: 20px;
margin-bottom: 20px;
}