Initial & last commit

This commit is contained in:
cuqmbr 2022-02-22 12:00:53 +02:00 committed by GitHub
parent dd72c4795c
commit 26205df4cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 1949 additions and 0 deletions

180
bills.sql Normal file
View File

@ -0,0 +1,180 @@
-- phpMyAdmin SQL Dump
-- version 4.9.7deb1
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Aug 05, 2021 at 02:05 PM
-- Server version: 8.0.26-0ubuntu0.21.04.3
-- PHP Version: 7.4.16
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `bills`
--
-- --------------------------------------------------------
--
-- Table structure for table `Books`
--
CREATE TABLE `Books` (
`book_id` int NOT NULL,
`owner_id` int DEFAULT NULL,
`account` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`name` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`adress` varchar(255) COLLATE utf8_bin DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8_bin;
--
-- Dumping data for table `Books`
--
INSERT INTO `Books` (`book_id`, `owner_id`, `account`, `name`, `adress`) VALUES
(8, 6, '00000295', 'Газ', 'Ул. Шевченко'),
(10, 6, '149', 'Вода', 'Ул. Шевченко'),
(23, 21, 'хз', 'Свет', 'Шевченко'),
(24, 21, 'хз', 'Свет', 'Шевченко'),
(36, 19, '10810', 'Водоснабжение', 'Титова'),
(37, 19, '6263', 'Газоснабжение', 'Титова'),
(38, 19, '770333066', 'Электроенегрия', 'Титова'),
(42, 19, '1', 'Кавун', '1'),
(43, 19, '1', 'Дыня', '1');
-- --------------------------------------------------------
--
-- Table structure for table `Receipts`
--
CREATE TABLE `Receipts` (
`receipt_id` int NOT NULL,
`book_id` int DEFAULT NULL,
`start_date` date DEFAULT NULL,
`final_date` date DEFAULT NULL,
`start_num` int DEFAULT NULL,
`final_num` int DEFAULT NULL,
`rate` float DEFAULT NULL,
`comment` varchar(255) COLLATE utf8_bin DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8_bin;
--
-- Dumping data for table `Receipts`
--
INSERT INTO `Receipts` (`receipt_id`, `book_id`, `start_date`, `final_date`, `start_num`, `final_num`, `rate`, `comment`) VALUES
(47, 8, '2021-07-19', '2021-08-16', 1111, 1121, 8.99, 'Благодарю'),
(57, 24, '2021-06-21', '2021-07-21', 4200, 4300, 1.68, ''),
(90, 37, '2021-05-01', '2021-05-31', 2422, 2429, 8.99, ''),
(91, 37, '2021-06-01', '2021-06-30', 2429, 2436, 8.99, ''),
(92, 38, '2021-05-01', '2021-05-31', 18688, 18965, 1.68, ''),
(94, 38, '2021-06-01', '2021-06-30', 18965, 19260, 1.68, ''),
(96, 36, '2021-05-01', '2021-05-31', 1064, 1074, 2.17, ''),
(97, 36, '2021-06-01', '2021-06-30', 1074, 1086, 2.17, ''),
(101, 37, '2021-07-01', '2021-07-31', 2436, 2443, 8.99, ''),
(106, 38, '2021-07-01', '2021-07-31', 19260, 19550, 1.68, ''),
(108, 8, '2021-08-03', '2021-06-30', 12, 18, 8, ''),
(109, 10, '2021-06-01', '2021-06-30', 12, 15, 22, ''),
(110, 42, '2021-07-01', '2021-07-31', 0, 100, 3.99, ''),
(111, 43, '2021-06-01', '2021-06-30', 0, 100, 4, '');
-- --------------------------------------------------------
--
-- Table structure for table `Users`
--
CREATE TABLE `Users` (
`user_id` int NOT NULL,
`create_time` datetime DEFAULT CURRENT_TIMESTAMP,
`username` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`email` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`password` varchar(128) COLLATE utf8_bin DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8_bin;
--
-- Dumping data for table `Users`
--
INSERT INTO `Users` (`user_id`, `create_time`, `username`, `email`, `password`) VALUES
(6, '2021-07-19 13:32:44', 'tatyana', 'email@gmail.com', 'password hash'),
(19, '2021-07-20 21:33:35', 'Данил', 'dr.juniorf@gmail.com', '$2y$10$pvUpTNEwt$@#@35sdfAwtvhSJcCSMcSsadfhg..UK.GnTd6vhzGg6ZJsdfhAigJU7GjjPqpEkzuB3G'),
(21, '2021-07-21 11:47:47', 'Aliona', 'lola.lolina96@gmail.com', '$2y$10$Dbxo42/yRcikL1TudfsjdfgjASDFX2tSK.SFG.aTasdfSBRqmTEjKU5nVkASDFHSDGJuYTeFLywV/Z3dY4ca');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `Books`
--
ALTER TABLE `Books`
ADD PRIMARY KEY (`book_id`),
ADD KEY `owner_id` (`owner_id`);
--
-- Indexes for table `Receipts`
--
ALTER TABLE `Receipts`
ADD PRIMARY KEY (`receipt_id`),
ADD KEY `Receipts_ibfk_1` (`book_id`);
--
-- Indexes for table `Users`
--
ALTER TABLE `Users`
ADD PRIMARY KEY (`user_id`),
ADD UNIQUE KEY `email` (`email`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `Books`
--
ALTER TABLE `Books`
MODIFY `book_id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=44;
--
-- AUTO_INCREMENT for table `Receipts`
--
ALTER TABLE `Receipts`
MODIFY `receipt_id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=112;
--
-- AUTO_INCREMENT for table `Users`
--
ALTER TABLE `Users`
MODIFY `user_id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=22;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `Books`
--
ALTER TABLE `Books`
ADD CONSTRAINT `Books_ibfk_1` FOREIGN KEY (`owner_id`) REFERENCES `Users` (`user_id`) ON DELETE CASCADE;
--
-- Constraints for table `Receipts`
--
ALTER TABLE `Receipts`
ADD CONSTRAINT `Receipts_ibfk_1` FOREIGN KEY (`book_id`) REFERENCES `Books` (`book_id`) ON DELETE CASCADE;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

95
book.php Normal file
View File

@ -0,0 +1,95 @@
<?php
session_start();
include('head.php');
include('connection.php');
$book_id = $_GET['book_id'];
$book_name = $book_adress = NULL;
$query = "SELECT name, adress FROM Books WHERE book_id = '$book_id'";
$book_data = mysqli_query($conn, $query);
if (mysqli_num_rows($book_data) > 0) {
while($row = mysqli_fetch_assoc($book_data)) {
$book_name = $row['name'];
$book_adress = $row['adress'];
}
}
#Validate ownership
$link_user_id = $_GET['user_id'];
$session_user_id = $_SESSION['user_id'];
if ($link_user_id != $session_user_id) {
header("Location: index.php");
}
?>
<link rel="stylesheet" href="css/book.css"/>
<body class="container">
<?php include_once('elements/header.php') ?>
<div class="content">
<a href="index.php" class="btn1">На главную</a>
<h2><?php echo $book_name ?></h2>
<h3><?php echo $book_adress ?></h3>
<div class="card-wrapper">
<?php
$query = 'SELECT receipt_id, start_date, final_date FROM Receipts WHERE book_id = '.$book_id.'';
$receipts_data = mysqli_fetch_all(mysqli_query($conn, $query));
$receipt_num = count($receipts_data) + 1;
?>
<div class="card">
<a href="<?php echo 'receipt.php?user_id='.$session_user_id.'&book_id='.$book_id.'&book_name='.$book_name.'&receipt_num='.$receipt_num.'' ?>" class="add-btn" title="Добавить запись">+</a>
</div>
<?php
if (!empty($receipts_data[0])) {
foreach (array_reverse($receipts_data) as $row) {
$receipt_num--;
echo '<div class="card">
<div class="card-content-wrapper">
<h3>Запись '.$receipt_num.'</h3>
<p>'.date("d.m.Y", strtotime($row[1])).' - '.date("d.m.Y", strtotime($row[2])).'</p>
<a href="receipt.php?user_id='.$session_user_id.'&book_id='.$book_id.'&receipt_id='.$row[0].'&book_name='.$book_name.'&receipt_num='.$receipt_num.'" class="btn1">Посмотреть / Изменить</a>
</div>
</div>';
}
}
?>
<!--<div class="card">
<div class="card-content-wrapper">
<h3>Запись №263</h3>
<p>01.03.2021 - 01.04.2021</p>
<a href="" class="btn1">Подробнее</a>
</div>
</div>-->
</div>
</div>
<?php include_once('elements/footer.php') ?>
</body>
</html>

12
connection.php Normal file
View File

@ -0,0 +1,12 @@
<?php
$dbhost = "localhost";
$dbuser = "root_user";
$dbpwd = ":Lc+z{9UH*9qZ[aV";
$dbname = "bills";
$conn = mysqli_connect("$dbhost", "$dbuser", "$dbpwd", "$dbname");
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}

95
createbook.php Normal file
View File

@ -0,0 +1,95 @@
<?php
session_start();
include_once('head.php');
include('connection.php');
if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] == false) {
header("Location: login.php");
exit;
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
#Get user id
$user_id = $_SESSION['user_id'];
#Collect data from html form via POST request method
$book_name = $_POST['book_name'];
$bill_adress = $_POST['bill_adress'];
$bill_account = $_POST['bill_account'];
#Define error variables and set to empty valuse
$book_nameErr = $bill_adressErr = $bill_accountErr = NULL;
#Validate form and catch errors
#Book name validation
if (empty($book_name)) {
$book_nameErr = 'Вы не ввели название';
}
#Book adress validation
if (empty($bill_adress)) {
$bill_adressErr = 'Вы не ввели адрес';
}
#Billing account validation
if (empty($bill_account)) {
$bill_accountErr = 'Вы не ввели счёт';
}
#Post data to the database is there are no errors
if ($book_nameErr == NULL && $bill_adressErr == NULL && $bill_accountErr == NULL) {
$query = "INSERT INTO Books (owner_id, name, account, adress) VALUES ('$user_id', '$book_name', '$bill_account', '$bill_adress')";
if (mysqli_query($conn, $query)) {
echo "New record has been created successfully";
header("Location: index.php");
} else {
echo mysqli_errno($conn) . " : " . mysqli_error($conn);
}
}
mysqli_close($conn);
}
?>
<link rel="stylesheet" href="css/createbook.css"/>
<body class="container">
<?php include_once('elements/header.php') ?>
<div class="content">
<form method="post" class="form">
<h1 class="form_title">Создать книжку</h1>
<div class="error">* обязательное поле</div>
<br>
<input type="text" name="book_name" placeholder="Название *" class="input">
<div class="error"><?php echo $book_nameErr ?></div>
<br>
<input type="text" name="bill_adress" placeholder="Адрес *" class="input">
<div class="error"><?php echo $bill_adressErr ?></div>
<br>
<input type="text" name="bill_account" placeholder="Счёт *" class="input">
<div class="error"><?php echo $bill_accountErr ?></div>
<br>
<button type="submit" name="submit" class="submit_button">Создать</button>
<br><br>
<a href="index.php" class="link">Назад</a>
</form>
</div>
<?php include_once('elements/footer.php') ?>
</body>
</html>

74
css/book.css Normal file
View File

@ -0,0 +1,74 @@
/* ****CONTENT**** */
.content {
padding: 20px 20px 20px 20px;
min-height: calc(100% - 242px);
text-align: center;
}
h2 {
margin-bottom: 0px;
}
h3 {
margin-bottom: 0px;
}
.card-wrapper {
padding: 20px 0px 20px 0px;
}
.card {
background-color: #D3DCE3;
width: 300px;
height: 200px;
display: inline-block;
vertical-align: top;
margin: 1rem;
border: 1px solid #aaa;
border-radius: 3px;
box-shadow: 1px 1px 2px #fff inset;
}
/* FILLED CARD */
.card-content-wrapper {
position: relative;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
/* EMPTY CARD */
.add-btn {
background-color: #235A81;
width: 60px;
height: 60px;
border: 1px solid #235A81;
border-radius: 30px;
position: relative;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
display: grid;
text-align: center;
align-items: center;
text-decoration: none;
color: #fff;
text-shadow: 0.5px 0.5px 0.5px #444;
font-size: 35px;
}
.add-btn:hover {
background-color: #1f4f72;
}

85
css/createbook.css Normal file
View File

@ -0,0 +1,85 @@
.content {
padding: 20px 20px 20px 20px;
height: calc(100% - 242px);
}
.form {
background-color: #D3DCE3;
min-width: 300px;
max-width: 400px;
position: relative;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
padding: 5px 20px 20px 20px;
border: 1px solid #aaa;
border-radius: 3px;
box-shadow: 1px 1px 2px #fff inset;
text-align: center;
z-index: 99;
}
.form_title {
text-align: center;
}
.input {
transition-duration: 0.3s;
background-color: #fff;
margin: 10px 0px 5px 0px;
width: 100%;
height: 30px;
outline: none;
border: 1px solid #aaa;
border-radius: 3px;
font-size: 15px;
}
.input:hover, .input:focus {
transition-duration: 0.3s;
outline: none;
box-shadow: 0px 0.1px 2px 0.1px #444444;
}
.submit_button {
background-color: #235A81;
margin: 5px 0px 0px 0px;
width: 100%;
height: 32px;
border: 1px solid #aaa;
border-radius: 3px;
cursor: pointer;
color: #fff;
text-shadow: 0.5px 0.5px 0.5px #444;
font-size: 15px;
}
.submit_button:hover {
background-color: #1f4f72;
}
.link {
color: #235A81;
}
.error {
margin: 0px;
color: #235A81;
}

69
css/index.css Normal file
View File

@ -0,0 +1,69 @@
/* ****CONTENT**** */
.content {
padding: 20px 20px 20px 20px;
text-align: center;
min-height: calc(100% - 242px);
}
.card {
background-color: #D3DCE3;
width: 300px;
height: 500px;
display: inline-block;
vertical-align: top;
margin: 1rem;
border: 1px solid #aaa;
border-radius: 3px;
box-shadow: 1px 1px 2px #fff inset;
}
.card.dragging {
opacity: 0.5;
}
/* FILLED CARD */
.card-content-wrapper {
position: relative;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
/* EMPTY CARD */
.add-btn {
background-color: #235A81;
width: 60px;
height: 60px;
border: 1px solid #235A81;
border-radius: 30px;
position: relative;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
display: grid;
text-align: center;
align-items: center;
text-decoration: none;
color: #fff;
text-shadow: 0.5px 0.5px 0.5px #444;
font-size: 35px;
}
.add-btn:hover {
background-color: #1f4f72;
}
.link {
color: #235A81;
}

148
css/profile.css Normal file
View File

@ -0,0 +1,148 @@
.form {
/*background-color: #D3DCE3;*/
min-width: 200px;
max-width: 400px;
position: relative;
left: 50%;
transform: translate(-50%, 0%);
padding: 5px 20px 20px 20px;
margin: 0px;
/*border: 1px solid #aaa;
border-radius: 3px;
box-shadow: 1px 1px 2px #fff inset;*/
z-index: 99;
}
.title {
padding: 0;
}
.input {
transition-duration: 0.3s;
background-color: #fff;
margin: 10px 0px 5px 0px;
width: 75%;
height: 30px;
outline: none;
border: 1px solid #aaa;
border-radius: 3px;
font-size: 15px;
}
.input:hover, .input:focus {
transition-duration: 0.3s;
outline: none;
box-shadow: 0px 0.1px 2px 0.1px #444444;
}
.submit_button {
background-color: #235A81;
margin: 10px 0px 0px 0px;
width: 77%;
height: 30px;
border: 1px solid #aaa;
border-radius: 3px;
cursor: pointer;
color: #fff;
text-shadow: 0.5px 0.5px 0.5px #444;
font-size: 15px;
}
.submit_button:hover {
background-color: #1f4f72;
}
.btn {
display: inline-block;
background-color: #235A81;
padding: 20px 40px 20px 40px;
margin: 10px 5px 10px 5px;
border-radius: 30px;
text-decoration: none;
font-size: 15px;
text-shadow: 0.5px 0.5px 0.5px #444;
font-weight: bolder;
color: #fff;
}
.btn:hover {
background-color: #1f4f72;
}
.link {
color: #235A81;
}
.error {
margin: 0px;
color: #235A81;
}
.content {
width: 100%;
}
.stats {
height: auto;
padding: 0px 20px 5px 20px;
text-align: center;
display: grid;
justify-content: center;
}
.chart_div {
text-align: left;
width: 90vw;
height: 400px;
}
.chpwd {
height: 400px;
display: grid;
align-content: center;
text-align: center;
}
.settings {
height: 300px;
display: grid;
align-content: center;
justify-content: center;
text-align: center;
}
hr {
color: #444;
border-radius: 50%;
}
@media screen and (max-width: 450px) {
.chart_div {
height: 300px;
}
}

105
css/receipt.css Normal file
View File

@ -0,0 +1,105 @@
.content {
padding: 20px 20px 20px 20px;
height: fit-content;
text-align: center;
}
.form {
background-color: #D3DCE3;
min-width: 300px;
max-width: 400px;
position: relative;
left: 50%;
transform: translate(-50%, 0%);
padding: 5px 20px 20px 20px;
margin: 15px 0px 15px 0px;
border: 1px solid #aaa;
border-radius: 3px;
box-shadow: 1px 1px 2px #fff inset;
z-index: 99;
}
.input-container {
width: 300px;
margin: 0 auto;
}
.input-label {
text-align: left;
margin: 0px 0px 5px 6px;
}
.input {
transition-duration: 0.3s;
background-color: #fff;
margin: 0px 0px 0px 0px;
width: 135px;
height: 30px;
outline: none;
border: 1px solid #aaa;
border-radius: 3px;
font-size: 15px;
-webkit-validation-bubble-message: none;
}
.num-input {
width: 9.8ch;
}
.comment {
width: 285px;
height: 50px;
resize: none;
}
.input:hover, .input:focus {
transition-duration: 0.3s;
outline: none;
box-shadow: 0px 0.1px 2px 0.1px #444444;
}
.submit_button {
background-color: #235A81;
margin: 0px;
min-width: 295px;
height: 32px;
border: 1px solid #aaa;
border-radius: 3px;
cursor: pointer;
color: #fff;
text-shadow: 0.5px 0.5px 0.5px #444;
font-size: 15px;
}
.submit_button:hover {
background-color: #1f4f72;
}
.link {
color: #235A81;
}
.error {
text-align: left;
color: #235A81;
margin: 5px 0px 0px 6px;
}

79
css/sign.css Normal file
View File

@ -0,0 +1,79 @@
body {
padding: 0px 15px 0px 15px;
width: calc(100% - 30px)
}
.form {
background-color: #D3DCE3;
min-width: 300px;
max-width: 400px;
position: relative;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
padding: 5px 20px 20px 20px;
border: 1px solid #aaa;
border-radius: 3px;
box-shadow: 1px 1px 2px #fff inset;
text-align: center;
}
.input {
transition-duration: 0.3s;
background-color: #fff;
margin: 10px 0px 5px 0px;
width: 100%;
height: 30px;
outline: none;
border: 1px solid #aaa;
border-radius: 3px;
font-size: 15px;
}
.input:hover, .input:focus {
transition-duration: 0.3s;
outline: none;
box-shadow: 0px 0.1px 2px 0.1px #444444;
}
.submit_button {
background-color: #235A81;
margin: 5px 0px 0px 0px;
width: 100%;
height: 30px;
border: 1px solid #aaa;
border-radius: 3px;
cursor: pointer;
color: #fff;
text-shadow: 0.5px 0.5px 0.5px #444;
font-size: 15px;
}
.submit_button:hover {
background-color: #1f4f72;
}
.link {
color: #235A81;
}
.error {
margin: 0px;
color: #235A81;
}

34
elements/footer.php Normal file
View File

@ -0,0 +1,34 @@
<style>
/* ****FOOTER**** */
.footer {
background-color: #444;
height: 100px;
position: relative;
right: 0;
left: 0;
bottom: 0;
padding: 0px 20px 0px 20px;
border-top: 1px solid #aaa;
box-shadow: 0px 1.5px 8px #444;
color: #fff;
text-shadow: 0.5px 0.5px 0.5px black;
display: grid;
justify-content: center;
align-items: center;
}
.footer-link {
color: aliceblue;
}
</style>
<footer class="footer">
<p><a href="https://www.cuqmbr.pp.ua" class="footer-link" style="text-decoration:none">2021 © cuqmbr</a></p>
</footer>

151
elements/header.php Normal file
View File

@ -0,0 +1,151 @@
<style>
/* ****HEADER**** */
.header {
background-color: #D3DCE3;
height: 100px;
padding: 0px 20px 0px 20px;
border-bottom: 1px solid #aaa;
box-shadow: 0px 1.5px 8px #444;
top: 0;
z-index: 100;
}
/* NAVIGATION*** */
.navigation {
height: 100px;
display: grid;
grid-template-rows: 0px 100%;
align-items: center;
}
.buttons {
width: fit-content;
position: relative;
left: 100%;
transform: translate(-100%, 0);
}
.btn1 {
display: inline-block;
background-color: #235A81;
padding: 20px 40px 20px 40px;
margin: 0px 5px 0px 5px;
border-radius: 30px;
text-decoration: none;
font-size: 15px;
text-shadow: 0.5px 0.5px 0.5px #444;
font-weight: bolder;
color: #fff;
}
.btn1:hover {
background-color: #1f4f72;
}
.btn2 {
background-color: transparent;
padding: 20px 40px 20px 40px;
margin: 0px 5px 0px 5px;
border-radius: 30px;
text-decoration: none;
font-size: 15px;
text-shadow: 0.5px 0.5px 0.5px #fff;
font-weight: bolder;
color: #444;
}
.btn2:hover {
background-color: #235A81;
color: #fff;
text-shadow: 0.5px 0.5px 0.5px #444;
}
/* MENUS */
.menus {
width: fit-content;
transform: translate(0%, 50px);
}
.logo {
height: 60px;
}
@media screen and (max-width: 450px) {
.btn1 {
display: inline-block;
background-color: #235A81;
padding: 20px 30px 20px 30px;
margin: 0px 5px 0px 5px;
border-radius: 30px;
text-decoration: none;
font-size: 15px;
text-shadow: 0.5px 0.5px 0.5px #444;
font-weight: bolder;
color: #fff;
}
.btn2 {
background-color: transparent;
padding: 20px 30px 20px 30px;
margin: 0px 5px 0px 5px;
border-radius: 30px;
text-decoration: none;
font-size: 15px;
text-shadow: 0.5px 0.5px 0.5px #fff;
font-weight: bolder;
color: #444;
}
.logo {
height: 50px;
}
}
</style>
<header class="header">
<nav class="navigation">
<div class="menus">
<a href="index.php" title="На главную"><img src="img/logo.png" class="logo"></a>
</div>
<div class="buttons">
<?php
if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !== true) {
echo '<a href="login.php" class="btn1">Войти</a>';
} else {
echo '<a href="profile.php?user_id='.$_SESSION['user_id'].'" class="btn2">Аккаунт</a>
<a href="logout.php" class="btn1">Выйти</a>';
}
?>
</div>
</nav>
</header>

1
functions.php Normal file
View File

@ -0,0 +1 @@
<?php

36
head.php Normal file
View File

@ -0,0 +1,36 @@
<?php
session_start();
setlocale(LC_TIME, "ru_RU.utf8");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Сайт</title>
<link rel="shortcut icon" type="image/jpg" href="img/logo.png"/>
</head>
<style>
html{
font-family: 'Roboto', sans-serif;
color: #444;
text-shadow: 0.5px 0.5px 0.5px #fff;
font-size: 62.5%;
}
body {
margin: 0px;
font-size: 1.6rem;
width: 100%;
height: 100vh;
}
</style>
</html>

BIN
img/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
img/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

59
index.php Normal file
View File

@ -0,0 +1,59 @@
<?php
session_start();
include_once('head.php');
include('connection.php');
?>
<link rel="stylesheet" href="css/index.css"/>
<!--<script src="js/dragndrop.js" defer></script>-->
<body class="container">
<?php include_once('elements/header.php') ?>
<div class="content">
<?php
$user_id = $_SESSION['user_id'];
$books = array();
$query = 'SELECT book_id, name, adress, account FROM Books WHERE owner_id = '.$user_id.'';
$userdata = mysqli_query($conn, $query);
if (mysqli_num_rows($userdata) > 0) {
foreach (mysqli_fetch_all($userdata) as $row) {
array_push($books, $row);
}
foreach ($books as $book) {
$book_id = $book[0];
echo '<div class="card draggable" draggable="false">
<div class="card-content-wrapper">
<h3>'.$book[1].'</h3>
<p>'.$book[2].'</p>
<p>Счёт '.$book[3].'</p>
<a href="book.php?user_id='.$user_id.'&book_id='.$book_id.'" class="btn1">Подробнее</a><br><br>
<a href="remove_book.php?user_id='.$user_id.'&book_id='.$book_id.'" class="link">Удалить</a>
</div>
</div>';
}
}
#print_r($books);
?>
<div class="card draggable" draggable="false">
<a href="createbook.php" class="add-btn" title="Добавить книжку">+</a>
</div>
</div>
<?php include_once('elements/footer.php') ?>
</body>
</html>

38
js/dragndrop.js Normal file
View File

@ -0,0 +1,38 @@
const draggables = document.querySelectorAll('.card')
const container = document.querySelector('.content')
draggables.forEach(draggable => {
draggable.addEventListener('dragstart', () => {
draggable.classList.add('dragging');
})
draggable.addEventListener('dragend', () => {
draggable.classList.remove('dragging')
})
})
container.addEventListener('dragover', e => {
e.preventDefault()
const afterElement = getDragAfterElement(container, e.clientX)
console.log(afterElement)
const draggable = document.querySelector('.dragging')
if (afterElement == null) {
container.appendChild(draggable)
} else {
container.insertBefore(draggable, afterElement)
}
})
function getDragAfterElement (container, x) {
const draggableElements = [...container.querySelectorAll('.draggable:not(.dragging)')]
draggableElements.reduce((closest, child) => {
const box = child.getBoundingClientRect()
const offset = x - box.right - box.width / 2
if (offset < 0 && offset > closest.offset) {
return { offset: offset, element: child}
} else {
return closest
}
}, { offset: Number.NEGATIVE_INFINITY }).element
}

79
login.php Normal file
View File

@ -0,0 +1,79 @@
<?php
session_start();
include_once('head.php');
if (isset($_SESSION['loggedin']) || $_SESSION['loggedin'] == true) {
header("Location: index.php");
exit;
}
include('connection.php');
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$email = $_POST['email'];
$password = $_POST['pwd'];
$emailErr = $passwordErr = NULL;
$dbuser_id = $dbusername = $dbemail = $dbpassword_hashed = NULL;
$query = "SELECT user_id, username, email, password FROM Users WHERE email = '$email'";
$userdata = mysqli_query($conn, $query);
if (mysqli_num_rows($userdata) > 0) {
while($row = mysqli_fetch_assoc($userdata)) {
$dbuser_id = $row['user_id'];
$dbusername = $row['username'];
$dbemail = $row['email'];
$dbpassword_hashed = $row['password'];
}
if (password_verify($password, $dbpassword_hashed)) {
$_SESSION['loggedin'] = true;
$_SESSION['user_id'] = $dbuser_id;
$_SESSION['username'] = $dbusername;
$_SESSION['email'] = $dbemail;
header("Location: index.php");
mysqli_close($conn);
} else {
$passwordErr = "Неправильный пароль";
}
} else {
$emailErr = "Почта не зарегестрирована";
}
}
?>
<link rel="stylesheet" href="css/sign.css"/>
<body>
<form method="post" class="form">
<h1>Войти</h1>
<div class="error">* обязательное поле</div>
<br>
<input type="text" name="email" placeholder="Email *" class="input" autofocus>
<div class="error"><?php echo $emailErr ?></div>
<br>
<input type="password" name="pwd" placeholder="Пароль *" class="input">
<div class="error"><?php echo $passwordErr ?></div>
<br>
<button type="submit" name="submit" class="submit_button">Войти</button>
<p>У вас ещё нету аккаунта? <a href="sign_up.php" class="link">Создать аккаунт</a></p>
</form>
</body>
</html>

10
logout.php Normal file
View File

@ -0,0 +1,10 @@
<?php
session_start();
session_unset();
session_destroy();
header("Location: login.php");
exit();
?>

226
profile.php Normal file
View File

@ -0,0 +1,226 @@
<?php
session_start();
include('connection.php');
#Validate ownership
$link_user_id = $_GET['user_id'];
$session_user_id = $_SESSION['user_id'];
if ($link_user_id != $session_user_id) {
header("Location: index.php");
}
#Form handling
$dbpassword_hashed = $password = $new_password = $confirm_new_password = NULL;
$passwordErr = $confirm_passwordErr = NULL;
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if (!empty($_POST['submit_password'])) {
#Retrive database password
$query = "SELECT password FROM Users WHERE user_id = '$session_user_id'";
$result = mysqli_query($conn, $query);
if (mysqli_num_rows($result) > 0) {
while($row = mysqli_fetch_array($result)) {
$dbpassword_hashed = $row['password'];
}
}
#Validate new password
$password = $_POST['pwd'];
$new_password = $_POST['npwd'];
$confirm_new_password = $_POST['cnpwd'];
if ($new_password != $confirm_new_password) {
$confirm_passwordErr = 'Пароли не совпадают';
}
if (mb_strlen($new_password) < 8) {
$confirm_passwordErr = "Используйте больше 8 символов";
}
if (empty($new_password)) {
$confirm_passwordErr = "Вы не ввели пароль";
}
if (!password_verify($password, $dbpassword_hashed)) {
$passwordErr = "Вы ввели неправильный пароль";
}
#Set new password
if ($confirm_passwordErr == NULL && $passwordErr == NULL) {
$password_hashed = password_hash($new_password, PASSWORD_DEFAULT);
$query = "UPDATE Users SET password = '$password_hashed' WHERE (user_id = '$session_user_id')";
if (mysqli_query($conn, $query)) {
header("Location: logout.php");
mysqli_close($conn);
} else {
echo mysqli_errno($conn) . " : " . mysqli_error($conn);
}
}
}
}
include_once('head.php');
####Get data to make graphs####
$book_info = array();
#Get user's books
$book_ids = $book_names = array();
$query = "SELECT book_id, name FROM Books WHERE owner_id = '$session_user_id'";
$result = mysqli_query($conn, $query);
if (mysqli_num_rows($result) > 0) {
while($row = mysqli_fetch_array($result)) {
array_push($book_ids, $row['book_id']);
array_push($book_names, $row['name']);
}
}
#Get user's boooks receipts into $book_info array
$start_dates_all = $final_dates_all = $start_nums_all = $final_nums_all = $rates_all = $start_dates = $final_dates = $start_nums = $final_nums = $rates = array();
$curr_id = NULL;
$curr_num = -1;
for ($i=0; $i < count($book_ids); $i++) {
$query = "SELECT start_date, final_date, start_num, final_num, rate FROM Receipts WHERE book_id = '$book_ids[$i]' ORDER BY start_date LIMIT 100";
$result = mysqli_query($conn, $query);
if (mysqli_num_rows($result) > 0) {
while($row = mysqli_fetch_array($result)) {
if (date(strtotime($row['final_date'])) > date(strtotime('-2 month'))) {
array_push($start_dates_all, $row['start_date']);
array_push($final_dates_all, $row['final_date']);
array_push($start_nums_all, $row['start_num']);
array_push($final_nums_all, $row['final_num']);
array_push($rates_all, $row['rate']);
if ($curr_id != $book_ids[$i]) {
$curr_id = $book_ids[$i];
$curr_num++;
array_push($book_info, array($book_ids[$i], $book_names[$i], array(array($row['start_date'], $row['final_date'], $row['start_num'], $row['final_num'], $row['rate']))));
} else if ($curr_id == $book_ids[$i]) {
array_push($book_info[$curr_num][2], array($row['start_date'], $row['final_date'], $row['start_num'], $row['final_num'], $row['rate']));
}
}
}
}
}
#$print_r($book_info);
?>
<link rel="stylesheet" href="css/profile.css"/>
<head>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load('current', {'packages':['corechart', 'bar']});
google.charts.setOnLoadCallback(drawStuff);
function drawStuff() {
var chartDiv = document.getElementById('chart_div');
var data = google.visualization.arrayToDataTable([
['Месяц', <?php foreach ($book_info as $b) { echo "'$b[1]', "; } ?>],
['<?php echo strftime('%B', strtotime('-3 month')); ?>', <?php $valid = array(); foreach ($book_info as $b) { foreach ($b[2] as $r) { if (date(strtotime($r[1])) > date(strtotime('-3 month')) && date(strtotime($r[1])) < date(strtotime('-2 month'))) { array_push($valid, $r); } else { array_push($valid, array( 0, 0, 0, 0, 0)); } } } /*print_r($valid);*/ foreach ($valid as $v) { $diff = $v[3] - $v[2]; $amount = $diff * $v[4]; echo ''.$amount.', '; } ?>],
['<?php echo strftime('%B', strtotime('-2 month')); ?>', <?php $valid = array(); foreach ($book_info as $b) { foreach ($b[2] as $r) { if (date(strtotime($r[1])) > date(strtotime('-2 month')) && date(strtotime($r[1])) < date(strtotime('-1 month'))) { array_push($valid, $r); } else { array_push($valid, array( 0, 0, 0, 0, 0)); } } } /*print_r($valid);*/ foreach ($valid as $v) { $diff = $v[3] - $v[2]; $amount = $diff * $v[4]; echo ''.$amount.', '; } ?>],
['<?php echo strftime('%B', strtotime('-1 month')); ?>', <?php $valid = array(); foreach ($book_info as $b) { foreach ($b[2] as $r) { if (date(strtotime($r[1])) > date(strtotime('-1 month')) && date(strtotime($r[1])) < date(strtotime('today'))) { array_push($valid, $r); } else { array_push($valid, array( 0, 0, 0, 0, 0)); } } } /*print_r($valid);*/ foreach ($valid as $v) { $diff = $v[3] - $v[2]; $amount = $diff * $v[4]; echo ''.$amount.', '; } ?>]
]);
var classicOptions = {
series: {
0: {targetAxisIndex: 0},
},
title: 'Растраты за месяц',
vAxes: {
0: {title: 'Сумма'},
}
};
function drawClassicChart() {
var classicChart = new google.visualization.ColumnChart(chartDiv);
classicChart.draw(data, classicOptions);
}
drawClassicChart();
};
</script>
</head>
<body class="container">
<?php include_once('elements/header.php') ?>
<div class="content">
<div class="stats">
<h2 class="title">Статистика</h2>
<div class="chart_div" id="chart_div"></div>
</div>
<hr>
<div class="chpwd">
<form method="post" class="form">
<h2 class="title">Изменить пароль</h2>
<input type="password" class="input" name="pwd" placeholder="Старый пароль*">
<div class="error"><?php echo $passwordErr ?></div>
<input type="password" class="input" name="npwd" placeholder="Новый пароль*">
<div class="error"><?php echo $confirm_passwordErr ?></div>
<input type="password" class="input" name="cnpwd" placeholder="Повторите пароль*">
<div class="error"></div>
<input type="submit" name="submit_password" class="submit_button" value="Сохранить"/>
</form>
</div>
<hr>
<div class="settings">
<h2 class="title">Управление аккаунтом</h2>
<a href="remove_user.php?user_id='$session_user_id'" class="btn">Удалить аккаунт</a>
</div>
</div>
<?php include_once('elements/footer.php') ?>
</body>
</html>

28
receipt.js Normal file
View File

@ -0,0 +1,28 @@
const monthlyField = document.getElementById("monthly");
const totalField = document.getElementById("total");
const start_num = document.getElementById("start_num");
const final_num = document.getElementById("final_num");
const rate = document.getElementById("rate");
getMonthly();
getTotal();
start_num.addEventListener("click", getMonthly);
final_num.addEventListener("input", getMonthly);
start_num.addEventListener("click", getTotal);
final_num.addEventListener("input", getTotal);
rate.addEventListener("input", getTotal);
var monthly;
var total;
function getMonthly() {
monthly = final_num.value - start_num.value;
monthlyField.value = monthly;
}
function getTotal() {
total = monthly * rate.value;
totalField.value = Number((total).toFixed(2));
}

156
receipt.php Normal file
View File

@ -0,0 +1,156 @@
<?php
session_start();
include('head.php');
include('connection.php');
$book_id = $_GET['book_id'];
$book_name = $_GET['book_name'];
$receipt_num = $_GET['receipt_num'];
$receipt_id = $_GET['receipt_id'];
#Retrieve receipt data
$start_date = $final_date = $start_num = $final_num = $rate = $total = NULL;
$query = "SELECT start_date, final_date, start_num, final_num, rate, comment FROM Receipts WHERE receipt_id = '$receipt_id'";
$result = mysqli_query($conn, $query);
if (mysqli_num_rows($result) > 0) {
while($row = mysqli_fetch_array($result)) {
$start_date = $row['start_date'];
$final_date = $row['final_date'];
$start_num = $row['start_num'];
$final_num = $row['final_num'];
$rate = $row['rate'];
$comment = $row['comment'];
}
}
#Validate ownership
$link_user_id = $_GET['user_id'];
$session_user_id = $_SESSION['user_id'];
if ($link_user_id != $session_user_id) {
header("Location: index.php");
}
#Post method
if ($_SERVER["REQUEST_METHOD"] == "POST") {
#Collect data from html form via POST request method
$start_date = $_POST['start_date'];
$final_date = $_POST['final_date'];
$start_num = $_POST['start_num'];
$final_num = $_POST['final_num'];
$rate = $_POST['rate'];
$comment = $_POST['comment'];
#Define error variables and set to empty valuse
$dateErr = $numErr = $rateErr = $commentErr = NULL;
#Validate form and catch errors
#Date confirmation
if(empty($start_date) || empty($final_date)) {
$dateErr = "Вы не ввели дату";
}
#Num confirmation
if ($start_num < 0 || empty($final_num)) {
$numErr = "Вы не ввели показания счётчика";
}
#Rate confirmation
if (empty($rate)) {
$rateErr = "Вы не ввели тариф";
}
#Comment validation
if (strlen($comment) > 255) {
$commentErr = "Коммнтарий не можеть быть длиннее 255 символов";
}
#Post data to the database is there are no errors
if ($dateErr == NULL && $numErr == NULL && $rateErr == NULL && $commentErr == NULL) {
if ($receipt_id == NULL) {
$query = "INSERT INTO Receipts (book_id, start_date, final_date, start_num, final_num, rate, comment) VALUES ('$book_id', '$start_date', '$final_date', '$start_num', '$final_num', '$rate', '$comment')";
if (mysqli_query($conn, $query)) {
echo "New record has been created successfully";
header('Location: book.php?user_id='.$session_user_id.'&book_id='.$book_id.'');
} else {
echo mysqli_errno($conn) . " : " . mysqli_error($conn);
}
} else {
$query = "UPDATE Receipts SET start_date = '$start_date', final_date = '$final_date', start_num = '$start_num', final_num = '$final_num', rate = '$rate', comment = '$comment' WHERE (receipt_id = '$receipt_id')";
if (mysqli_query($conn, $query)) {
echo "Receipts has been updated";
header('Location: book.php?user_id='.$session_user_id.'&book_id='.$book_id.'');
} else {
echo mysqli_errno($conn) . " : " . mysqli_error($conn);
}
}
}
mysqli_close($conn);
}
?>
<link rel="stylesheet" href="css/receipt.css"/>
<body class="container">
<?php include_once('elements/header.php') ?>
<div class="content">
<a href="<?php echo 'book.php?user_id='.$session_user_id.'&book_id='.$book_id.'' ?>" class='btn1'>Назад</a>
<form method="post" class="form" autocomplete="off">
<h2><?php echo $book_name; ?>: Запись №<?php echo $receipt_num; ?></h2>
<div class="input-container">
<p class="input-label">Дата*:</p>
<input type="date" name="start_date" class="input" value=<?php echo $start_date ?>> - <input type="date" name="final_date" class="input" value=<?php echo $final_date ?>>
<div class="error"><?php echo $dateErr; ?></div>
<br>
<p class="input-label">Показания счётчика*: &emsp;&ensp;&ensp; За месяц:</p>
<input type="number" name="start_num" id="start_num" class="num-input input" min="0" placeholder="Начало" value=<?php echo $start_num ?>> - <input type="number" name="final_num" id="final_num" class="num-input input" min="0" placeholder="Конец" value=<?php echo $final_num ?>> : <input type="number" name="monthly" id="monthly" class="num-input input" min="0" readonly>
<div class="error"><?php echo $numErr; ?></div>
<br>
<p class="input-label">Тариф*: &emsp;&emsp;&emsp;&emsp;&emsp;&nbsp; Сумма:</p>
<input type="number" step="0.01" name="rate" id="rate" class="input" value=<?php echo $rate; ?>> : <input type="number" step="0.01" name="total" id="total" class="input" readonly>
<div class="error"><?php echo $rateErr; ?></div>
<br>
<p class="input-label">Комментарий к записи:</p>
<textarea name="comment" class="input comment"><?php echo $comment ?></textarea>
<div class="error"><?php echo $commentErr; ?></div>
<br>
<button type="submit" name="submit" class="submit_button">Сохранить</button>
<br><br>
<a href="<?php echo 'remove_receipt.php?user_id='.$session_user_id.'&book_id='.$book_id.'&receipt_id='.$receipt_id.'' ?>" class="link" method="post">Удалить</a>
</div>
</form>
</div>
<?php include_once('elements/footer.php') ?>
</body>
</html>
<script src="receipt.js"></script>

27
remove_book.php Normal file
View File

@ -0,0 +1,27 @@
<?php
session_start();
include('connection.php');
#Validate ownership
$link_user_id = $_GET['user_id'];
$session_user_id = $_SESSION['user_id'];
if ($link_user_id != $session_user_id) {
header("Location: index.php");
}
#Delete book
$book_id = $_GET['book_id'];
$query = "DELETE FROM Books WHERE book_id = '$book_id'";
if (mysqli_query($conn, $query)) {
echo "Book deleted successfully";
header('Location: index.php');
} else {
echo mysqli_errno($conn) . " : " . mysqli_error($conn);
}
?>

28
remove_receipt.php Normal file
View File

@ -0,0 +1,28 @@
<?php
session_start();
include('connection.php');
#Validate ownership
$link_user_id = $_GET['user_id'];
$session_user_id = $_SESSION['user_id'];
if ($link_user_id != $session_user_id) {
header("Location: index.php");
}
#Delete receipt
$receipt_id = $_GET['receipt_id'];
$book_id = $_GET['book_id'];
$query = "DELETE FROM Receipts WHERE receipt_id = '$receipt_id'";
if (mysqli_query($conn, $query)) {
echo "Receipt deleted successfully";
header('Location: book.php?user_id='.$session_user_id.'&book_id='.$book_id.'');
} else {
echo mysqli_errno($conn) . " : " . mysqli_error($conn);
}
?>

28
remove_user.php Normal file
View File

@ -0,0 +1,28 @@
<?php
session_start();
include('connection.php');
#Validate ownership
$link_user_id = $_GET['user_id'];
$session_user_id = $_SESSION['user_id'];
if ($link_user_id != $session_user_id) {
header("Location: index.php");
}
#Delete user
$query = "DELETE FROM Users WHERE user_id = '$session_user_id'";
if (mysqli_query($conn, $query)) {
session_unset();
session_destroy();
header("Location: index.php");
exit();
} else {
echo mysqli_errno($conn) . " : " . mysqli_error($conn);
}
?>

106
sign_up.php Normal file
View File

@ -0,0 +1,106 @@
<?php
session_start();
include_once('head.php');
if (isset($_SESSION['loggedin']) || $_SESSION['loggedin'] == true) {
header("Location: index.php");
exit;
}
include('connection.php');
if ($_SERVER["REQUEST_METHOD"] == "POST") {
#Collect data from html form via POST request method
$username = $_POST['username'];
$email = $_POST['email'];
$password = $_POST['pwd'];
$conf_password = $_POST['cpwd'];
#Define error variables and set to empty valuse
$usernameErr = $emailErr = $passwordErr = $conf_passwordErr = NULL;
#Validate form and catch errors
#Username confirmation
if (empty($username)) {
$usernameErr = "Вы не ввели имя пользователя";
}
#Email confirmation
if (empty($email)) {
$emailErr = "Вы не ввели email";
} elseif (preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $email) ? FALSE : TRUE) {
$emailErr = "Используйте валидную почту";
}
#Password confirmation
if (empty($password)) {
$passwordErr = "Вы не ввели пароль";
} elseif (mb_strlen($password) < 8) {
$passwordErr = "Используйте больше 8 символов";
}
#Password confirmation
if ($conf_password != $password) {
$conf_passwordErr = "Пароли не совпадают";
}
#Post data to the database is there are no errors
if ($usernameErr == NULL && $emailErr == NULL && $passwordErr == NULL && $conf_passwordErr == NULL) {
$password_hashed = password_hash($password, PASSWORD_DEFAULT);
$query = "INSERT INTO Users (username, email, password) VALUES ('$username', '$email', '$password_hashed')";
if (mysqli_query($conn, $query)) {
header("Location: login.php");
mysqli_close($conn);
} else {
#echo mysqli_errno($conn) . " : " . mysqli_error($conn);
$errno = mysqli_errno($conn);
if ($errno == 1062) {
$emailErr = "Почта уже зарегестрирована";
}
}
}
}
?>
<link rel="stylesheet" href="css/sign.css"/>
<body>
<form method="post" class="form">
<h1>Создать аккаунт</h1>
<div class="error">* обязательное поле</div>
<br>
<input type="text" name="username" placeholder="Имя пользователя *" class="input" autofocus>
<div class="error"><?php echo $usernameErr; ?></div>
<br>
<input type="text" name="email" placeholder="Email *" class="input">
<div class="error"><?php echo $emailErr; ?></div>
<br>
<input type="password" name="pwd" placeholder="Пароль *" class="input">
<div class="error"><?php echo $passwordErr; ?></div>
<br>
<input type="password" name="cpwd" placeholder="Повторите пароль *" class="input">
<div class="error"><?php echo $conf_passwordErr; ?></div>
<br>
<button type="submit" name="submit" class="submit_button">Создать</button>
<p>У вас уже есть аккаунт? <a href="login.php" class="link">Войти</a></p>
</form>
</body>
</html>