Gazelle/sections/questions/take_ask_question.php

28 lines
569 B
PHP
Raw Normal View History

2013-10-13 08:01:01 +00:00
<?
2013-10-26 08:00:58 +00:00
DEFINE('MAX_QUESTIONS', 50);
2013-10-13 08:01:01 +00:00
authorize();
2013-10-26 08:00:58 +00:00
$DB->query("SELECT COUNT(1) FROM user_questions WHERE UserID = '$LoggedUser[ID]'");
2013-10-28 08:01:14 +00:00
list($Results) = $DB->next_record();
if ($Results >= MAX_QUESTIONS) {
2013-10-26 08:00:58 +00:00
error("You have asked too many questions for the time being.");
}
2013-10-13 08:01:01 +00:00
$Question = db_string($_POST['question']);
if (empty($Question)) {
error("No question asked");
}
$UserID = $LoggedUser['ID'];
$Date = sqltime();
$DB->query("
2013-10-14 08:00:53 +00:00
INSERT INTO user_questions
(Question, UserID, Date)
VALUES
('$Question', '$UserID', '$Date')");
2013-10-13 08:01:01 +00:00
2013-10-14 08:00:53 +00:00
header("Location: questions.php");