Sunda Cyber Army


* Sunda Cyber Army 2k17 *
Indonesia Defacer ~


Path : /home/dent/.trash/
File Upload :
Current File : /home/dent/.trash/results.php

<?php

if(empty($_REQUEST["title"])) {
    echo "Please enter a title."
}
if(empty($_REQUEST["genre"])) {
    echo "Please go through the <a href='search.php'>search<a/> page.";
    exit();
}

print_r($_REQUEST);
echo "<br>" . $_REQUEST["title"];




/* Part 1 -- get the data
    1. Create db connection
    1a. Check if db connection is good/bad
    )
    2. Write a sql query (to submit to db3. Submit sql to db, save in a variable
    3a. Check if returned results are bad

  Part 2 -- display the data
   1. Display any meta data, like how many record (num_rows)
   2. Loop through data to output
*/

$host = "webdev.iyaclasses.com";
$userid = "dent";
$userpw = "";
$db = "dent_dvd";
include  "../pdloginvariables.php";

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

if($mysql->connect_errno) {
    echo "Connection ERROR: " . $mysql->connect_error;
    exit();
} else {
    echo "Db connection is good";
}

// SQL CHANGES
$sql = "SELECT * FROM movieView WHERE  title LIKE '%" .
    $_REQUEST["title"] . "%'";

if(     $_REQUEST["genre"] != 'Any'    ) {
    $sql = $sql . " AND genre = '" . $_REQUEST["genre"] . "'";
}
echo "<br>" . $sql;

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

if(!$results) {
    echo "SQL ERROR: <br>" . $mysql->error . "<br>" . $sql;
    exit();
} else {
    echo "DB query successful!";
}

echo "You returned ". $results->num_rows . " records.<br>";

while($currentrow = $results->fetch_assoc()) {
    // OUTPUT CHANGE
    //    print_r($currentrow);
    echo "<div class='title'>" .
        $currentrow["title"] .
        " Rated " .
        $currentrow["rating"] .
    "</div>";
//    echo "<br>";
}