* Sunda Cyber Army 2k17 *
Indonesia Defacer ~
<?php
if(empty($_REQUEST['system_id'])){
echo "Error, please fill out every form";
exit();
}
$host = "webdev.iyaclasses.com";
$userid = "dent_guest";
$userpw = "Acad276_Ttrojan_Dev2Ex@m";
$db = "dent_exam";
$mysql = new mysqli(
$host,
$userid,
$userpw,
$db
);
if($mysql->connect_errno) {
echo "db connection error : " . $mysql->connect_error;
exit();
}
$sql = "Select device_id, name, price, img_url, manufacturer, system, type From devices, manufacturers, systems, types Where ";
$sql .= "manufacturers.manufacturer_id = devices.manufacturer_id
AND
systems.system_id = devices.system_id
And
types.type_id = devices.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 .= "type_id = '". $_REQUEST['type_id']."'";
}
$results = $mysql->query($sql);
if(!$results){
echo "Sql error". $mysql->error;
exit();
} else{
echo "good results";
}
?>
<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>
<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 "Your search returned ".$results->num_rows." results.";
?>
</div>
<table>
<tr>
<th></th>
<th>Price</th>
<th>Manufacturer</th>
<th>System</th>
<th>Type</th>
</tr>
<!--
****** SAMPLE OUTPUT ROW ******
-->
<tr>
<?php
while($currentrow = $results->fetch_assoc()){
echo "<td><a href='details.php?id='".$currentrow["device_id"]."'>".$currentrow['name']."</a></td>";
echo "<td>".$currentrow['price']."</td>";
echo "<td>".$currentrow['manufacturer']."</td>";
echo "<td>".$currentrow['system']."</td>";
echo "<td>".$currentrow['type']."</td>";
}
?>
</table>
</div>
</body>
</html>