Sunda Cyber Army


* Sunda Cyber Army 2k17 *
Indonesia Defacer ~


Path : /home/dent/public_html/exams/david/
File Upload :
Current File : /home/dent/public_html/exams/david/search.php

<?php
$DB_HOST = "webdev.iyaserver.com";
$DB_USER = "dent_test";
$DB_PASS = "Acad276_Ttrojan_Dev2Ex@m";
$DB_NAME = "dent_exam";

$conn = mysqli_connect($DB_HOST, $DB_USER, $DB_PASS, $DB_NAME);
if (!$conn) { die("DB connection error: " . mysqli_connect_error()); }

$os_rs = mysqli_query($conn, "SELECT system_id, system FROM os ORDER BY system");
if (!$os_rs) { die("SQL error (os): " . mysqli_error($conn)); }

$make_rs = mysqli_query($conn, "SELECT manufacturer_id, manufacturer FROM make ORDER BY manufacturer");

if (!$make_rs) { die("SQL error (make): " . mysqli_error($conn)); }

$type_rs = mysqli_query($conn, "SELECT type_id, type FROM devicetype ORDER BY type");
if (!$type_rs) { die("SQL error (type): " . mysqli_error($conn)); }
?>
<!DOCTYPE html>

<html>

<head lang="en">

    <meta charset="UTF-8">

    <title>Acad276 Practical Exam: Search</title>

    <style>

        h1 {

            margin: auto;

            text-align: center;

            background-color:   #900;

            color:  #FC0;

        //            height: 60px;

            line-height: 60px;

        }

        h2 {

            margin: auto;

            text-align: center;

            padding:  30px;

        }

        .container {

            width:  400px;

            margin: auto;

            border: 1px solid red;

        }

        .left-col, .right-col {

            float:  left;

            width:  100%;

            height: 280px;

            border: 1px solid #990000;

        }

        .label, .input {

            float:  left;

            width:  130px;

            margin: 3px;

        }

        .label {

            margin-left: 40px;

        }

        .input>input, .input>select {

            width:  100%;

        }

        .search-submit {

            margin-top: 20px;

            margin-left: 170px;

            width:  80px;

        }

    </style>

</head>

<body>

<div class="container">

    <h1>Mobile Devices Database</h1>

    <div class="left-col">

        <h2>Search the Database</h2>

        <form method="get" action="results.php">

            <div class="label">Device Name:</div>

            <div class="input">

                <input type="text" name="device_name"/>

            </div>

            <br clear="all"/>



            <div class="label">Manufacturer :</div>

            <div class="input">

                <select name="manufacturer_id">

                    <option value="all">All</option>

                    <?php while($r = mysqli_fetch_assoc($make_rs)) { ?>

                        <option value="<?php echo (int)$r['manufacturer_id']; ?>"><?php echo htmlspecialchars($r['manufacturer']); ?></option>

                    <?php } ?>

                </select>

            </div>

            <br clear="all"/>

            <div class="label">Operating System:</div>

            <div class="input">

                <select name="system_id">

                    <option value="all">All</option>

                    <?php while($r = mysqli_fetch_assoc($os_rs)) { ?>

                        <option value="<?php echo (int)$r['system_id']; ?>"><?php echo htmlspecialchars($r['system']); ?></option>

                    <?php } ?>

                </select>

            </div>

            <br clear="all"/>

            <div class="label">Type:</div>

            <div class="input">

                <select name="type_id">

                    <option value="all">All</option>

                    <?php while($r = mysqli_fetch_assoc($type_rs)) { ?>

                        <option value="<?php echo (int)$r['type_id']; ?>"><?php echo htmlspecialchars($r['type']); ?></option>

                    <?php } ?>

                </select>

            </div>

            <br clear="all"/>

            <input class="search-submit" type="submit" value="Search"/>

        </form>

    </div>

    <br clear="all"/>

</div>

</body>

</html>
<?php
mysqli_free_result($make_rs);
mysqli_free_result($os_rs);
mysqli_free_result($type_rs);
mysqli_close($conn);
?>