Курсовые - Электронная энциклопедия компьютерных игр

Приложение А. Листинг программы

<?php

if ($_POST["submit"])

{

    include("/include/db_connect.php");

    mysql_query("INSERT INTO list_games(category_id, name, image, mini_desp, desp, date)

                VALUES(

                    '".$_POST["category"]."',

                    '".$_POST["name"]."',

                    '".$_POST["upload_image"]."',

                    '".$_POST["mini_desp"]."',

                    '".$_POST["desp"]."',

                    NOW()

                    )",$link);

    $id = mysql_insert_id();

    if (empty($_POST["upload_image"]))

    {

        include("/include/upload-image.php");

        unset($_POST["upload_image"]);

    }

    mysql_close();

    header('Location: index.php');

    exit;

}

?>

<!doctype html>

<html lang="en">

<head>

    <meta charset="utf-8">

    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <meta name="description" content="">

    <meta name="author" content="">

    <link rel="icon" href="">

 

    <title>Электронная энциклопедия компьютерных игр</title>

 

    <!-- Bootstrap core CSS -->

    <link href="/dist/css/bootstrap.min.css" rel="stylesheet">

 

    <!-- Custom styles for this template -->

    <link href="/dist/css/album.css" rel="stylesheet">

 

    <style type="text/css">

        .link_game {

            text-decoration: none;

            color: #6c757d;

        }

 

        .link_game:hover {

            text-decoration: none;

            color: #ffffff;

        }

    </style>

 

</head>

 

 

<body>

 

<header>

    <div class="collapse bg-dark" id="navbarHeader">

        <div class="container">

            <div class="row">

                <div class="col-sm-8 col-md-7 py-4">

                    <h4 class="text-white">О проекте</h4>

                    <p class="text-muted">Данный проект призван размещать на своих страницах только самую свежую информацию о жизне компьютерных игр. Электронная энциклопедия компьютерных игр подразумевает создание некой концпеции, которой будут придерживаться современные геймеры.</p>

                </div>

                <div class="col-sm-4 offset-md-1 py-4">

                    <h4 class="text-white">Игры для ПК</h4>

                    <ul class="list-unstyled">

 

                        <?php

 

                        $link=mysqli_connect("localhost", "root", "root", "pc-games");

                        $result = mysqli_query($link,"SELECT id, name FROM category");

 

                        If (mysqli_num_rows($result) > 0)

                        {

                            $row = mysqli_fetch_array($result);

                            do

                            {

                        echo '

                        <li><a href="content.php?id='.$row["id"].'" class="text-white">'.$row["name"].'</a></li>

                        ';

                        } while ($row = mysqli_fetch_array($result));

                        echo'

                        </ul>

                        ';

                        }

 

                        ?>

 

                    </ul>

                </div>

            </div>

        </div>

    </div>

    <div class="navbar navbar-dark bg-dark box-shadow">

        <div class="container d-flex justify-content-between">

            <a href="#" class="navbar-brand d-flex align-items-center">

                <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="mr-2"><path d="M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"></path><circle cx="12" cy="13" r="4"></circle></svg>

                <strong>Электронная энциклопедия компьютерных игр</strong>

            </a>

            <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarHeader" aria-controls="navbarHeader" aria-expanded="false" aria-label="Toggle navigation">

                <span class="navbar-toggler-icon"></span>

            </button>

        </div>

    </div>

</header>

 

<main role="main">

 

    <section class="jumbotron text-center">

        <div class="container">

            <h1 class="jumbotron-heading">ИГРЫ ДЛЯ ПК</h1>

            <p class="lead text-muted">Один из способов забыть о боли, это погрузиться во что-нибудь с головой, и это — компьютерные игры.</p>

            <p>

                <a href="info.php" class="btn btn-primary my-2">Подробнее о проекте</a>

                <a href="index.php" class="btn btn-secondary my-2">Перейти на главную</a>

            </p>

        </div>

    </section>

 

    <div class="album py-5 bg-light">

        <div class="container">

 

            <div class="row">

 

 

            <?php

 

            $link=mysqli_connect("localhost", "root", "root", "pc-games");

            $result = mysqli_query($link,"SELECT * FROM list_games ORDER BY id DESC");

 

 

            If (mysqli_num_rows($result) > 0)

            {

            $row = mysqli_fetch_array($result);

 

            do

            {

            if  (strlen($row["image"]) > 0 && file_exists("./uploads_images/".$row["image"]))

            {

                $img_path = './uploads_images/'.$row["image"];

                $max_width = 500;

                $max_height = 300;

                list($width, $height) = getimagesize($img_path);

                $ratioh = $max_height/$height;

                $ratiow = $max_width/$width;

                $ratio = min($ratioh, $ratiow);

                // New dimensions

                $width = intval($ratio*$width);

                $height = intval($ratio*$height);

            }else

            {

                $img_path = "";

                $width = auto;

                $height = auto;

            }

 

 

            echo '

 

 

            <div class="col-md-4">

                <div class="card mb-4 box-shadow">

                    <img class="card-img-top" src="'.$img_path.'" data-src="" alt="">

                    <div class="card-body">

                        <p class="card-text">'.$row["mini_desp"].'</p>

                        <div class="d-flex justify-content-between align-items-center">

                            <div class="btn-group">

                                <button type="button" class="btn btn-sm btn-outline-secondary"><a class="link_game" href="game_content.php?id='.$row["id"].'">Подробнее</a></button>

                                <button type="button" class="btn btn-sm btn-outline-secondary"><a class="link_game" href="game_content.php?id='.$row["id"].'">Отзывы</a></button>

                            </div>

                            <small class="text-muted">'.$row["date"].'</small>

                        </div>

                    </div>

                </div>

            </div>

            ';

 

                } while ($row = mysqli_fetch_array($result));

                    echo'

            </ul>

            ';

            }

 

 

            ?>

 

 

            </div>

        </div>

    </div>

 

 

    <div class="container containerform">

 

        <form class="well form-horizontal" enctype="multipart/form-data" method="post">

            <fieldset>

 

                <!-- Form Name -->

                <legend class="text-center">Добавление новой компьютерной игры</legend>

 

 

                <!-- Select input-->

                <div class="form-group">

                    <label class="col-md-4 control-label">Статус игры</label>

                    <div class="col-md-4 inputGroupContainer">

                        <div class="input-group">

                            <?php

                            include('/include/db_connect.php');

                            $query = 'SELECT * FROM category';

                            $result = mysql_query ( $query ) or die ( 'Query failed: ' . mysql_error ( ) );

                            echo "<select class='form-control' name=category>";

 

                            while ( $line = mysql_fetch_array ( $result, MYSQL_ASSOC ) ) {

                                echo '<option value="' . $line [ 'id' ] . '">' . $line [ 'name' ] . "</option>";

                            }

                            echo "</select>";

                            ?>

                        </div>

                    </div>

                </div>

 

                <!-- Text input-->

                <div class="form-group">

                    <label class="col-md-4 control-label">Название</label>

                    <div class="col-md-4 inputGroupContainer">

                        <div class="input-group">

                            <span class="input-group-addon"><i class="glyphicon glyphicon-pencil"></i></span>

                            <input name="name" placeholder="Заголовок" class="form-control" type="text">

                        </div>

                    </div>

                </div>

 

                <!-- Text input-->

                <div class="form-group">

                    <label class="col-md-4 control-label" >Обложка</label>

                    <div class="col-md-4 inputGroupContainer">

                        <div class="input-group">

                            <span class="input-group-addon"><i class="glyphicon glyphicon-picture"></i></span>

                            <input type="hidden" name="MAX_FILE_SIZE" class="form-control" value="5000000"/>

                            <input type="file" name="upload_image" class="form-control"/>

                        </div>

                    </div>

                </div>

 

                <!-- Text area -->

                <div class="form-group">

                    <label class="col-md-4 control-label">Краткое описание</label>

                    <div class="col-md-4 inputGroupContainer">

                        <div class="input-group">

                            <span class="input-group-addon"><i class="glyphicon glyphicon-pencil"></i></span>

                            <textarea class="form-control" name="mini_desp" placeholder="Краткое описание игры" rows="10" cols="45" style="resize: none;"></textarea>

                        </div>

                    </div>

                </div>

 

                <!-- Text area -->

                <div class="form-group">

                    <label class="col-md-4 control-label">Полное описание</label>

                    <div class="col-md-4 inputGroupContainer">

                        <div class="input-group">

                            <span class="input-group-addon"><i class="glyphicon glyphicon-pencil"></i></span>

                            <textarea class="form-control" name="desp" placeholder="Полное описание игры" rows="10" cols="45" style="resize: none;"></textarea>

                        </div>

                    </div>

                </div>

 

                <!-- Button -->

                <div class="form-group">

                    <label class="col-md-4 control-label"></label>

                    <div class="col-md-4 text-center">

                        <input type="submit" class="btn btn-warning" id="submit" name="submit" value="Добавить"/>

                    </div>

                </div>

 

            </fieldset>

        </form>

    </div>

 

 

</main>

 

<footer class="text-muted">

    <div class="container">

        <p class="float-right">

            <a href="#">Вернуться вверх</a>

        </p>

        <p>2018 &copy; Лучшие компьютерные игры.</p>

        <p>Электронная энциклопедия компьютерных игр.</p>

    </div>

</footer>

 

<!-- Bootstrap core JavaScript

================================================== -->

<!-- Placed at the end of the document so the pages load faster -->

<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>

<script>window.jQuery || document.write('<script src="/assets/js/vendor/jquery-slim.min.js"><\/script>')</script>

<script src="/assets/js/vendor/popper.min.js"></script>

<script src="/dist/js/bootstrap.min.js"></script>

<script src="/assets/js/vendor/holder.min.js"></script>

</body>

</html>

 

<?php

if ($_POST["submit"])

{

    include("/include/db_connect.php");

    mysql_query("INSERT INTO list_games(category_id, name, image, mini_desp, desp, date)

                VALUES(

                    '".$_POST["category"]."',

                    '".$_POST["name"]."',

                    '".$_POST["upload_image"]."',

                    '".$_POST["mini_desp"]."',

                    '".$_POST["desp"]."',

                    NOW()

                    )",$link);

    $id = mysql_insert_id();

    if (empty($_POST["upload_image"]))

    {

        include("/include/upload-image.php");

        unset($_POST["upload_image"]);

    }

    mysql_close();

    header('Location: index.php');

    exit;

}

?>

<!doctype html>

<html lang="en">

<head>

    <meta charset="utf-8">

    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <meta name="description" content="">

    <meta name="author" content="">

    <link rel="icon" href="">

 

    <title>Электронная энциклопедия компьютерных игр</title>

 

    <!-- Bootstrap core CSS -->

    <link href="/dist/css/bootstrap.min.css" rel="stylesheet">

 

    <!-- Custom styles for this template -->

    <link href="/dist/css/album.css" rel="stylesheet">

 

    <style type="text/css">

        .link_game {

            text-decoration: none;

            color: #6c757d;

        }

 

        .link_game:hover {

            text-decoration: none;

            color: #ffffff;

        }

    </style>

 

</head>

 

 

<body>

 

<header>

    <div class="collapse bg-dark" id="navbarHeader">

        <div class="container">

            <div class="row">

                <div class="col-sm-8 col-md-7 py-4">

                    <h4 class="text-white">О проекте</h4>

                    <p class="text-muted">Данный проект призван размещать на своих страницах только самую свежую информацию о жизне компьютерных игр. Электронная энциклопедия компьютерных игр подразумевает создание некой концпеции, которой будут придерживаться современные геймеры.</p>

                </div>

                <div class="col-sm-4 offset-md-1 py-4">

                    <h4 class="text-white">Игры для ПК</h4>

                    <ul class="list-unstyled">

 

                        <?php

 

                        $link=mysqli_connect("localhost", "root", "root", "pc-games");

                        $result = mysqli_query($link,"SELECT id, name FROM category");

 

                        If (mysqli_num_rows($result) > 0)

                        {

                            $row = mysqli_fetch_array($result);

                            do

                            {

                                echo '

                        <li><a href="content.php?id='.$row["id"].'" class="text-white">'.$row["name"].'</a></li>

                        ';

                            } while ($row = mysqli_fetch_array($result));

                            echo'

                        </ul>

                        ';

                        }

 

                        ?>

 

                    </ul>

                </div>

            </div>

        </div>

    </div>

    <div class="navbar navbar-dark bg-dark box-shadow">

        <div class="container d-flex justify-content-between">

            <a href="#" class="navbar-brand d-flex align-items-center">

                <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="mr-2"><path d="M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"></path><circle cx="12" cy="13" r="4"></circle></svg>

                <strong>Электронная энциклопедия компьютерных игр</strong>

            </a>

            <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarHeader" aria-controls="navbarHeader" aria-expanded="false" aria-label="Toggle navigation">

                <span class="navbar-toggler-icon"></span>

            </button>

        </div>

    </div>

</header>

 

<main role="main">

 

    <section class="jumbotron text-center">

        <div class="container">

            <h1 class="jumbotron-heading">ИГРЫ ДЛЯ ПК</h1>

            <p class="lead text-muted">Один из способов забыть о боли, это погрузиться во что-нибудь с головой, и это — компьютерные игры.</p>

            <p>

                <a href="#" class="btn btn-primary my-2">Подробнее о проекте</a>

                <a href="index.php" class="btn btn-secondary my-2">Перейти на главную</a>

            </p>

        </div>

    </section>

 

    <div class="album py-5 bg-light">

        <div class="container">

 

            <div class="row">

 

 

            <p style="text-align: justify">

                PC-Games — это проект о компьютерных играх. Сайт предлагает своим посетителям самые свежие новости игрового мира, обзоры и анонсы популярных игр,

                подробную энциклопедию, охватывающую свыше 29 тысяч наименований, а также коды, видеоролики, спецматериалы и многое другое.

            </p>

 

            <p style="text-align: justify">

 

                Увлекаюсь играми с 2015 года, когда получила в подарок Dendy. Убежденный программист.

                Стараюсь уделять внимание всем ААА-новинкам, но особый трепет испытываю перед спортсимами, онлайн-шутерами и иммерсив РПГ. Также не дурак в тактику и стратегии, начиная от Героев, Эпохи Империй и Цивы, и заканчивая XCOM и всякими ККИ.

                Игрой 2016 года считаю Firewatch.

            </p>

 

            <p style="text-align: justify">

                <span style="font-weight: bold;">РЕДАКТОР - СТУДЕНТ БГУИР</span> <br/>

                <span style="font-weight: bold;">Недобой Анастасия Александровна</span> <br/>

            </p>

 

            </div>

        </div>

    </div>

 

 

 

 

</main>

 

<footer class="text-muted">

    <div class="container">

        <p class="float-right">

            <a href="#">Вернуться вверх</a>

        </p>

        <p>2018 &copy; Лучшие компьютерные игры.</p>

        <p>Электронная энциклопедия компьютерных игр.</p>

    </div>

</footer>

 

<!-- Bootstrap core JavaScript

================================================== -->

<!-- Placed at the end of the document so the pages load faster -->

<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>

<script>window.jQuery || document.write('<script src="/assets/js/vendor/jquery-slim.min.js"><\/script>')</script>

<script src="/assets/js/vendor/popper.min.js"></script>

<script src="/dist/js/bootstrap.min.js"></script>

<script src="/assets/js/vendor/holder.min.js"></script>

</body>

</html>

 

<?php

$id = $_GET['id'];

?>

<!doctype html>

<html lang="en">

<head>

    <meta charset="utf-8">

    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <meta name="description" content="">

    <meta name="author" content="">

    <link rel="icon" href="">

 

    <title>Электронная энциклопедия компьютерных игр</title>

 

    <!-- Bootstrap core CSS -->

    <link href="/dist/css/bootstrap.min.css" rel="stylesheet">

 

    <!-- Custom styles for this template -->

    <link href="/dist/css/album.css" rel="stylesheet">

 

    <style type="text/css">

        .link_game {

            text-decoration: none;

            color: #6c757d;

        }

 

        .link_game:hover {

            text-decoration: none;

            color: #ffffff;

        }

    </style>

 

</head>

 

<body>

 

<header>

    <div class="collapse bg-dark" id="navbarHeader">

        <div class="container">

            <div class="row">

                <div class="col-sm-8 col-md-7 py-4">

                    <h4 class="text-white">О проекте</h4>

                    <p class="text-muted">Данный проект призван размещать на своих страницах только самую свежую информацию о жизне компьютерных игр. Электронная энциклопедия компьютерных игр подразумевает создание некой концпеции, которой будут придерживаться современные геймеры.</p>

                </div>

                <div class="col-sm-4 offset-md-1 py-4">

                    <h4 class="text-white">Игры для ПК</h4>

                    <ul class="list-unstyled">

 

                        <?php

 

                        $link=mysqli_connect("localhost", "root", "root", "pc-games");

                        $result = mysqli_query($link,"SELECT id, name FROM category");

 

                        If (mysqli_num_rows($result) > 0)

                        {

                            $row = mysqli_fetch_array($result);

                            do

                            {

                                echo '

                        <li><a href="content.php?id='.$row["id"].'" class="text-white">'.$row["name"].'</a></li>

                        ';

                            } while ($row = mysqli_fetch_array($result));

                            echo'

                        </ul>

                        ';

                        }

 

                        ?>

 

                    </ul>

                </div>

            </div>

        </div>

    </div>

    <div class="navbar navbar-dark bg-dark box-shadow">

        <div class="container d-flex justify-content-between">

            <a href="#" class="navbar-brand d-flex align-items-center">

                <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="mr-2"><path d="M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"></path><circle cx="12" cy="13" r="4"></circle></svg>

                <strong>Электронная энциклопедия компьютерных игр</strong>

            </a>

            <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarHeader" aria-controls="navbarHeader" aria-expanded="false" aria-label="Toggle navigation">

                <span class="navbar-toggler-icon"></span>

            </button>

        </div>

    </div>

</header>

 

<main role="main">

 

    <section class="jumbotron text-center">

        <div class="container">

            <h1 class="jumbotron-heading">ИГРЫ ДЛЯ ПК</h1>

            <p class="lead text-muted">Один из способов забыть о боли, это погрузиться во что-нибудь с головой, и это — компьютерные игры.</p>

            <p>

                <a href="info.php" class="btn btn-primary my-2">Подробнее о проекте</a>

                <a href="index.php" class="btn btn-secondary my-2">Перейти на главную</a>

            </p>

        </div>

    </section>

 

    <div class="album py-5 bg-light">

        <div class="container">

 

            <div class="row">

 

 

                <?php

 

                $link=mysqli_connect("localhost", "root", "root", "pc-games");

                $result = mysqli_query($link,"SELECT * FROM list_games WHERE category_id = $id ORDER BY id DESC");

 

 

                If (mysqli_num_rows($result) > 0)

                {

                    $row = mysqli_fetch_array($result);

 

                    do

                    {

                        if  (strlen($row["image"]) > 0 && file_exists("./uploads_images/".$row["image"]))

                        {

                            $img_path = './uploads_images/'.$row["image"];

                            $max_width = 500;

                            $max_height = 300;

                            list($width, $height) = getimagesize($img_path);

                            $ratioh = $max_height/$height;

                            $ratiow = $max_width/$width;

                            $ratio = min($ratioh, $ratiow);

                            // New dimensions

                            $width = intval($ratio*$width);

                            $height = intval($ratio*$height);

                        }else

                        {

                            $img_path = "";

                            $width = auto;

                            $height = auto;

                        }

 

 

                        echo '

 

 

            <div class="col-md-4">

                <div class="card mb-4 box-shadow">

                    <img class="card-img-top" src="'.$img_path.'" data-src="" alt="">

                    <div class="card-body">

                        <p class="card-text">'.$row["mini_desp"].'</p>

                        <div class="d-flex justify-content-between align-items-center">

                            <div class="btn-group">

                                <button type="button" class="btn btn-sm btn-outline-secondary"><a class="link_game" href="game_content.php?id='.$row["id"].'">Подробнее</a></button>

                                <button type="button" class="btn btn-sm btn-outline-secondary">Отзывы</button>

                            </div>

                            <small class="text-muted">'.$row["date"].'</small>

                        </div>

                    </div>

                </div>

            </div>

            ';

 

                    } while ($row = mysqli_fetch_array($result));

                    echo'

            </ul>

            ';

                }

 

 

                ?>

 

 

            </div>

        </div>

    </div>

 

 

</main>

 

<footer class="text-muted">

    <div class="container">

        <p class="float-right">

            <a href="#">Вернуться вверх</a>

        </p>

        <p>2018 &copy; Лучшие компьютерные игры.</p>

        <p>Электронная энциклопедия компьютерных игр.</p>

    </div>

</footer>

 

<!-- Bootstrap core JavaScript

================================================== -->

<!-- Placed at the end of the document so the pages load faster -->

<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>

<script>window.jQuery || document.write('<script src="/assets/js/vendor/jquery-slim.min.js"><\/script>')</script>

<script src="/assets/js/vendor/popper.min.js"></script>

<script src="/dist/js/bootstrap.min.js"></script>

<script src="/assets/js/vendor/holder.min.js"></script>

</body>

</html>

 

<?php

$id = $_GET['id'];

?>

<?php

if ($_POST["submit"])

{

    include("/include/db_connect.php");

    mysql_query("INSERT INTO reviews_game(game_id, name, comment, date)

                VALUES(

                    '".$_GET['id']."',

                    '".$_POST["name"]."',

                    '".$_POST["comment"]."',

                    NOW()

                    )",$link);

    mysql_close();

    header('Location: game_content.php?id='.$_GET['id'].'');

    exit;

}

?>

<!doctype html>

<html lang="en">

<head>

    <meta charset="utf-8">

    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <meta name="description" content="">

    <meta name="author" content="">

    <link rel="icon" href="">

 

    <title>Электронная энциклопедия компьютерных игр</title>

 

    <!-- Bootstrap core CSS -->

    <link href="/dist/css/bootstrap.min.css" rel="stylesheet">

 

    <!-- Custom styles for this template -->

    <link href="/dist/css/album.css" rel="stylesheet">

 

    <style type="text/css">

        .link_game {

            text-decoration: none;

            color: #6c757d;

        }

 

        .link_game:hover {

            text-decoration: none;

            color: #ffffff;

        }

    </style>

 

</head>

 

 

<body>

 

<header>

    <div class="collapse bg-dark" id="navbarHeader">

        <div class="container">

            <div class="row">

                <div class="col-sm-8 col-md-7 py-4">

                    <h4 class="text-white">О проекте</h4>

                    <p class="text-muted">Данный проект призван размещать на своих страницах только самую свежую информацию о жизне компьютерных игр. Электронная энциклопедия компьютерных игр подразумевает создание некой концпеции, которой будут придерживаться современные геймеры.</p>

                </div>

                <div class="col-sm-4 offset-md-1 py-4">

                    <h4 class="text-white">Игры для ПК</h4>

                    <ul class="list-unstyled">

 

                        <?php

 

                        $link=mysqli_connect("localhost", "root", "root", "pc-games");

                        $result = mysqli_query($link,"SELECT id, name FROM category");

 

                        If (mysqli_num_rows($result) > 0)

                        {

                            $row = mysqli_fetch_array($result);

                            do

                            {

                                echo '

                        <li><a href="content.php?id='.$row["id"].'" class="text-white">'.$row["name"].'</a></li>

                        ';

                            } while ($row = mysqli_fetch_array($result));

                            echo'

                        </ul>

                        ';

                        }

 

                        ?>

 

                    </ul>

                </div>

            </div>

        </div>

    </div>

    <div class="navbar navbar-dark bg-dark box-shadow">

        <div class="container d-flex justify-content-between">

            <a href="#" class="navbar-brand d-flex align-items-center">

                <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="mr-2"><path d="M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"></path><circle cx="12" cy="13" r="4"></circle></svg>

                <strong>Электронная энциклопедия компьютерных игр</strong>

            </a>

            <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarHeader" aria-controls="navbarHeader" aria-expanded="false" aria-label="Toggle navigation">

                <span class="navbar-toggler-icon"></span>

            </button>

        </div>

    </div>

</header>

 

<main role="main">

 

    <section class="jumbotron text-center">

        <div class="container">

            <h1 class="jumbotron-heading">ИГРЫ ДЛЯ ПК</h1>

            <p class="lead text-muted">Один из способов забыть о боли, это погрузиться во что-нибудь с головой, и это — компьютерные игры.</p>

            <p>

                <a href="info.php" class="btn btn-primary my-2">Подробнее о проекте</a>

                <a href="index.php" class="btn btn-secondary my-2">Перейти на главную</a>

            </p>

        </div>

    </section>

 

    <div class="album py-5 bg-light">

        <div class="container">

 

            <div class="row">

 

 

                <?php

 

                $link=mysqli_connect("localhost", "root", "root", "pc-games");

                $result = mysqli_query($link,"SELECT * FROM list_games WHERE id = '$id' ORDER BY id DESC");

 

 

                If (mysqli_num_rows($result) > 0)

                {

                    $row = mysqli_fetch_array($result);

 

                    do

                    {

                        if  (strlen($row["image"]) > 0 && file_exists("./uploads_images/".$row["image"]))

                        {

                            $img_path = './uploads_images/'.$row["image"];

                            $max_width = 500;

                            $max_height = 300;

                            list($width, $height) = getimagesize($img_path);

                            $ratioh = $max_height/$height;

                            $ratiow = $max_width/$width;

                            $ratio = min($ratioh, $ratiow);

                            // New dimensions

                            $width = intval($ratio*$width);

                            $height = intval($ratio*$height);

                        }else

                        {

                            $img_path = "";

                            $width = auto;

                            $height = auto;

                        }

 

 

                        echo '

 

            <div class="col-md-2"></div>

            <div class="col-md-8">

                <center><h1 class="card-text">'.$row["name"].'</h1></center>

                <div class="card mb-8 box-shadow">

                    <img class="card-img-top" src="'.$img_path.'" data-src="" alt="">

                    <div class="card-body">

                        <p class="card-text">'.$row["desp"].'</p>

                        <div class="d-flex justify-content-between align-items-center">

                            <small class="text-muted">Дата размещения записи: '.$row["date"].'</small>

                        </div>

                    </div>

                </div>

                <center><a href="include/delete-games.php?id='.$row["id"].'">Удалить</a></center>

            </div>

            <div class="col-md-2"></div>

            ';

 

            } while ($row = mysqli_fetch_array($result));

            echo'

            </ul>

            ';

                }

 

 

                ?>

 

 

            </div>

        </div>

    </div>

 

 

 

    <div class="container containerform">

 

        <form class="well form-horizontal" enctype="multipart/form-data" method="post">

            <fieldset>

 

                <!-- Form Name -->

                <legend class="text-center">Отзывы</legend>

 

 

                <!-- Text input-->

                <div class="form-group">

                    <label class="col-md-4 control-label">Имя</label>

                    <div class="col-md-4 inputGroupContainer">

                        <div class="input-group">

                            <span class="input-group-addon"><i class="glyphicon glyphicon-pencil"></i></span>

                            <input name="name" placeholder="Имя" class="form-control" type="text">

                        </div>

                    </div>

                </div>

 

                <!-- Text area -->

                <div class="form-group">

                    <label class="col-md-4 control-label">Комментарий</label>

                    <div class="col-md-4 inputGroupContainer">

                        <div class="input-group">

                            <span class="input-group-addon"><i class="glyphicon glyphicon-pencil"></i></span>

                            <textarea class="form-control" name="comment" placeholder="Комментарий" rows="10" cols="45" style="resize: none;"></textarea>

                        </div>

                    </div>

                </div>

 

                <!-- Button -->

                <div class="form-group">

                    <label class="col-md-4 control-label"></label>

                    <div class="col-md-4 text-center">

                        <input type="submit" class="btn btn-warning" id="submit" name="submit" value="Отправить"/>

                    </div>

                </div>

 

            </fieldset>

        </form>

 

 

        <?php

 

        $link1=mysqli_connect("localhost", "root", "root", "pc-games");

        $result1 = mysqli_query($link1,"SELECT * FROM reviews_game WHERE game_id = '$id' ORDER BY id DESC");

 

 

        If (mysqli_num_rows($result1) > 0)

        {

            $row1 = mysqli_fetch_array($result1);

 

            do

            {

 

            echo '

            <div class="col-md-12">

 

                <div class="card mb-12 box-shadow">

                    <div class="card-body">

                        <h5 class="card-text">'.$row1["name"].'</h5>

                        <p class="card-text">'.$row1["comment"].'</p>

                        <div class="d-flex justify-content-between align-items-center">

                            <small class="text-muted">Дата размещения комментария: '.$row1["date"].'</small>

                        </div>

                    </div>

                </div>

                <center><a href="include/delete-reviews.php?id='.$row1["id"].'">Удалить</a></center>

            </div>

            ';

 

            } while ($row1 = mysqli_fetch_array($result1));

            echo'

            </ul>

            ';

        }

 

 

        ?>

 

    </div>

 

 

</main>

 

<footer class="text-muted">

    <div class="container">

        <p class="float-right">

            <a href="#">Вернуться вверх</a>

        </p>

        <p>2018 &copy; Лучшие компьютерные игры.</p>

        <p>Электронная энциклопедия компьютерных игр.</p>

    </div>

</footer>

 

<!-- Bootstrap core JavaScript

================================================== -->

<!-- Placed at the end of the document so the pages load faster -->

<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>

<script>window.jQuery || document.write('<script src="/assets/js/vendor/jquery-slim.min.js"><\/script>')</script>

<script src="/assets/js/vendor/popper.min.js"></script>

<script src="/dist/js/bootstrap.min.js"></script>

<script src="/assets/js/vendor/holder.min.js"></script>

</body>

</html>

Количество комментариев: 0

Для того, чтобы оставить коментарий необходимо зарегистрироваться