* Sunda Cyber Army 2k17 *
Indonesia Defacer ~
Path : /proc/self/cwd/ |
|
Current File : //proc/self/cwd/results_pagination.php |
<?php
if(empty($_REQUEST['genre'])) {
echo "Error. Please use the Search page.";
exit();
}
$host = "webdev.iyaserver.com";
$userid = "[youruserid]";
$userpw = "[yourpw]";
$db = "[database name]";
include '../pdloginvariables.php';
$mysql = new mysqli(
$host,
$userid,
$userpw,
$db
);
if($mysql->connect_errno) {
echo "db connection error : " . $mysql->connect_error;
exit();
}
?>
<html>
<head>
<title>Movie search</title>
<style>
body {
background-color: burlywood;
margin: 0 200px;
text-align: center;
}
#container {
padding: 30px;
margin-top: 100px;
background-color: olive;
width: 650px;
text-align: left;
color:white;
}
.label {
float:left;
clear:both;
width: 120px;
}
.title {
width: 500px;
clear:both;
float:left;
}
.link {
width: 100px;
float:left;
margin-left: 50px;
}
.thumb {
width: 40px; float:left;
}
</style>
</head>
<body>
<div id="container">
<h1> Search results<hr></h1>
<?php
$sql = "SELECT * FROM movieView2 WHERE title LIKE '%" .
$_REQUEST['title'] . "%' ";
if($_REQUEST['rating'] != "ALL") {
$sql .= " AND rating ='" . $_REQUEST["rating"] . "'";
}
if($_REQUEST['genre'] != "ALL") {
$sql .= " AND genre = '" . $_REQUEST["genre"] . "'";
}
$sql .= " ORDER BY ". $_REQUEST['orderby'];
$results = $mysql->query($sql);
if(!$results) {
echo "Your SQL: " . $sql . "<br><br>";
echo "SQL Error: " . mysqli_error($conn);
exit();
}
// echo "<em>You searched for Title: " . $_REQUEST['title'] . " and Rating: " . $_REQUEST['rating'] . " and Genre: " . $_REQUEST['genre'] . "</em>";
// echo "<br><br>";
// echo "<em>(SQL: " . $sql . "</em>)";
// echo "<br><br>";
$start = 1;
// adjust $start value for second, third, fourth set of records
if(!empty($_REQUEST["start"])) {
$start = $_REQUEST["start"];
}
$limit = 10;
$end = $start + $limit -1 ;
echo "<em>Your results returned <strong>" .
$results->num_rows .
"</strong> results.</em> Displaying records " ;
if($results->num_rows > $start+$limit) {
echo $start . " - " . ($start + $limit - 1) . ".";
} else {
echo $start . " - " . $results->num_rows . ".";
}
echo "<br><br>";
$counter = $start;
$results -> data_seek($start - 1);
while($currentrow = $results->fetch_assoc()) {
echo "<div class='title'><strong>" .
$counter . ") " .
$currentrow['title'] . " (record id " . $currentrow["dvd_title_id"] . ")" .
"</strong>".
" (<em>Rated " . $currentrow['rating'] . "</em>) </div>" .
"<br style='clear:both;'>";
$counter++;
if($counter > $end) {
break;
}
}
$formdata = "";
$formdata .= "title=" . $_REQUEST["title"];
$formdata .= "&genre=" . $_REQUEST["genre"];
$formdata .= "&rating=" . $_REQUEST["rating"];
$formdata .= "&orderby=" . $_REQUEST["orderby"];
// $formdata .= "&start=" . ($start+$limit);
echo "<hr>" . $formdata . "<hr>";
if($start > $limit) {
echo "<a href='results_pagination.php?" . $formdata .
"&start=" . ($start - $limit) . "'>Prev</a>";
}
echo " | ";
if($results->num_rows > $start+$limit) {
echo "<a href='results_pagination.php?" . $formdata .
"&start=" . ($start+$limit) . "'>Next</a>";
}
?>
<?php
echo "hello"
?>
<?= "hello" ?>
</div>
</body></html>