* Sunda Cyber Army 2k17 *
Indonesia Defacer ~
<?php
if(empty($_REQUEST['dent_id'])) {
echo "Please go through search page. (or redirect)," . "<a href =examsearch.php" . "> click me to be sent to the right place; Location: examsearch.php". "</a>";
exit();
}
$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!";}
$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();
}
$currentrow = $results->fetch_assoc();
echo "results:" . $results->num_rows . "<br>";
?>
<html>
<!-- ideally my detail pages links lol but i set up all the entries that ideally would appear when pressingt he device name in the result spage, so while the code is there i know that
my code is registering as if the user has not input any entries into the original form but there has been entires simply this page is not conencting to that-->
<head lang="en">
<meta charset="UTF-8">
<title>Acad276 Practical Exam: Details</title>
<style>
.container {
width: 800px;
margin: auto;
}
h1 {
margin: auto;
text-align: center;
background-color: #900;
color: #FC0;
height: 60px;
line-height: 60px;
}
.details {
border: 1px solid #990000;
width: 600px;
margin: auto;
margin-top: 20px;
padding: 20px;
}
table {
height: 300px;
width: 100%;
}
table img {
height: 300px;
}
img {
width: 300px;
}
.label {
text-align: right;
width: 20%;
padding: 3px 10px 3px;
}
.data {
width: 40%;
}
.input>input, .input>select {
width: 100%;
}
.nav-link{
margin: 10px 0px;
font-size: 14px;
}
</style>
</head>
<body>
<div class="container">
<h1>Mobile Device Database: Details Page</h1>
<div class="nav-link">
<a href="examsearch.php"><< Back to Search Page</a>
</div>
<div class="details">
<table>
<tr>
<td rowspan="5" class="img">
<img src="<?= $currentrow['img_url']?>" class="img"> <!-- attempt at the extra credit lol also below! i am assumign these entries would work as htey come intot he tables but becasue detiasl wouldnt present there was no way to test but neverthe less i still input into phph etc -->
</td>
<td class="label">Name:</td>
<td class="data"><strong><em> <?= $currentrow['device_name']; ?></em></strong></td>
</tr>
<tr>
<td class="label">Price:</td>
<td><strong><?= $currentrow['price']; ?> </strong></td>
</tr>
<tr>
<td class="label">Manufacturer:</td>
<td><?= $currentrow['manufacturer_id']; ?></td>
</tr>
<tr>
<td class="label">System:</td>
<td><?= $currentrow['system_id']; ?></td>
</tr>
<tr>
<td class="label">Type:</td>
<td><?= $currentrow['type_id']; ?></td>
</tr>
</table>
</div>
</div>
</body>
</html>