* Sunda Cyber Army 2k17 *
Indonesia Defacer ~
<!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;
}
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>
<?php
$mysql = new mysqli(
"webdev.iyaclasses.com",
"dent_guest",
"Acad276_Ttrojan_Dev2Ex@m",
"dent_exam"
);
if (! $_REQUEST['manufacturer_id']) {
echo "please search for a device manufacturer using the " . '<a href="search.php">Search Page</a>' . $mysql->connect_error;
exit();
}else{
if (! $_REQUEST['system_id']) {
echo "please search for a device system using the " . '<a href="search.php">Search Page</a>' . $mysql->connect_error;
exit();
}
}
if (! $_REQUEST['type_id']) {
echo "please search for a device type using the " . '<a href="search.php">Search Page</a>' . $mysql->connect_error;
exit();
}
if($mysql->connect_errno){
echo "DATABASE Connection Error: ";
echo $mysql->connect_error;
exit();
}else {
// echo "DB Connection Successful. <br><br>";
}
$sql = "SELECT devices.device_id,devices.name,price,manufacturer,systems.system_id,types.type_id,img_url,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";
//print ($sql);
if($_REQUEST["device_id"] != ""){
$sql .= " AND name LIKE '%'";
}
if($_REQUEST["manufacturer_id"] != "all"){
$sql .= " AND manufacturer = '" .$_REQUEST["manufacturer_id"]."'";
} else {
$sql .= " AND manufacturer LIKE '%'";
}
if($_REQUEST["system_id"] != "all") {
$sql .= " AND system = '" .$_REQUEST["system_id"] . "'";
} else {
$sql .= " AND system LIKE '%'";
}
if($_REQUEST["type_id"] != "all") {
$sql .= " AND type = '" .$_REQUEST["type_id"] . "'";
} else {
$sql .= " AND type LIKE '%'";
}
$results = $mysql->query($sql);
echo $mysql->error;
?>
<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
if (!empty($results->num_rows)){
echo "I found <strong> " . $results->num_rows . " </strong> records.";
}else{
echo "I found no records";
}
?>
</div>
<?php
$results = $mysql->query($sql);
while($currentrow = $results -> fetch_assoc()) {
echo "<table><tr>";
echo "<th><a href='details.php?id=" .
$currentrow["device_id"] . "'>" . $currentrow["name"] . "</th>";
echo "<th>" . $currentrow["manufacturer"] . "</strong></th>";
echo "<th>" . $currentrow["system"] . "</th>";
echo "<th>" . $currentrow["type"] . "</th>";
echo "</tr></table>";
}
?>
<!-- <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="details.php?id=10">Pixel</a></td>-->
<!-- <td>549.00</td>-->
<!-- <td>Google</td>-->
<!-- <td>Android</td>-->
<!-- <td>Smartphone</td>-->
<!-- </tr>-->
<!-- <tr>-->
<!-- <td><a href="details.php?id=11">Pixel 2</a></td>-->
<!-- <td>649.00</td>-->
<!-- <td>Google</td>-->
<!-- <td>Android</td>-->
<!-- <td>Smartphone</td>-->
<!-- </tr>-->
<!-- <tr>-->
<!-- <td><a href="details.php?id=12">Pixelbook</a></td>-->
<!-- <td>999.00</td>-->
<!-- <td>Google</td>-->
<!-- <td>Android</td>-->
<!-- <td>Laptop</td>-->
<!-- </tr>-->
<!-- </table>-->
</div>
</body>
</html>