if (isset($topath)) { qa_redirect_raw("/" . $topath); } else { qa_redirect_raw('/'); } } } } else { qa_redirect_raw('/view/question.php'); } } if ($doanswer) { if (!qa_get_logged_in_userid()) { if (!qa_check_form_security_code('answer', qa_post_text('code')) || strtolower($_SESSION['VerifyCode']) != strtolower(qa_post_text('captcha'))) { $errors['page'] = '验证码错误,请重试'; qa_redirect_raw('/questiondetail/' . $_POST['question'] . '.html?error=' . urlencode($errors['page'])); } else { $parentid = $_POST['question']; $content = $_POST['content']; createAnswer($parentid, $content); $topath = qa_get('to'); if (isset($topath)) { qa_redirect_raw("/" . $topath); } else { qa_redirect_raw('/'); } } } } } qa_redirect_raw('/');
function submitAnswersForm($newAnswer, $round) { if ($newAnswer == "") { echo "<div class='errormsg'>Blank Answer is unacceptable. Try again</div>\n"; return FALSE; } createAnswer($newAnswer, $round); printf("<div class='okmsg'>Added new Answer: %s for Round %s</div>\n", htmlspecialchars($newAnswer), $round); return TRUE; }
<?php include_once 'procedures.php'; $echoAnswer = ""; $questionId = intval($_POST['questionId']); if (!isAdmin()) { echo "Нет полномочий"; exit; } if (isset($_POST['createQuestion'])) { $answer = createAnswer($_POST['question'], $_POST['answer']); switch ($answer) { case 0: $echoAnswer = "Вопрос успешно создан!"; break; case 1: $echoAnswer = "Произошла ошибка во время отправления вопроса в БД!"; break; case 2: $echoAnswer = "Не удалось подключиться к БД!"; break; } } else { if (isset($_POST['updateQuestion'])) { $answer = updateAnswer($questionId, $_POST['question'], $_POST['answer']); switch ($answer) { case 0: $echoAnswer = "Вопрос успешно обновлен!"; break; case 1: $echoAnswer = "Произошла ошибка во время отправления вопроса в БД!";
// $answers[] = $sheet->getCellByColumnAndRow(6,$row)->getValue(); $answer = $sheet->getCellByColumnAndRow(3, $row)->getValue(); $quser = rand(2, 11); $q_id = createQuestion($q_title, $q_content, null, null, $tags, $quser); usleep(10000); //随机时间范围 $date1 = "2014-03-11 20:21:32"; $date2 = "2015-06-13 20:21:32"; $qtime = setPostTime($q_id, $date1, $date2); echo "question id:", $q_id, "<br>"; // foreach ($answers as $key => $answer) { do { $auser = rand(2, 11); ob_flush(); } while ($auser === $quser); $a_id = createAnswer($q_id, $answer, $auser); usleep(10000); setPostTime($a_id, $date1, $date2, $qtime); $i++; echo "answer id:", $a_id, "<br>"; // } flush(); if ($i % 20 === 0) { echo "正在导入。。。第 {$row} 行/总共 {$sheet_row_count} 行" . "<br />"; usleep(100000); //等待0.1秒 } } } } } else {