Exemplo n.º 1
0
function post_question()
{
    global $client;
    global $PS;
    $number = htmlspecialchars($_POST['value']);
    if ($number == 1) {
        $_SESSION['PSVal'] = 0;
        $_SESSION['Type'] = null;
        $_SESSION['TypeStr'] = null;
    }
    $PS = $_SESSION['PSVal'];
    $choice = htmlspecialchars($_POST['choice']);
    $wt = 0;
    if ($choice == 1 || $choice == 3 || $choice == 5) {
        $wt = 0;
    } else {
        if ($choice == 2 || $choice == 4) {
            $wt = 1;
        }
    }
    $PS += $wt;
    $_SESSION['PSVal'] = $PS;
    if ($number % 5 == 0) {
        $_SESSION['PSVal'] = 0;
        addType($number);
    }
    if ($number < 21) {
        $query = 'MATCH (ss:Scene),(cc:Choice) WHERE ss.qno = cc.qno = {questionNumber} RETURN ss,cc ORDER BY cc.cno';
        $parameters = ['questionNumber' => $number];
        $result = $client->sendCypherQuery($query, $parameters)->getRows();
        $op = json_encode($result);
        if ($op == null) {
            echo "Some Error";
        } else {
            echo $op;
        }
    } else {
        echo "end";
    }
}
Exemplo n.º 2
0
    $uid = $_SESSION['uid'];
    // validate type
    if (empty($_POST['type'])) {
        $errors[] = "type";
    } else {
        $type = mysqli_real_escape_string($dbc, strip_tags($_POST['type']));
    }
    // validate type
    if (isset($_POST['cat']) && filter_var($_POST['cat'], FILTER_VALIDATE_INT, array('min_range' => 1))) {
        $cat = $_POST['cat'];
    } else {
        $errors[] = 'cat';
    }
    if (empty($errors)) {
        // add record
        $result = addType($type, $cat);
        if (mysqli_affected_rows($dbc) == 1) {
            echo "<script type='text/javascript'>\n                        alert('{$lang['AD_GAME_SUCCESS']}');\n                        window.location = 'list_type.php';\n                        </script>\n                    ";
        } else {
            echo "<script type='text/javascript'>\n                        alert('{$lang['AD_FAIL']}');\n                        window.location = 'list_type.php';\n                        </script>\n                    ";
        }
    } else {
        $error = $lang['AD_REQUIRED'];
    }
}
// END main IF submit condition
include '../includes/backend/header-admin.php';
?>
<!-- Script ################## -->
	<div class="content-wrapper">
        <div class="container">
Exemplo n.º 3
0
function globetype_show_types()
{
    list_type($_GET['id']);
    echo "<br>";
    addType();
}