function display_resource_action()
{
    $get_resource = display_data('resource');
    $display = '';
    $count_resource = 0;
    $count_action = 0;
    foreach ($get_resource as $value) {
        $count_resource++;
        $val = $value['resource'];
        $id = 'resource' . $value['id'];
        $display .= "<tr><td class='privilege_display'><label id='{$id}'\n        name='{$val}'>{$val}</label>&nbsp&nbsp</td> ";
        // Getting action table data.
        $get_action = get_action();
        foreach ($get_action as $value_action) {
            $count_action++;
            $val_action = $value_action['operation'];
            $id_action = $id . 'action' . $value_action['id'];
            $display .= "<td class='privilege_display'>\n            <input id='{$id_action}' type='checkbox' name='{$val_action}' value='{$val_action}'>\n            &nbsp{$val_action} &nbsp&nbsp </td> ";
        }
        if ($count_action >= 2) {
            $display .= "<td class='privilege_display'>\n            <input id='all_{$id}' type='checkbox' name='all' value='all_{$id}'>\n            &nbsp all &nbsp&nbsp </td> ";
        }
        $display .= '<br/> </tr>';
    }
    //end foreach
    $count_action /= 2;
    $display .= "<input id='count_action' type='hidden' name='count_action' value='{$count_action}'>";
    $display .= "<input id='count_resource' type='hidden' name='count_resource' value='{$count_resource}'>";
    return $display;
}
Example #2
0
function build_results_table()
{
    if (!isset($_POST["contributor"])) {
        # No form search yet
        echo "<DIV CLASS=\"font_title\">Search California political contributions from 2001 through the present using the form on this page.</DIV>";
    } else {
        # Parse search form
        $parse_data = parse_search_form($_POST);
        display_data($parse_data);
    }
}
// Notice that you had more code, and it did less -- it didn't track how many fields were missing.
// Once you create the functions and call them, please delete the $counter line and the 'if' blocks in this section.
// -- SANITIZE FIELDS (REMOVE DANGEROUS CHARACTERS) -- text boxes and textarea only
sanitize("name", "text", $_POST["name"]);
sanitize("email", "text", $_POST["email"]);
sanitize("comment", "textarea", $_POST["comment"]);
// Below this point is your our old code for checking for sanitizing the data.
// Notice that you had a lot more code, and it did less -- we didn't escape quote marks in the previous version.
// Once you create the functions and call them, please delete the old code in this section.
// -- DISPLAY OUTPUT
echo "<h3><i>You submitted the following information:</i></h3>";
echo "<div id='formData'>";
display_data("name", "text", $_POST["name"]);
display_data("email", "text", $_POST["email"]);
display_data("comment", "textarea", $_POST["comment"]);
display_data("mail", "checkbox", $_POST["mail"]);
echo "</div>";
// close #formData
?>

<br><br><a href="guestbook_add.php">Return to Form</a>

</div>

<hr />

<!-- ===================================================== -->
<!-- FOOTER -->

<?php 
include_once "includes/footer.php";
            <div class='col-sm-2'>
                <select id='user' name='user'>
                    <option selected='true' value='Select User' disabled>
                    Select User</option>;
                    <?php 
echo display_data('user', 'id', 'user_name');
?>
                </select>
            </div>
            <div class='col-sm-4'>
    
                    <select id='role' name='role'>
                        <option selected='true' value='select Role' disabled>
                        Select Role</option>;
                        <?php 
echo display_data('role', 'id', 'role');
?>
                    </select>
               
            </div>
        </div>
        <div class='row'>
            <div class='col-sm-4'></div>
            <div class='col-sm-4 admin_assign_role_user_info'><label id='user_info'>
            </label></div>
        </div>
        <div class='row'>
            <div class='col-sm-5'></div>
            <input id='assign_role' type='button' value='Assign'>
        </div>
        
Example #5
0
if ($_POST['region'] == "sport") {
    echo "<input type= 'radio' name= 'region' value = 'sport' checked> Sport";
} else {
    echo "<input type= 'radio' name= 'region' value = 'sport'> Sport";
}
if ($_POST['region'] == "team") {
    echo "<input type= 'radio' name= 'region' value = 'team' checked> Team";
} else {
    echo "<input type= 'radio' name= 'region' value = 'team'> Team";
}
if ($_POST['region'] == "game") {
    echo "<input type= 'radio' name= 'region' value = 'game' checked> Game";
} else {
    echo "<input type= 'radio' name= 'region' value = 'game'> Game";
}
?>
		</form>
	
		  <table class="table table-hover" width= "800" border ="2" cellpadding = "2" cellspacing = "2" >
          
           <?php 
if (isset($_POST['search'])) {
    display_data($link, $sql);
}
?>
         </table>
	  </div>
	</body>
</html>
<?php 
mysqli_close($link);
            <input type='submit' name='add_role' value='Add'>
            <input type='submit' name='delete_role' value='Delete'>
        </form>

        <h4>Action</h4>
        <form class='form-inline' action='admin_record_manipulation.php' method='post'>
            <select name='action'>
                <?php 
display_data('action', 'operation');
?>
            </select>
            <input type='text' name='action_type' value=''>
            <input type='submit' name='add_action' value='Add'>
            <input type='submit' name='delete_action' value='Delete'>
        </form>

        <h4>Resource </h4>
        <form action='admin_record_manipulation.php' method='post'>
            <select name='resource'>
                <?php 
display_data('resource', 'resource');
?>
            </select>
            <input type='text' name='resource_type' value=''>
            <input type='submit' name='add_resource' value='Add'>
            <input type='submit' name='delete_resource' value='Delete'>
        </form>
    </div>
</div>
<?php 
require 'footer.html';
Example #7
0
/**
 *
 */
function kuva_testid()
{
    if (empty($_SESSION["roll"]) || empty($_SESSION["user"])) {
        header("Location: ?mode=logisisse");
    } else {
        require_once 'view/head.php';
        global $connection;
        $sql = "SELECT * FROM markask_kysimustikud";
        $kysimustikud = get_data($sql, $connection);
        //kui tegu on tavakasutajaga, hakkame tema tulemusi kuvama
        if ($_SESSION["roll"] == "user") {
            //otsime praeguse kasutaja user_id üles
            $sql = "SELECT * FROM markask_kasutajad WHERE user='******' LIMIT 1";
            $user_id = mysqli_fetch_assoc(mysqli_query($connection, $sql))['id'];
            //käime iga küsimustiku läbi
            foreach ($kysimustikud as $kysimustik) {
                //prindime välja küsimustiku pealkirja
                echo "<h3>{$kysimustik["pealkiri"]}</h3>";
                //Otsime välja kasutaja tulemused, mis selle küsimustiku kohta on olemas
                $sql = "SELECT id as '#', millal_esitatud as 'Esitamise aeg', kaua_l2ks as 'Kulunud aeg', punkte as Tulemus, l2bitud as 'Läbitud' FROM markask_tulemused WHERE kasutajad_id='{$user_id}' AND kysimustikud_id='{$kysimustik['id']}'";
                $tulemused = get_data($sql, $connection);
                //prindime tulemused välja
                echo "<div id='tulemused'>";
                if (!empty($tulemused)) {
                    display_data($tulemused);
                } else {
                    echo "Sa ei ole veel seda testi teinud!";
                }
                echo "</div><br>";
                //anname nupu testile vastamiseks
                echo "<button type='button' onclick=\"location.href='?mode=kysimused&qid={$kysimustik['id']}'\">Vasta testile</button>";
            }
        } elseif ($_SESSION["roll"] == "admin") {
            $kysitluse_number = 1;
            //käime iga küsimustiku läbi
            foreach ($kysimustikud as $kysimustik) {
                //prindime välja küsimustiku pealkirja
                echo "<h3>Küsitlus nr. " . $kysitluse_number . ".: " . $kysimustik["pealkiri"] . "</h3>";
                $kysitluse_number++;
                //Otsime välja küsimused, mis selle küsimustiku kohta on olemas
                $sql = "SELECT id as '#', kysimus as 'Küsimus', max_punktid as 'Maksimum tulemus' FROM markask_kysimused WHERE kysimustik_id='{$kysimustik['id']}'";
                $tulemused = get_data($sql, $connection);
                //prindime tulemused välja
                echo "<div id='tulemused'>";
                display_data($tulemused);
                echo "</div>";
            }
            //siia tuleb tulevikus võimalus uusi küsimusi sisestada
            echo "<br><br><p style='font-size: small'>*Siia tuleb tulevikus võimalus lisada uusi küsitlusi ning küsimusi</p>";
        }
        require_once 'view/testid.php';
        require_once 'view/foot.html';
    }
}