Sunda Cyber Army


* Sunda Cyber Army 2k17 *
Indonesia Defacer ~


Path : /home/dent/studentexams/baerenst/
File Upload :
Current File : /home/dent/studentexams/baerenst/results.php

<?php

if(empty($_REQUEST['manufacturer'])) {
    echo "Please go through search page. (or redirect)";
    exit();
}

print_r($_REQUEST);

$host = "webdev.iyaclasses.com";
$userid = "dent_guest";
$userpw = "Acad276_Ttrojan_Dev2Ex@m";
$db = "dent_exam";

include '../pdloginvariables.php';

$mysql = new mysqli(
    $host,
    $userid,
    $userpw,
    $db
);

if($mysql->connect_errno) {
    echo "db connection error : " . $mysql->connect_error;
    exit();
}
?><!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Acad276 Practical Exam: Results</title>
    <style>
        .container {
            width:  600px;
            margin: auto;
        }
        h1 {
            margin: auto;
            text-align: center;
            background-color:   #900;
            color:  #FC0;
            height: 60px;
            line-height: 60px;
        }
        .num-results {
            margin: 20px 10px;
        }
        table {
            margin: auto;
            margin-bottom: 20px;
            width:  80%;
            border-collapse: collapse;
        }
        title {
            border: 1px solid #900;
            border-collapse: collapse;
            padding:    10px;
            text-align: center;
        }
        img {
            width: 100px;
        }
        .nav-link{
            margin: 10px 0px;
            font-size: 14px;
        }
    </style>
</head>
<body>
<div class="container">
    <h1>Mobile Device Database: Search Results</h1>
    <div class="nav-link">
        <a href="search.php"><< Back to Search Page</a>
    </div>
    <div class="num-results">
        <?php
        echo "<em>Your results returned <strong>" .
                $results->num_rows .
                "</strong> results.</em>";
        echo "<br><br>";
        ?>
    </div>

    <table>
        <?php

        $sql = 		"SELECT devices.*,
                    manufacturers.manufacturer,
                    systems.system,
                    types.type
            FROM devices, manufacturers, systems, types 
            WHERE devices.manufacturer_id = manufacturers.manufacturer_id
            AND devices.system_id = systems.system_id
            AND devices.type_id = types.type_id";
        $sql .= " AND name LIKE '%" .
            $_REQUEST['manufacturer'] . "%'";
        if($_REQUEST['manufacturer'] != "ALL") {
            $sql .= " AND manufacturer ='" . $_REQUEST["manufacturer"] . "'";
        }
        if($_REQUEST['system'] != "ALL") {
            $sql .=		" AND system = '" . $_REQUEST["system"] . "'";
        }
        if($_REQUEST['type'] != "ALL") {
            $sql .=		" AND type = '" . $_REQUEST["type"] . "'";
        }
        $sql .= " ORDER BY ". $_REQUEST['orderby'];

        $results = $mysql->query($sql);

        if(!$results) {
            echo "<hr>Your SQL:<br> " . $sql . "<br><br>";
            echo "SQL Error: " . $mysql->error . "<hr>";
            exit();
        }

        echo "<em>Your results returned <strong>" .
            $results->num_rows .
            "</strong> results.</em>";
        echo "<br><br>";

        while($currentrow = $results->fetch_assoc()) {
            echo "<div class='link''>" .
                "<a href='details.php?id=" .
                $currentrow["device_id"] .
                "'>" .
                "name" .
                "</a>" .
                "</div>" .
                "<div class='title'><strong>" .
                $currentrow['price'] .
                "</strong>" .
                "</a>" .
                " </div>" .
                "<div class='title'><strong>" .
                $currentrow['manufacturer'] .
                "</strong>" .
                "</a>" .
                " </div>" .
                "<div class='title'><strong>" .
                $currentrow['system'] .
                "</strong>" .
                "</a>" .
                " </div>" .
                "<div class='title'><strong>" .
                $currentrow['type'] .
                "</strong>" .
                " </div>" .

                "<br style='clear:both;'>";
        }
        ?>

 </table>
</div>
</body>
</html>