Sunda Cyber Army


* Sunda Cyber Army 2k17 *
Indonesia Defacer ~


Path : /home/dent/public_html/demo8a/
File Upload :
Current File : /home/dent/public_html/demo8a/count.php

<?php

?>
<html>
<head>
    <title>Movie counts</title>
    <style>
        body {
            background-color: burlywood;
            margin: 0 20px;
            text-align: center;
        }

        #container {
            padding: 30px;
            background-color: olive;
            text-align: left;
            color:white;
        }

        .label {
            float:left;
            clear:both;
            width: 70px;
            font-style: italic;
        }
        .box {
            float:left;  text-align:right;
            height: 20px; width: 200px; margin: 5px;
        }
        .bar {
            background-color: red; min-width: 30px;
        }

    </style>
</head>
<body>
<div id="container">
    <h1>Movie totals<hr></h1>

<?php

$host = "webdev.iyaserver.com";
$userid = "[youruserid]";
$userpw = "[yourpw]";
$db = "[database name]";

include '../pdloginvariables.php';

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

if(mysqli_connect_errno()) {
    echo "Failed to connect to mySql: " . mysqli_connect_errno();
    exit();
}

$sql1 = 		"SELECT count(*) as movietotal
FROM dvd_titles";

$sql2 = 		"SELECT genre, count(*) as genretotal
FROM dvd_titles, genres
WHERE dvd_titles.genre_id = genres.genre_id 
GROUP BY genre
ORDER BY genre";

$results1 = mysqli_query($conn, $sql1);

if(!$results1) {
 	echo "Your SQL: " . $sql . "<br><br>";
    echo "SQL Error: " . mysqli_error($conn);
    exit();
}

$record = mysqli_fetch_array($results1);

$results2 = mysqli_query($conn, $sql2);

if(!$results2) {
    echo "Your SQL: " . $sql . "<br><br>";
    echo "SQL Error: " . mysqli_error($conn);
    exit();
}

echo "Total number of movies: " . $record["movietotal"] . "<br><br>";

echo "Total numbe of movies by genre:" . "<br>";

while($currentrow = mysqli_fetch_array($results2)) {

    echo $currentrow['genre'] . ": " . $currentrow['genretotal'] . " | ";
}

echo "<br><br>Totals visualized...<br><br>";

mysqli_data_seek ($results2, 0);

while($currentrow = mysqli_fetch_array($results2)) {
    echo "<div class='box'>".$currentrow['genre'] . ":</div>";
    echo "<div class='box bar' style='width:" .$currentrow['genretotal'] . "px'> </div>";
    echo  $currentrow['genretotal'];
    echo "<br style='clear:both'>";

}
?>

<!--
<style>
    .box {
        float:left;  text-align:right;
        height: 20px; width: 200px; margin: 5px;
    }
    .bar {
        background-color: red; min-width: 30px;
    }
</style>
    <div class='box'>GENRE:</div>
    <div class='box bar' style='width:100px'>&nbsp;</div>
    123  <br style='clear:both'>
-->

<style>
    .box {
        float:left;  text-align:right;
        height: 20px; width: 200px; margin: 5px;
    }
    .bar {
        background-color: red; min-width: 30px;
    }
</style>

    <div class='box'>GENRE:</div>
    <div class='box bar' style='width:100px'>&nbsp;</div>
    123<br style='clear:both'>

</body></html>