Sunda Cyber Army


* Sunda Cyber Army 2k17 *
Indonesia Defacer ~


Path : /home/dent/public_html/exams2025/venus/
File Upload :
Current File : /home/dent/public_html/exams2025/venus/examresult.php

<?php
var_dump($_REQUEST);
//*midterm study notes & per study guide
$host ="webdev.iyaserver.com"; //creatign connection to the database + details
$userid="dent_test";
$userpw="Acad276_Ttrojan_Dev2Ex@m";
$db ="dent_exam";



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

if ($mysql -> connect_errno)
{
    echo "<hr>db error: " . $mysql -> connect_error;
    exit();
} else
{echo " all is good!";}

$Device = $_REQUEST['device_name'];
$Manufacturer = $_REQUEST['manufacturer_id'];
$OPSystem = $_REQUEST['system_id'];
$Type = $_REQUEST['type_id'];

//here is my sql query while i am getting outputs the putputs are in its pk/fk satus only numbers so the results are correct but imply numbers and of course a user doesnt want to see that but rather the rel names so that would be another error to correct
$sql = 		"SELECT * FROM device, os, make, devicetype
             WHERE device.manufacturer_id = make.manufacturer_id
AND device.system_id = os.system_id
AND device.type_id = devicetype.type_id
";

if($_REQUEST['device_name'] != "") {
    $sql .= " AND name LIKE '%" . $_REQUEST["device_name"] . "%'";
}

if($_REQUEST['manufacturer_id'] != "ALL") {
    $sql .=		" AND manufacturer_id = '" . $_REQUEST["manufacturer_id"] . "'";
}

if($_REQUEST['system_id'] != "ALL") {
    $sql .=		" AND system_id = '" . $_REQUEST["system_id"] . "'";
}

if($_REQUEST['type_id'] != "ALL") {
    $sql .=		" AND type_id = '" . $_REQUEST["type_id"] . "'";
}

echo "<hr>". $sql . "<hr>";

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

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


while($currentrow = $results->fetch_assoc()) {


        //ideally my results here would display In the table div style for this exam BUTTTT it keeps breaking so i am keepign it here for now
    echo "<div><strong>Manufacturer:</strong> " . $currentrow['manufacturer_id'] . "</div>";
    echo "<div><strong>OP System:</strong> " . $currentrow['system_id'] . "</div>";
    echo "<div><strong>Type:</strong> " . $currentrow['type_id'] . "</div>";






    echo "<hr></div>";
}

?>

<html>

<head lang="en">

    <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;

        }

        th, td {

            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="examsearch.php"><< Back to Search Page</a>

    </div>

    <div class="num-results">

        <?php
        echo "<em>Your results returned <strong>" .
            $results->num_rows .
            "</strong> result(s)</em>"
            . " matching the Device Name: " . $_REQUEST["device_name"] . ", Manufacturer: " . $_REQUEST["manufacturer_id"] . " , OP System: " . $_REQUEST["system_id"] . " , Type: " . $_REQUEST["type_id"] . ".<br>";


        ?>



    </div>



    <table>

        <tr>

            <th>Name</th>

            <th>Price</th>

            <th>Manufacturer</th>

            <th>System</th>

            <th>Type</th>

        </tr>



        <!--

        ****** SAMPLE OUTPUT ROW ******

        -->



        <tr>

            <td><a href="examdetails.php?device_id="> pixels </a></td>

            <td> <?php   echo $currentrow['price'];  //ideally this wouldnt display null of course so that would be an error to fix ?></td>


            <!-- as stated before the php code for these entries are above andf not in the systel div because once opsitioned there, the code returns as error array so i would rather have a result presented without systel than nothing  -->

            <td>Google</td>

            <td>Android</td>

            <td>Smartphone</td>

        </tr>




    </table>

</div>

</body>












</html>