diff --git a/action/publish-question.php b/action/publish-question.php index 452e8b9..6ba1bdc 100644 --- a/action/publish-question.php +++ b/action/publish-question.php @@ -1,6 +1,7 @@ exec("INSERT INTO questions(user,by,question,q_date,private) VALUES ('$u','$by','$question',". strtotime('now') .",$priv);"); + $db->exec("INSERT INTO questions(user,by,question,q_date,private) VALUES ('$u','$by','$question',". $time .",$priv);"); unset($_POST["post-text"]); - if($fancy_urls) header("Location: /user/" . $p_user["username"]); - else header("Location: /user.php?q=" . $p_user["username"]); + + $q_new = $db->query("SELECT * FROM questions WHERE q_date = '" . $time . "';")->fetchArray(SQLITE3_ASSOC); + + $new_get["q"] = $p_user["username"]; + if($priv){ + $new_get["p"] = $q_new["id"]; + $new_get["key"] = md5($question); + } + + header("Location: " . redirect("user", $new_get)); } } ?> diff --git a/user.php b/user.php index be6c18c..c6f75d6 100644 --- a/user.php +++ b/user.php @@ -205,7 +205,7 @@ if(isset($_GET["p"])){ $time->settimestamp($current["q_date"]); echo("\t\t\t\t\t"); $tmp_get["p"] = $current["id"]; - $tmp_get["key"] = md5($current["question"]); + if($current["private"] == 1) $tmp_get["key"] = md5($current["question"]); echo(''); echo("

" . $time->format("Y-m-d h:i:s") . "

"); echo("
\n");