Пример #1
0
			</div>
		</div>
	</div>
	<div class="container">
	<?php 
require_once "mysqli.php";
require_once "captcha.php";
$db = new Reporter_DB();
$db->start();
$trivia = new Trivia_DB();
$trivia->start();
list($equation, $hashedCaptcha) = Captcha::calculate();
$all_reasons = $db->get_all_reasons();
$all_themes_names = $trivia->get_themes_array();
if ($_POST["selReason"] && $_POST["txtQuestion"] && $_POST["txtCaptcha"] && $_POST["selTheme"]) {
    if (!$db->check_reason_exists($_POST["selReason"])) {
        echo '<div id="user_alert" class="alert alert-danger col-sm-8 col-sm-offset-2">Invalid type of mistake.</div>';
    } else {
        if (Captcha::check($_POST["txtCaptcha"], $_POST["hashedCaptcha"])) {
            if (array_key_exists($_POST["selTheme"], $all_themes_names)) {
                $theme_id = $_POST["selTheme"];
            } else {
                $theme_id = 1;
            }
            if ($db->add_report($_POST["selReason"], $_POST["txtQuestion"], $_POST["txtComment"], $theme_id)) {
                echo '<div id="user_alert" class="alert alert-success col-sm-8 col-sm-offset-2">Report successfully submitted. ' . 'Thank you for notifying us about this mistake.</div>';
            } else {
                echo '<div id="user_alert" class="alert alert-danger col-sm-8 col-sm-offset-2">Error occured when submitting report. ' . 'Please try again later.</div>';
            }
        } else {
            echo '<div id="user_alert" class="alert alert-danger col-sm-8 col-sm-offset-2">The answer to the equation is ' . '<b>incorrect</b>. Try again.</div>';
Пример #2
0
	<link rel="stylesheet" type="text/css" href="../css/style.css">
</head>
<body style="width: 100%; height: 100%; padding-top: 70px;">
<?php 
require_once "utils.php";
require_once "../mysqli.php";
$state_types = array(0 => "NEW", 1 => "FIXED", 2 => "DUPLICATE", 3 => "INVALID", 4 => "WONTFIX");
$COUNT_PER_PAGE = Config::$items_per_page;
$count_rows = 0;
$current_page = 1;
$db = new Reporter_DB();
$db->start();
$trivia = new Trivia_DB();
$trivia->start();
$all_reasons = $db->get_all_reasons();
$reason_exists = $db->check_reason_exists($_GET["rid"]);
$all_themes_names = $trivia->get_themes_array();
while ($row = $all_reasons->fetch_array(MYSQLI_NUM)) {
    $key = $row[0];
    $reason_names[$key] = $row[1];
}
function get_label($filter, $fsub)
{
    global $state_types;
    global $reason_names;
    global $reason_exists;
    if ($filter == "state") {
        if ($fsub >= 0 and $fsub <= 4) {
            return $state_types[$fsub];
        }
    } else {