Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
ВКРб_09.03.01_РудоченкоСА.docx
Скачиваний:
0
Добавлен:
01.07.2025
Размер:
14.08 Mб
Скачать

Приложение б Исходный код Интернет-сайта

Папка lib, файл functions.php

<?php

$mysqli=false;

function connectDB(){ //подключение к БД

global $mysqli;

$mysqli = new mysqli ("localhost", "root", "","mydatabase");

$mysqli->query("SET NAMES 'cp1251'");

}

function closeDB() { //закрытие БД

global $mysqli;

$mysqli->close();

}

function getAllarticles(){ //выбрать все статьи из базы

global $mysqli;

connectDB();

$result_set=$mysqli->query("SELECT * FROM `articles`");

closeDB();

return resultSetToArray($result_set);

}

function resultSetToArray($result_set){ //вывести все статьи из базы

$array=array();

while (($row=$result_set->fetch_assoc())!=false)

$array[]=$row;

return $array;

}

function getArticle($id){ //выбрать статью

global $mysqli;

connectDB();

$result_set=$mysqli->query("SELECT * FROM `articles` WHERE `id`='$id'");

closeDB();

return $result_set->fetch_assoc();

}

function addUser($email,$password){ //регистрация пользователя

global $mysqli;

connectDB();

$success=$mysqli->query("INSERT INTO `users` (`email`,`password`) VALUES ('$email', '$password')");

closeDB();

return $success;

}

function checkUser($email,$password){ //проверка пользователя с БД

global $mysqli;

connectDB();

$result_set=$mysqli->query("SELECT * FROM `users` WHERE `email` = '$email' AND `password`='$password'");

closeDB();

if ($result_set->fetch_assoc()) return true;

else return false;

}

function searchArticles($words){ //поиск статьей

$query_search="";

$arraywords=explode(" ", $words);

foreach($arraywords as $key=>$value){

if (isset ($arraywords [$key-1])) $query_search .= " OR ";

$query_search .="(`full_text` LIKE '%$value%' OR `title` LIKE '%$value%')";

}

global $mysqli;

connectDB();

$result_set=$mysqli->query("SELECT * FROM `articles` WHERE $query_search");

closeDB();

return resultSetToArray($result_set);

}

function isAdmin($email){ //является ли пользователь администратором

global $mysqli;

connectDB();

$result_set =$mysqli->query("SELECT * FROM `users` WHERE `email` = '$email'");

$row = $result_set->fetch_assoc();

closeDB();

return $row["admin"];

} ?>

Корневая папка, файл style.css

*{margin: 0; padding:0;}

body{

background:#DCDCDC ;

}

.main{

width:1600px; margin:0 auto; /*смещение всей таблицы*/

}

.menu{

overflow:hidden;

height:50px;

background:BlueViolet;

list-style:none;

}

.menu li{

float:left; background:url(images/menu-bg.jpg) left center no-repeat; padding:10px 25px;

}

.menu li a{

font:20px "Century Gothic"; color:#fff; text-decoration:none; /*слова меню*/

}

.menu li a:hover{

font:10px "Century Gothic"; color:#fff; text-decoration:underline; /*подчеркивание */

}

.search{

float:right; margin: 0 25px 0 0;}

.search-txt{

position:relative; margin: 0 10px 0 0; top:10px; height:25px; background:#f7f7f7; border:1px solid #fff; width:300px; border-radius: 25px;} /*поиск */

.search-btn{

position:relative; margin: 0 10px 0 0; top:10px;

}

.content2 {

float:right; width: 249px;

}

.content {

float:left;

}

.content-main{

background:#f7f7f7; border:1px solid #fff; overflow:hidden;

width: 1600px;

border-radius: 25px;}

.content{

width: 1200px;

float:left; margin: 0 0 0 20px; padding-left: 200px; //расстояние таблицы со статьями

}

.post-main{

font: normal 17px Verdana; background:LightCyan; border:1px solid #e7e2e3; margin: 20px 0 20px 0;

border-radius: 8px;

}

.post-main h1 a{

font:bold 20px Century Gothic; color:#716b5b; text-decoration:none;margin: 0 0 0 20px;

}

.post-main p a{

font:normal 17px Century Gothic; color:#716b5b; margin:0 0 0 20px;

}

.post-main p {

font:normal 17px Century Gothic; color:#716b5b;margin:0 0 0 20px;

}

.post-main h1 a:hover{

font:normal 20px Century Gothic; color:#fff; text-decoration:none;margin:0 0 0 20px;

}

.post-main p a:hover{

font:normal 17px Century Gothic; color:#fff; text-decoration:none;margin:0 0 0 20px;

}

.post-main h1{ background:#e2e0e1; text-align:center;

} //прямоугольники

.sidebar{

float:right; width: 225px;

}

.vidget{

background:#e7e3e2; margin: 20px 20px 20px 0; border:3px solid #d7d3d4;

border-radius: 8px;}

.vidget h2{

background:#2f283f; color:white; font:25px "Century Gothic"; text-align:center; padding:5px 0;

border-radius: 8px;}

.vidget h1{

color:color:#000; font:17px "Century Gothic"; text-align:center; padding:5px 0;

border-radius: 8px;}

.vidget ul{

list-style:none; padding:25px 15px;

}

.vidget ul li{

border-bottom:1px solid #c8bbbd; border-top:1px solid white; color:black; font-family: "Century Gothic" padding: 5px 0 5px 20px;

}

.vidget ul li:first-child{

border-top:none;

}

.vidget ul li:last-child{

border-bottom:none;

}

.vidget li a{

font:normal 17px Century Gothic; color:#000; text-decoration:none;

}

.vidget li a:hover{

font:normal 17px Century Gothic; color:#fff; text-decoration:none;

}

.footer{

overflow:hidden; padding: 30px 25px;

}

.cpy{height:50px;

list-style:none;

/*шрифт нижней строки; */

float:right;margin:0 0 0 20px;

}

.cpy a{

font:normal 26px "Century Gothic"; color:#716b5b; text-decoration:none; margin:20px 10px 0 0;

}

.cpy a span{

color:#a73700;

}

.cpy p{ overflow:hidden;

font:14px Century Gothic; color:#716b5b; margin:10px 0 0 0;

}

.baner{

float:right; width: 225px;

}

.banername{

background:#e7e3e2; margin: 0 20px 20px 0; border:1px solid #d7d3d4;

border-radius: 8px;}

.banername h2{

background:IndianRed; color:white; font:18px "Century Gothic"; text-align:center; padding:5px 0;

border-radius: 8px;}

.banername ul{

list-style:none; padding:25px 15px;

}

.imgstyle{ margin: 0 20px 20px 0;}

Папка admin:

файл start.php:

<?php

session_start();

require_once "lib/functions.php";

if (!((checkUser($_SESSION["email"],$_SESSION["password"]) && isAdmin($_SESSION["email"])))){

header("Location: /admin/auth.php");

exit;

}

?>

<?php error_reporting(E_ALL ^ E_NOTICE); ?>

файл newarticle.php:

<?php

require_once "start.php";

if (isset($_POST["button_newarticle"]))

$success= addArticle($_POST["title"], $_POST["intro_text"], $_POST["full_text"]);

?>

<html>

<head>

<title>Добавление новой статьи</title>

<meta http-equip="Content-type" content="text/html; charset=1251"/>

<link rel="stylesheet" type="text/css" href="style.css"/>

</head>

<body>

<?php require_once "blocks/menu2.php";

if ($success) echo "Статья успешно добавлена.";

else if(isset($_POST["button_newarticle"])) echo"Ошибка!";

?>

<div>

<form name ="newarticle" method="post" action ="">

<p>

Название: <input type="text" name="title"/>

</p>

<div>

Вступление: <br/>

<textarea name ="intro_text" cols="40" rows ="10"></textarea>

</div>

<div>

Полный текст:<br/>

<textarea name="full_text" cols="40" rows ="10"></textarea>

</div>

<p>

<input type ="submit" name="button_newarticle" value="Добавить статью"/>

</p>

</form>

</div>

</body>

</html>

<?php

if ($success) echo "Статья успешно добавлена.";

else if(isset($_POST["button_newarticle"])) echo"Ошибка!";

?>

файл logout.php:

<?php

session_start();

unset($_SESSION["email"]);

unset($_SESSION["password"]);

header ("Location: ".$_SERVER["HTTP_REFERER"]);

exit;

?>

файл index.php:

<?php

require_once "start.php";

?>

<html>

<head>

<title>Admin-панель</title>

<meta http-equip="Content-type" content="text/html; charset=1251"/>

<link rel="stylesheet" type="text/css" href="style.css"/>

</head>

<body>

<?php require_once "blocks/menu.php"; ?>

</body>

</html>

файл auth.php:

<?php

session_start();

require_once "../lib/functions.php";

if ((checkUser($_SESSION["email"],$_SESSION["password"])) && isAdmin($_SESSION["email"])){

header("Location: /admin/index.php");

exit;}

else {

header("Location: /index.php");

exit;

}

?>

<html>

<head>

<title>Вход в Admin-панель</title>

<meta http-equip="Content-type" content="text/html; charset=1251"/>

<link rel="stylesheet" type="text/css" href="style.css"/>

</head>

<body>

<div>

<?php

if ($_SESSION["error_auth"]){

echo "Неверное имя или пароль!";

unset($_SESSION["error_auth"]);

}

else if ($_SESSION["email"]!=""){

echo "У Вас нет прав администратора!";

unset($_SESSION["email"]);

}

?>

<form name="auth" action="auth.php" method="post">

<p>

E-mail:<br/>

<input type="text" name="email" />

</p>

<p>

Пароль:<br/>

<input type="password" name="password" />

</p>

<p>

<input type ="submit" name="button_auth" value="Войти" />

<p>

</form>

</div>

</body>

</html>

файл auth.php:

Папка admin-blocks:

Файл menu.php:

<h1 id="header"> Admin-панель</h1>

<h2>Меню</h2>

<p>

<a href="newarticle.php"> Добавить новый блог</a>

</p>

<a href="logout.php">Выход</a>

Файл menu2.php:

<h1 id="header"> Admin-панель</h1>

<a href="logout.php">Выход</a>

Корневая папка:

файл start.php:

<?php

session_start();

require_once "lib/functions.php";

?>

файл search.php:

<?php

require_once "start.php";

?>

<html>

<head>

<title>Результаты поиска</title>

<meta http-equip="Content-type" content="text/html; charset=1251"/>

<link rel="stylesheet" type="text/css" href="style.css"/>

</head>

<body>

<div class="main">

<div class="head">

<h2>Ренден.РУ</h2>

</div>

<div class="content-main">

<?php

require_once "blocks/top.php";

?>

<div class="content">

<?php

require_once "blocks/search_result.php";

?>

</div>

<div class="content2">

</div> </div>

<?php

require_once "blocks/footer.php";

?>

</div>

</body>

</html>

файл reg.php:

<?php

require_once "start.php";

?>

<html>

<head>

<title>Регистрация</title>

<meta http-equip="Content-type" content="text/html; charset=1251"/>

<link rel="stylesheet" type="text/css" href="style.css"/>

</head>

<body>

<div class="main">

<div class="head">

<h2>Рендер.РУ</h2>

</div>

<div class="content-main">

<?php

require_once "blocks/top.php";

?>

<div class="content">

<?php

require_once "blocks/reg.php";

?>

<div class="content2">

<?php

require_once "blocks/enter.php";

?>

</div>

</div>

<div class="content2">

</div></div>

<?php

require_once "blocks/footer.php";

?>

</div>

</body>

</html>

файл index.php:

<?php

require_once "start.php";

?>

<html>

<head>

<title>3Ds Max</title>

<meta http-equip="Content-type" content="text/html; charset=1251"/>

<link rel="stylesheet" type="text/css" href="style.css"/>

</head>

<body>

<div class="main">

<div class="head">

<h2>Render.RU</h2>

</div>

<div class="content-main">

<?php

require_once "blocks/top.php";

?>

<div class="content">

<?php

require_once "blocks/main_article.php";

?>

</div>

</div>

<?php

require_once "blocks/footer.php";

?>

</div>

</body>

</html>

файл guestbook.php:

<?php

require_once "start.php";

?>

<html>

<head>

<title>Λθφενηθ 3D Max</title>

<meta http-equip="Content-type" content="text/html; charset=1251"/>

<link rel="stylesheet" type="text/css" href="style.css"/>

</head>

<body>

<div class="main">

<div class="head">

<h2>Πενδεπ.ΠΣ</h2>

</div>

<div class="content-main">

<?php

require_once "blocks/top.php";

?>

<div class="content">

<?php

require_once "blocks/guestbook.php";

?>

</div>

<div class="content2">

</div> </div>

<?php

require_once "blocks/footer.php";

?>

</div>

</body>

</html>

файл feedback.php:

<?php

require_once "start.php";

if ($_POST["button_feedback"]){

$to = "serflot7@gmail.com";

$subject = $_POST["subject"];

$message = $_POST["text"];

$headers = "From: '{$_POST["email"]}'\r\nContent-type: text/plain; charset=UTF-8 \r\n";

mail ($to, $subject, $message, $headers);

$alert="Ваше сообщение отправлено";

include "blocks/alert.php";

}

?>

<html>

<head>

<title>Обратная связь</title>

<meta http-equip="Content-type" content="text/html; charset=1251"/>

<link rel="stylesheet" type="text/css" href="style.css"/>

<style>

#message {

width: 200px; /* Ширина поля в пикселах */

height: 50px;

}

#subject {

width: 200px; /* Ширина поля в пикселах */

height: 50px;

}

#mail {

width: 200px; /* Ширина поля в пикселах */

height: 50px;

}

</style>

</head>

<body>

<div class="main">

<div class="head">

<h2>Рендер.РУ</h2>

</div>

<div class="content-main">

<?php

require_once "blocks/top.php";

?>

<div class="content">

<center><form name="feedback" action ="" method="POST">

<table>

<tr>

<td>Email:</td>

<td>

<input type="text" id="mail" name="email"/>

</td>

</tr>

<tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr>

<tr>

<td>Тема:</td>

<td>

<input type="text" id="subject" name="subject"/>

</td>

<tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr>

</tr>

<tr>

<td> Задать вопрос: </td>

<td>

<input type="text" id="message" name="text"/>

</td>

</tr>

<tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr>

<tr>

<td colspan="2">

<center><input type="submit" name="button_feedback" value="Отправить вопрос"/></center>

</td>

</tr>

</table>

</form></center>

</div>

<div class="content2">

</div></div>

<?php

require_once "blocks/footer.php";

?>

</div>

</body>

</html>

файл auth.php:

<?php

require_once "start.php";

$email=htmlspecialchars($_POST["email"]);

$password=htmlspecialchars($_POST["password"]);

$password=md5($password);

if(checkUser($email, $password)){

$_SESSION["email"]=$email;

$_SESSION["password"]=$password;

}

else $_SESSION["error_auth"]=1;

header("Location: ".$_SERVER["HTTP_REFERER"]);

exit;

?>

файл articles.php:

<?php

require_once "start.php";

?>

<html>

<head>

<title>Статьи</title>

<meta http-equip="Content-type" content="text/html; charset=1251"/>

<link rel="stylesheet" type="text/css" href="style.css"/>

</head>

<body>

<div class="main">

<div class="head">

<h2>Рендер.РУ</h2>

</div>

<div class="content-main">

<?php

require_once "blocks/top.php";

?>

<div class="content">

<?php

require_once "blocks/list_articles.php";

?>

</div>

<div class="content2">

</div> </div>

<?php

require_once "blocks/footer.php";

?>

</div>

</body>

</html>

файл article.php:

<?php

require_once "start.php";

$article =getArticle($_GET["id"]);

$id = $article["id"];

$title = $article["title"];

$full_text = $article["full_text"];

?>

<html>

<head>

<title>Статьи</title>

<meta http-equip="Content-type" content="text/html; charset=1251"/>

<link rel="stylesheet" type="text/css" href="style.css"/>

</head>

<body>

<div class="main">

<div class="head">

<h2>Рендер.РУ</h2>

</div>

<div class="content-main">

<?php

require_once "blocks/top.php";

?>

<div class="content">

<?php

require_once "blocks/full_article.php";

?>

</div>

<div class="content2">

</div></div>

<?php

require_once "blocks/footer.php";

?>

</div>

</body>

</html>

Папка blocks:

Файл user_panel.php:

<div class="sidebar">

<div class="vidget">

<h1>

<p>Пользователь: <b><?php echo $_SESSION["email"];?></b>

<br/>

<a href="blocks/logout.php">Выход</a>

</p>

</h1>

</div>

</div>

Файл top.php:

<ul class="menu">

<li> <a href="../index.php">Главная</a></li>

<li> <a href="reg.php">Регистрация</a></li>

<li><a href="../guestbook.php">MaxScript Автоматизация</a></li>

<li><a href="../articles.php">Блог</a></li>

<li><a href="../feedback.php">Обратная связь</a></li>

<form class="search" action="search.php" method="get">

<input type="text" class="search-txt" name="words" value="Поиск..."

onfocus="if(this.value=='Поиск...') this.value='';"

onblur="if(this.value=='') this.value='Поиск...';"/>

<input type="submit" class="search-btn" name="button_search" value="Найти" >

</form>

</ul>

Файл search_result.php:

<h2>Результаты поиска</h2>

<?php

if (($_GET["button_search"])&& (!empty($_GET["words"]))){

$words = htmlspecialchars($_GET["words"]);

$results = searchArticles($words);

if(count($results)!=0){

for ($i=0; $i<count($results); $i++){

$number =$i+1;

$link="article.php?id=".$results[$i]["id"];

$title=$results[$i]["title"];

include "search_item.php";

}

}

else {

echo "Ничего не найдено!";

echo '<center><p><img src="images/404.jpg" alt="Письма мастера дзен"></p>

</center> ';

}

}

else echo "Не задан поисковой запрос!";

?>

Файл search_item.php:

<p><?php echo $number;?>. <a href="<?php echo $link;?>"><?php echo $title;?></a></p>

<center><p><img src="images/uspex.jpg" alt="uspex.jpg"></p>

</center>

Файл reg.php:

<?php

if (!empty($_POST["button_reg"])) {

$email=htmlspecialchars($_POST["email"]);

$password_1=htmlspecialchars($_POST["password_1"]);

$password_2=htmlspecialchars($_POST["password_2"]);

if (strlen($email)<3) $success=false;

elseif (strlen($password_1) <3) $success=false;

elseif ($password_1 != $password_2) $success=false;

else $success=addUser($email,md5($password_1));

if (!$success) $alert="Ошибка при регистрации пользователя!";

else $alert="Вы успешно зарегистрировались!";

include "alert.php";

}

?>

<h2>Регистрация</h2>

<form name="reg" action ="" method="POST">

<table>

<tr>

<td>E-mail: </td>

<td>

<input type="text" name="email"/>

</td>

</tr>

<tr>

<td> Пароль: </td>

<td>

<input type="password" name="password_1"/>

</td>

</tr>

<tr>

<td>Подтвердите пароль: </td>

<td>

<input type="password" name="password_2"/>

</td>

</tr>

<tr>

<td colspan="2">

<input type="submit" name="button_reg" value="Зарегистрироваться"/>

</td>

</tr>

</table>

</form>

Файл main_article.php:

<div class="post-main">

<h1><a href="#">Настройка 3ds Max — начало работы </a></h1>

<div class="post">

<center> <img class="imgstyle" src="images/1.jpg" ></center>

Программа обладает огромным количеством параметров,

которые можно настроить на свой вкус и которые дают безграничный простор

для реализации любых идей пользователя, занявшегося трехмерной графикой и анимацией.

Хотя поначалу такая широта возможностей немного пугает.

У новичка буквально разбегаются глаза при виде бесчисленных кнопок, переключателей,

счетчиков и т.д. И так, в данном блоге вы научитесь разбираться с некоторыми тонкостями работы с 3ds Max.

Уже в первой стадии моделиро-вание нужно понимать, с чего начать ландшафтный дизайн. Как лучше поступить?

А лучше всего, чтобы делать сложные 3D объекты, нужно их делать по отдельности и совмещать в один проект.

Нужно прикинуть примерные размеры тех или иных объектов.

Первый делом всегда нужно поставить размеры объектов, в настройках единиц обычно выбирают миллиметры…

<p><a href="article.php?id=1">Читать далее</a></p>

</div>

</div>

Файл logout.php:

<?php

session_start();

unset($_SESSION["email"]);

unset($_SESSION["password"]);

header ("Location: ".$_SERVER["HTTP_REFERER"]);

exit;

?>

Файл list_articles.php:

<?php

$articles = getAllArticles();

for ($i=0; $i<count($articles); $i++){

$id=$articles[$i]["id"];

$title=$articles[$i]["title"];

$intro_text=$articles[$i]["intro_text"];

include "intro_article.php";

}

Файл intro_articles.php:

<div class="post-main">

<h1><a href="#"> <?php echo $title; ?> </a></h1>

<div class="post">

<center><img class="imgstyle" src="images/<?php echo $id; ?>.jpg" ><p></center>

<?php echo $intro_text; ?>

</p>

<p><a href="article.php?id=<?php echo $id; ?>"> читать далее</a></p>

</div>

</div>

Файл guestbook.php:

<center><h2> Скрипты для 3Ds Max и их применение</h2></center>

Все скрипты написаны студентом СевГУ Рудоченко С.А.

Каждый отдельный скрипт выполняет свою функцию и имеет свою уникальность.

Что бы открыть любой скрипт, нужно нажать на MaxScript, и дальше либо запустить, нажав на Run Script , либо

открыть и подредактировать нажав на Open Script.

<center><p><img src="images/script.jpg" alt="Script"></p>

</center>

1 - Первая ссылка на скачивание данного файла,

вы сможете управлять усточниками света Omni не переключаясь на другой экран в 3Ds Max.

Интерфейс выглидит следующим образом.

<center><p><img src="images/Omni.jpg" alt="Script"></p>

</center>

<p><center><a href="video/omni1-2.ms" download>Скачать файл</a></center>

<p>2 - Второй скрипт предназначен для перемещение стандартных объектов, а именно Box.

<p><center><a href="video/box1-4.ms" download>Скачать файл</a></center>

<p>3 - Третий скрипт предназначен больше всего для разработчиков игр, в основном работающие с блоками или создание трехмерной игры тетрис.

<p><center><a href="video/tetris.ms" download>Скачать файл</a></center>

<p>4 - Четвертый скрипт очень полезен для любых пользователей. Данный скрипт может удалять наложенную текстуру без

повреждения в Material Editor.

<p><center><a href="video/undefing.ms" download>Скачать файл</a></center>

<p><h3><center>Вашему вниманию предлагается посмотреть видео по созданию пользовательского скрипта. В данном видео уроке вы поймете тонкости создания пользовательского скрипта

с элементами создания кнопок и их программирования.</center></h3>

<p><center><video src="video/MaxScript.mp4" controls style="display: block; width: 960px; height: 512px;></video><c/enter>

Файл footer.php:

<div class="footer">

<div class="cpy">

<p> Владелец Рудоченко С.А. &copy 2017 ;"Система автоматизированного проектирования ландшафтного дизайна в 3ds Max"</p>

</div>

</div>

Файл auth_form.php:

<?php

if($_SESSION["error_auth"]){

unset($_SESSION["error_auth"]);

$alert="Неверные e-mail и/или пароль!";

include "alert.php";

}

?>

<form name="auth" action="auth.php" method="POST">

<div class="sidebar">

<div class="vidget">

<h1>

E-mail:<input type="text" style="width:174px; height:19px" name="email"/>

Пароль:<input type="password" style="width:174px; height:19px" name="password"/>

<input type="submit" style="width:174px; height:25px ; margin: 10px 0 20px 0;" name="button_auth" value="Войти">

</h1>

</div>

</div>

</form>