Non-anonymous questions
This commit is contained in:
parent
178dab9650
commit
b92527f7b7
6
TODO.md
6
TODO.md
|
@ -1,5 +1,5 @@
|
||||||
- Functionality:
|
- Functionality:
|
||||||
- Non-anonymous questions
|
- ~~Non-anonymous questions~~
|
||||||
- Answers
|
- Answers
|
||||||
- Follows and followers (timeline)
|
- Follows and followers (timeline)
|
||||||
- Actions redirections
|
- Actions redirections
|
||||||
|
@ -16,3 +16,7 @@
|
||||||
- Add various language support.
|
- Add various language support.
|
||||||
- Basic theme styling
|
- Basic theme styling
|
||||||
- Relative time
|
- Relative time
|
||||||
|
|
||||||
|
- Bugs:
|
||||||
|
- Login redirection is broken
|
||||||
|
- Check that the user exists before keeping being logged like it
|
||||||
|
|
|
@ -19,6 +19,8 @@ if(isset($_POST["post-submit"])){
|
||||||
$by = 0;
|
$by = 0;
|
||||||
$question = htmlspecialchars($_POST["post-text"], ENT_QUOTES);
|
$question = htmlspecialchars($_POST["post-text"], ENT_QUOTES);
|
||||||
|
|
||||||
|
if(isset($_SESSION["uid"]) && !$_POST["anon"]) $by = $_SESSION["uid"];
|
||||||
|
|
||||||
// Insert user into DB
|
// Insert user into DB
|
||||||
$db->exec("INSERT INTO questions(user,by,question,answered,date) VALUES ('$u','$by','$question',0,". strtotime('now') .");");
|
$db->exec("INSERT INTO questions(user,by,question,answered,date) VALUES ('$u','$by','$question',0,". strtotime('now') .");");
|
||||||
unset($_POST["post-text"]);
|
unset($_POST["post-text"]);
|
||||||
|
|
|
@ -51,7 +51,7 @@ if(isset($_POST["reg"])){
|
||||||
$shadow = password_hash($_POST["password"], PASSWORD_DEFAULT);
|
$shadow = password_hash($_POST["password"], PASSWORD_DEFAULT);
|
||||||
|
|
||||||
// Insert user into DB
|
// Insert user into DB
|
||||||
$db->exec("INSERT INTO users(username,shadow) VALUES ('$user','$shadow')");
|
$db->exec("INSERT INTO users(username,name,shadow) VALUES ('$user','$user','$shadow')");
|
||||||
unset($_POST["regname"],$_POST["password"],$_POST["invite"]);
|
unset($_POST["regname"],$_POST["password"],$_POST["invite"]);
|
||||||
|
|
||||||
$regErrorMsg = "Account created successfully";
|
$regErrorMsg = "Account created successfully";
|
||||||
|
|
6
user.php
6
user.php
|
@ -34,11 +34,11 @@ if(isset($_SESSION["uid"])){
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<form name="input" action="/action/publish-question.php" method="post">
|
<form name="input" action="/action/publish-question.php" method="post">
|
||||||
<p>Ask me anything</p>
|
<textarea placeholder="Ask me anything!" id="post-text" name="post-text"></textarea>
|
||||||
<textarea id="post-text" name="post-text"></textarea>
|
|
||||||
<br/>
|
<br/>
|
||||||
<?php if(isset($errorMsg)) echo "<p>$errorMsg</p>\n"; ?>
|
|
||||||
<input type="hidden" name="uid" value="<?= $p_user["id"] ?>"/>
|
<input type="hidden" name="uid" value="<?= $p_user["id"] ?>"/>
|
||||||
|
<p><input type="checkbox" <?php if(!isset($_SESSION["uid"])) echo("checked disabled"); ?> name="anon"/> Post anonymously</p>
|
||||||
|
<?php if(isset($errorMsg)) echo "<p>$errorMsg</p>\n"; ?>
|
||||||
<input type="submit" name="post-submit"/>
|
<input type="submit" name="post-submit"/>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue