Файл: Разработка сайта библиотеки MyLibrary.pdf

ВУЗ: Не указан

Категория: Курсовая работа

Дисциплина: Не указана

Добавлен: 28.03.2023

Просмотров: 132

Скачиваний: 2

ВНИМАНИЕ! Если данный файл нарушает Ваши авторские права, то обязательно сообщите нам.

                    }

                }

                echo '</td>';

            }

            echo "</tr>";

        } else {

            $blresult = mysqli_query($connection, "SELECT * FROM `list`");

            $blrows = mysqli_num_rows($blresult);

            echo "<table border=1><tr><thead><th> id </th><th> Жанр </th><th> Название </th><th> Автор </th><th> Язык </th><th> Издание </th><th> Статус </th></thead></tr>";

            for ($i = 0 ; $i < $blrows ; ++$i) {

                $blrow = mysqli_fetch_row($blresult);

                echo "<tr>";

                for ($j = 0 ; $j < 6 ; ++$j) echo "<td>$blrow[$j]</td>";

                echo '<td>'.$blrow[6];

                if ($blrow[6] == 'В наличии') {

                    echo ' (<a href="add.php?id='.$blrow[0].'&from=librarian">забронировать</a>)';

                } else if ($blrow[6] == 'Забронирована') {

                    echo ' <a href="remove.php?id='.$blrow[0].'&from=librarian">(снять бронь)</a>';

                }

                if ($blrow[6] == 'Забронирована' || $blrow[6] == 'Выдана') {

                    $getreadlistsbooklist = mysqli_query($connection, "SELECT `uid`,`date` FROM readlists WHERE `bid`='$blrow[0]'");

                    $blreadlistsInfo = mysqli_fetch_array($getreadlistsbooklist);

                    $getUserBookInfo = mysqli_query($connection, "SELECT `login`,`name` FROM users WHERE `id`='$blreadlistsInfo[0]'");

                    $userBookInfo = mysqli_fetch_array($getUserBookInfo);

                    if ($userBookInfo[0] != NULL) {

                        echo ' (<a href="user.php?id='.$blreadlistsInfo[0].'">'.$userBookInfo[0].' / '.$userBookInfo[1].'</a> / '.$blreadlistsInfo[1].')';

                    }

                }

                echo '</td>';

            }

            echo "</tr>";

        }

        echo "</table>";

    }

    // ВЫВЕСТИ СПИСОК ПОЛЬЗОВАТЕЛЕЙ

    if (isset($_GET['userlist']) || isset($_GET['givebook']) || isset($_GET['removeuser'])) {

        echo '<div id="userlist"><h3>Список пользователей</h3>';

        $userlist = mysqli_query($connection, "SELECT `id`,`login`,`password`,`role`,`name`,`birthday`,`email`,`number`,`registered` FROM users");

        $rows = mysqli_num_rows($userlist);

        echo '<table border=1 width="100%"><tr><thead><th> id </th><th> Логин </th><th> Пароль </th><th> Роль </th><th> Имя </th><th> День рождения </th><th> Почта </th><th> Номер </th><th> Дата регистрации</th></thead></tr>';

        for ($i = 0 ; $i < $rows ; ++$i) {

            $row = mysqli_fetch_row($userlist);

            echo "<tr>";

            for ($j = 0 ; $j < 9 ; ++$j) echo "<td>$row[$j]</td>";

            echo '<td><a href="user.php?id='.$row[0].'">Профиль пользователя</a> / <a href="user.php?id='.$row[0].'&action=edit">редактировать</a></td>';


            echo "</tr>";

            }

        echo "</table>";

        echo '</div>';

    }

    echo '</div>';

    echo '<div class="requests">';

    // ВЫВЕСТИ СПИСОК ОБРАЩЕНИЙ

    if (isset($_GET['requests'])) {

        echo '<h2>Обращения читателей и гостей</h2>';

        $requests = mysqli_query($connection, "SELECT `id`,`login`,`name`,`email`,`number`,`title`,`request`,`date`,`status` FROM requests WHERE `status`='Рассматривается' OR `status`='Отправлено' ORDER BY `status` DESC");

        $rows = mysqli_num_rows($requests);

        if (isset($_POST['editrequeststatus'])) {

            $requeststatus = $_POST['editrequeststatus'];

            $requestid = $_POST['requestid'];

            $updaterequest = mysqli_query($connection, "UPDATE requests SET `status`='$requeststatus' WHERE `id`='$requestid'");

            header('Location: '.$currenturl);

        }

        for ($i = 0 ; $i < $rows ; ++$i) {

            $row = mysqli_fetch_row($requests);

            echo '<div id="requests"><h3>'.$row[5].' (отправлено '.$row[1].' '.$row[2].')</h3>';

            echo '<div class="info"><p>ID обращения: '.$row[0].'<br>E-mail: '.$row[3]. ' | Номер: '.$row[4].'<br>Дата обращения: '.$row[7].'</p></div>';

            echo '<p>'.$row[6].'</p>';

            echo '<p>Статус обращения: '.$row[8].'</p>';

            echo '<form action="librarian.php?requests=yes" method="post">

                    <p>Изменить статус обращения: 

                        <select name="editrequeststatus">

                            <option value="Отправлено">Отправлено</option>

                            <option value="Рассматривается">Рассматривается</option>

                            <option value="Закрыто">Закрыто</option>

                        </select>

                        <input name="requestid" type="hidden" value="'.$row[0].'">

                        <input type="submit" value="Изменить"></p></form>';

                        echo '</div>';

            }

    }

    // ВЫВЕСТИ СПИСОК ЗАКРЫТЫХ ОБРАЩЕНИЙ

    if (isset($_GET['oldrequests'])) {

        echo '<h2>Закрытые обращения читателей и гостей</h2>';

        $requests = mysqli_query($connection, "SELECT `id`,`login`,`name`,`email`,`number`,`title`,`request`,`date`,`status` FROM requests WHERE `status`='Закрыто' ORDER BY `id` DESC");

        $rows = mysqli_num_rows($requests);

        if (isset($_POST['editrequeststatus'])) {

            if ($_POST['editrequeststatus'] == 'Рассматривается') {

                $requeststatus = $_POST['editrequeststatus'];

                $requestid = $_POST['requestid'];

                $updaterequest = mysqli_query($connection, "UPDATE requests SET `status`='$requeststatus' WHERE `id`='$requestid'");

                header('Location: '.$currenturl);

            }

        }

        for ($i = 0 ; $i < $rows ; ++$i) {

            $row = mysqli_fetch_row($requests);


            echo '<div id="requests"><h3>'.$row[5].' (отправлено '.$row[1].' '.$row[2].')</h3>';

            echo '<div class="info"><p>ID обращения: '.$row[0].'<br>E-mail: '.$row[3]. ' | Номер: '.$row[4].'<br>Дата обращения: '.$row[7].'</p></div>';

            echo '<p>'.$row[6].'</p>';

            echo '<p>Статус обращения: '.$row[8].'</p>';

            echo '<form action="librarian.php?oldrequests=yes" method="post">

                    <p>Изменить статус обращения: 

                        <select name="editrequeststatus">

                            <option value="Закрыто">Закрыто</option>

                            <option value="Рассматривается">Рассматривается</option>

                        </select>

                        <input name="requestid" type="hidden" value="'.$row[0].'">

                        <input type="submit" value="Изменить"></p></form>';

                        echo '</div>';

            }

    }

    echo '</div>';

?>

<?php require('./includes/footer.html'); ?>

</body>

</html>

Main.css

p {

    font-family: Arial, Helvetica, sans-serif;

    font-size: 14px;

    letter-spacing: 0px;

    word-spacing: 0px;

    color: #000000;

    font-weight: 400;

    text-decoration: none;

    font-style: normal;

    font-variant: normal;

    text-transform: none;

    padding: 5px;

    line-height: 1.5;

}

.welcome a, .header a, footer a, .contacts a, address a {

    background: #fff;

}

a {

    font-family: Verdana, Geneva, sans-serif;

    font-size: 14px;

    letter-spacing: 0px;

    word-spacing: 0px;

    color: #000000;

    font-weight: 400;

    text-decoration: underline solid rgb(68, 68, 68);

    font-style: normal;

    font-variant: normal;

    text-transform: none;

}

a:hover {

    background: #C5C9ED; }

a:active {

    background: rgb(0, 123, 206);

    color: #fff; }

h1 {

    font-family: Georgia, serif;

    font-size: 24px;

    letter-spacing: 2px;

    word-spacing: 2px;

    color: #000000;

    font-weight: 700;

    text-decoration: none;

    font-style: normal;

    font-variant: normal;

    text-transform: none;

}

h2 {

    font-family: Georgia, serif;

    font-size: 20px;

    letter-spacing: 2px;

    word-spacing: 2px;

    color: #000000;

    font-weight: 700;

    text-decoration: none;

    font-style: normal;

    font-variant: normal;

    text-transform: none;

}

h3 {

    font-family: Georgia, serif;

    font-size: 16px;

    letter-spacing: 0px;

    word-spacing: 0.4px;

    color: #000000;

    font-weight: 700;

    text-decoration: none solid rgb(68, 68, 68);

    font-style: normal;

    font-variant: normal;

    text-transform: none;

}

h5 {

    font-family: Georgia, serif;

    font-size: 12px;

    letter-spacing: 0px;

    word-spacing: 0.4px;

    color: #7D7D7D;

    font-weight: 400;

    text-decoration: none solid rgb(68, 68, 68);

    font-style: normal;


    font-variant: normal;

    text-transform: none;

}

table {

    font-family: Verdana, Geneva, sans-serif;

    border: 2px solid #FFFFFF;

    text-align: center;

    border-collapse: collapse;

  }

  table td, table th {

    border: 1px solid #919191;

    padding: 4px 6px;

  }

  table tbody td {

    font-size: 13px;

  }

  table tr:nth-child(even) {

    background: #D0E4F5;

  }

  table td:nth-child(even) {

    background: #EBEBEB;

  }

  table thead {

    background: #FFFFFF;

    border-bottom: 4px solid #333333;

  }

  table thead th {

    font-size: 15px;

    font-weight: bold;

    color: #333333;

    text-align: center;

    border-left: 2px solid #333333;

  }

  table thead th:first-child {

    border-left: none;

  }

#welcome {

    display: block;

    width: 300px;

    padding-left: 20px;

    padding-right: 20px;

    padding-top: 15px;

    padding-bottom: 15px;

    margin-top: 15px;

    border: 2px solid #707070;

    text-align: center;

    position: relative;

    left: 50%;

    margin-right: -50%;

    transform: translate(-50%, 0);

}

nav {

    display: block;

    width: 100%;

    padding-top: 5px;

    padding-bottom: 5px;

    text-align: center;

    background: #C5C9ED;

}

nav a {

    padding: 5px;

}

input, textarea {

    border: 1px solid #707070;

    border-radius: 5px;

    padding: 5px;

    margin: 5px;

    -webkit-box-shadow: 5px 5px 0px 1px #9b9b9b; 

    box-shadow: 5px 5px 0px 1px #9b9b9b;

}

#checkbox input {

    border: 1px solid #707070;

    border-radius: 5px;

    padding: 5px;

    margin: 5px;

    -webkit-box-shadow: -10px 0px 13px -7px #000000, 10px 0px 13px -7px #000000, 5px 5px 0px 1px rgba(0,0,0,0); 

    box-shadow: -10px 0px 13px -7px #000000, 10px 0px 13px -7px #000000, 5px 5px 0px 1px rgba(0,0,0,0);

}

header {

    width: 800px;

    position: relative;

    left: 50%;

    margin-right: -50%;

    transform: translate(-50%, 0);

    height: 110px;

}

header .logotype {

    position: relative;

    float: left;

    padding-right: 15px;

}

header .sitename {

    position: relative;

    float: left;

}

header .contacts {

    position: relative;

    float: right;

}

footer {

    background: #C5C9ED;

    position: relative;

    left: 0; bottom: 0;

    width: 100%;

    height: 70px;

    padding-top: 10px;

    padding-bottom: 0px;

    margin-top: 25px;

    text-align: center;

}

footer a {

    background: #C5C9ED;

    padding: 10px;

}

select {

    border: 1px solid #707070;

    border-radius: 5px;

    padding: 5px;

    margin: 5px;

}

Index.css

#about {

    width: 1000px;

    position: relative;

    text-align: justify;

    left: 50%;

    margin-right: -50%;

    transform: translate(-50%, 0);

}

#about h2 {

    text-align: center;

}

#information {

    background: #8ec6c5;

}

#information p, #information h2, #information a {

    color: #142850;

}

.center {

    width: 1000px;

    position: relative;

    text-align: center;

    left: 50%;

    margin-right: -50%;


    transform: translate(-50%, 0);

}

#events {

    width: 1000px;

    position: relative;

    text-align: justify;

    left: 50%;

    margin-right: -50%;

    transform: translate(-50%, 0);

}

#events h1 {

    text-align: center;

    font-size: 20px;

}

.newsblock {

    border-bottom: 1px solid #8ec6c5;

}

#events h2 {

    background: #8ec6c5;

    color: #142850;

}

.eventDate {

    float: right;

}

.newsblock a {

    text-align: center;

}

#contacts {

    width: 1000px;

    position: relative;

    text-align: center;

    left: 50%;

    margin-right: -50%;

    transform: translate(-50%, 0);

}

Login.css

#loginform {

    position: relative;

    width: 430px;

    left: 50%;

    margin-right: -50%;

    transform: translate(-50%, 0);

    border-left: 1px solid #8ec6c5;

    border-right: 1px solid #8ec6c5;

    border-bottom: 1px solid #8ec6c5;

    background: #e8ecec;

}

#loginform input {

    width: 400px;

}

#loginform h1 {

    text-align: center;

    background: #8ec6c5;

    color: #142850;

}

#loginform p {

    font-size: 14pt;

}

News.css

.news {

    width: 1000px;

    position: relative;

    text-align: justify;

    left: 50%;

    margin-right: -50%;

    transform: translate(-50%, 0);

}

.eventDate {

    float: right;

}

.container {

    border-bottom: 1px solid #8ec6c5;

}

Contacts.css

#contacts {

    width: 1000px;

    position: relative;

    text-align: center;

    left: 50%;

    margin-right: -50%;

    transform: translate(-50%, 0);

}

#forms {

    width: 1000px;

    position: relative;

    text-align: justify;

    left: 50%;

    margin-right: -50%;

    transform: translate(-50%, 0);

}

#form input, #form textarea {

    width: 100%;

}

input {

    text-align: center;

    width: 200px;

}

User.css

#userinfo {

    width: 1000px;

    position: relative;

    text-align: justify;

    left: 50%;

    margin-right: -50%;

    transform: translate(-50%, 0);

    border-bottom: 1px solid #8ec6c5;

}

#userinfo p {

    line-height: 2;

}

.parameter {

    font-weight: bolder;

    display: block;

    float: left;

    width: 150px;

}

#readlist {

    width: 1000px;

    position: relative;

    text-align: justify;

    left: 50%;

    margin-right: -50%;

    transform: translate(-50%, 0);

}

Librarian.css

#addnewsform, #removenewsform, #addbookform, #givebookform, #editbookform, #getbookform, #removebookform, #adduserform, #removeuserform {

    float: left;

    position: relative;

    padding: 15px;

    margin: 20px;

    border: 1px solid #8ec6c5;

    width: 400px;

}

#addnewsform input, #removenewsform input, #addbookform input, #givebookform input, #editbookform input, #getbookform input, #removebookform input, #adduserform input, #removeuserform input {

    width: 370px;

}

textarea {

    width: 370px;

}

#booklist, #userlist {

    position: relative;

    clear: both;

}

.requests {

    width: 1000px;

    position: relative;

    text-align: justify;

    left: 50%;

    margin-right: -50%;

    transform: translate(-50%, 0);