Compare commits

...

9 Commits

Author SHA1 Message Date
62bb16f581 fix 2024-07-01 15:55:14 +03:00
b8c98693f8 add postModel 2024-07-01 13:09:43 +03:00
c4bc65e5dc some 2024-06-27 11:43:22 +03:00
b9425ee8cf model 2024-06-26 12:42:42 +03:00
e28dfe172d remove vendor 2024-06-26 11:35:56 +03:00
6f66e023a2 fix vendor 2024-06-26 11:34:47 +03:00
2714dad7ce ver.0.4 2024-06-26 11:10:17 +03:00
987effd67f ver.0.3 2024-06-14 15:55:36 +03:00
5468b1d286 ver.0.2 2024-05-27 11:40:02 +03:00
31 changed files with 808 additions and 237 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
.idea
vendor

View File

@ -1,14 +0,0 @@
Билай;Станислав;Романович;2002-03-11;Мужчина;+7;9493761924;stasbilay02@yandex.ru
Иванова;Мария;Сергеевна;2002-04-05;Женжина;+38;2222222222;sdguhnlnoih@gmail.com
Иванов;Иван;Иванович;2002-03-11;Мужчина;+7;1111111111;dsjgbdskgb@yandex.ru
Плешкова;Анастасия;Денисовна;2006-11-10;Женжина;+7;3333333333;ple.anastasiya@gmail.com
Зайцева;Анжела;Игоревна;1998-12-12;Женжина;+7;4444444444;aksjfhfka@mail.ru
Петров;Петр;Петрович;1987-03-02;Мужчина;+7;7777777777;jksghhsdkj@gmail.com
Зайцев;Федор;Александрович;2014-12-22;Мужчина;+7;6667774441;asert@mail.ru
Иванов;Петр;Михайлович;2002-03-11;Мужчина;+7;1111111111;asert@mail.ru
Иванов;Роман;Сергеевич;2002-03-11;Мужчина;+7;1111111111;ple.anastasiya@gmail.com
Билай;Станислав;Романович;4444-04-04;Мужчина;+7;9493761924;stasbilay02@yandex.ru
Билай;Станислав;Романович;4444-04-04;Мужчина;+7;9493761924;stasbilay02@yandex.ru
Билай;Станислав;Романович;4444-04-04;Мужчина;+7;9493761924;stasbilay02@yandex.ru
Билай;Станислав;Романович;4444-04-04;Мужчина;+7;9493761924;stasbilay02@yandex.ru
Билай;Станислав;Романович;4444-04-04;Мужчина;+7;9493761924;stasbilay02@yandex.ru

20
Information2.txt Normal file
View File

@ -0,0 +1,20 @@
autoincrement=id;last_id=20;table_name=user_info
id;surname;name;patronymic;dateOfBirth;gender;countryCode;phoneNumber;email;status
3;Билай;Станислав;Романович;2002-03-11;Мужчина;+7;9493761924;stasbilay02@yandex.ru;0
4;Иванова;Мария;Сергеевна;2002-04-05;Женщина;+38;2222222222;sdguhnlnoih@gmail.com;1
5;Иванов;Иван;Иванович;2002-03-11;Мужчина;+7;1111111111;dsjgbdskgb@yandex.ru;1
6;Плешкова;Анастасия;Денисовна;2006-11-10;Женщина;+7;3333333333;ple.anastasiya@gmail.com;0
7;Зайцева;Анжела;Игоревна;1998-12-12;Женщина;+7;4444444444;aksjfhfka@mail.ru;0
8;Петров;Петр;Петрович;1987-03-02;Мужчина;+7;7777777777;jksghhsdkj@gmail.com;1
9;Зайцев;Федор;Александрович;2014-12-22;Мужчина;+7;6667774441;asert@mail.ru;1
10;Иванов;Петр;Михайлович;2002-03-11;Мужчина;+7;1111111111;asert@mail.ru;1
11;Иванов;Роман;Сергеевич;2002-03-11;Мужчина;+7;1111111111;ple.anastasiya@gmail.com;0
12;Билай;Станислав;Романович;4444-04-04;Мужчина;+7;9493761924;stasbilay02@yandex.ru;0
13;Билай;Станислав;Романович;4444-04-04;Мужчина;+7;9493761924;stasbilay02@yandex.ru;1
14;Билай;Станислав;Романович;4444-04-04;Мужчина;+7;9493761924;stasbilay02@yandex.ru;0
15;Билай;Станислав;Романович;4444-04-04;Мужчина;+7;9493761924;stasbilay02@yandex.ru;0
16;Билай;Станислав;Романович;4444-04-04;Женщина;+38;9493761924;stasbilay02@yandex.ru;0
17;Зайцева;Анжела;Игоревна;7777-07-07;Женщина;+7;4444444444;aksjfhfka@mail.ru;0
18;Зайцева;Анжела;Игоревна;7777-07-07;Женщина;+7;4444444444;aksjfhfka@mail.ru;1
19;Зайцева;Анжела;Игоревна;7777-07-07;Женщина;+7;4444444444;aksjfhfka@mail.ru;1
20;ddd;Кирилл;ddd;2024-06-25;Мужчина;+7;9281234567;apuc06@mail.ru;

View File

@ -1,10 +0,0 @@
<?php
function search(string $strFromFile, string $strForSearch): ?string
{
if($strFromFile) {
if (preg_match($strForSearch, $strFromFile))
return $strFromFile;
}
return null;
}

View File

@ -1,2 +1,10 @@
{
}
"require": {
"itguild/tables": "^0.1.0"
},
"autoload": {
"psr-4": {
"src\\": "src"
}
}
}

45
composer.lock generated Normal file
View File

@ -0,0 +1,45 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "fc8ab2b89b81d894996f3c1d3b16ea8e",
"packages": [
{
"name": "itguild/tables",
"version": "0.1",
"source": {
"type": "git",
"url": "https://git.itguild.info/ItGuild/tables",
"reference": "42ab26a3db1cef8319985fc3a0f5d23d2dff4e3b"
},
"type": "library",
"autoload": {
"psr-4": {
"Itguild\\Tables\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Kavalar",
"email": "apuc06@mail.ru"
}
],
"time": "2024-05-27T09:59:44+00:00"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
"platform-dev": [],
"plugin-api-version": "2.2.0"
}

View File

@ -1,37 +0,0 @@
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<title>Form ФИО</title>
</head>
<body>
<!--<form action="info.php" target="_blank" method="post">
Фамилия: <br>
<input type = "text" name = "surname" required size="50" autofocus placeholder="Фамилия"> <br> <br>
Имя: <br>
<input type = "text" name = "name" required size="50" placeholder="Имя"> <br> <br>
Отчество (если есть): <br>
<input type = "text" name = "patronymic" size="50" placeholder="Отчество"> <br> <br>
Дата Рождения: <br>
<input type="date" name="dateOfBirth" required> <br> <br>
Ваш пол: <br>
<input type="radio" name="gender" value="Мужчина" checked> Мужчина
<input type="radio" name="gender" value="Женжина"> Женжина<br> <br>
Номер телефона (Например 1234567890): <br>
<select name="countryCode">
<option value="+7" >Russia +7</option>
<option value="+38">Ukraine +38</option>
</select>
<input type="tel" name="phoneNumber" pattern="[0-9]{10}" maxlength="10" required placeholder="1234567890"> <br> <br>
Email адрес: <br>
<input type="Email" name="email" required> <br><br>
<input type = "submit" value="Подтвердить">
<input type="reset">
</form>-->
</body>
</html>

View File

@ -1,31 +0,0 @@
<?php $form = '<form action="info.php" target="_blank" method="post">
Фамилия:<br>
<input type = "text" name = "surname" required size="50" autofocus placeholder="Фамилия"> <br> <br>
Имя:<br>
<input type = "text" name = "name" required size="50" placeholder="Имя"> <br> <br>
Отчество (если есть):<br>
<input type = "text" name = "patronymic" size="50" placeholder="Отчество"> <br> <br>
Дата Рождения: <br>
<input type="date" name="dateOfBirth" required> <br> <br>
Ваш пол: <br>
<input type="radio" name="gender" value="Мужчина" checked> Мужчина
<input type="radio" name="gender" value="Женжина"> Женжина<br> <br>
Номер телефона (Например 1234567890): <br>
<select name="countryCode">
<option value="+7" >Russia +7</option>
<option value="+38">Ukraine +38</option>
</select>
<input type="tel" name="phoneNumber" pattern="[0-9]{10}" maxlength="10" required placeholder="1234567890"> <br> <br>
Email адрес: <br>
<input type="Email" name="email" required> <br><br>
<input type = "submit" value="Подтвердить">
<input type="reset">
</form>';
echo $form;

View File

@ -1,42 +1,8 @@
<?php
require_once "form.php";
//require_once "src/Information.php";
//require_once "src/FullName.php";
//require_once "src/Contacts.php";
//require_once "src/AdditionallyInfo.php";
//require_once "info.php";
//require_once "table.php";
namespace src;
/*$flag = false;
require_once "vendor/autoload.php";
$surname = $_REQUEST["surname"];
$name = $_REQUEST["name"];
$patronymic = $_REQUEST["patronymic"];
$fullName = new FullName($surname, $name, $patronymic);
$fullName = $fullName->getFoolName();
$gender = $_REQUEST["gender"];
$dateOfBirth = $_REQUEST["dateOfBirth"];
$additionallyInfo = new AdditionallyInfo($dateOfBirth, $gender);
$additionallyInfo = $additionallyInfo->getAdditionallyInfo();
$countryCode = $_REQUEST["countryCode"];
$phoneNumber = $_REQUEST["phoneNumber"];
$email = $_REQUEST["email"];
$contacts = new Contacts($countryCode, $phoneNumber, $email);
$contacts = $contacts->getContacts();
$fullInformation = new Information($fullName, $additionallyInfo, $contacts);
$fullInformation = $fullInformation->getFullInformation();
$flag = isFullInfo($fullName, $additionallyInfo, $contacts);
if($flag) {
$file = fopen("Information.txt", "a");
fwrite($file, $fullInformation);
fclose($file);
} // if*/
require "views/post.php";
//require "views/form.php";

View File

@ -1,42 +1,20 @@
<?php
namespace src;
use src\debug\Debug;
use src\dto\InformationDTO;
use src\file_db_driver\FileDatabaseDriver;
use src\models\UserModel;
use Information;
require_once "vendor/autoload.php";
require_once "src/Information.php";
require_once "Search.php";
ini_set("display_errors", true);
error_reporting(-1);
$fileName = "Information.txt";
$fileModeOpen = "a";
//$fileName = "Information.txt";
//$fileModeOpen = "a";
$fullInformation = new Information();
$fullInformation->load($_REQUEST);
$user = new UserModel();
$user->load($_REQUEST);
$user->save();
echo "<pre>";
print_r($fullInformation);
$string = $fullInformation->toString();
$file = fopen($fileName, $fileModeOpen);
fwrite($file, $string);
fclose($file);
$file = fopen($fileName, "r");
$arrKey = array('surname', 'name', 'patronymic', 'dateOfBirth', 'gender', 'countryCode', 'phoneNumber', 'email');
$parsingArray = array();
while (!feof($file)) {
$str = fgets($file);
if(search($str, '/\b(иванов)\b/ui')){
$array = array_combine($arrKey, explode(";", $str));
$obj = new Information();
$obj->load($array);
$parsingArray[] = $obj;
}
}
echo "<pre>";
print_r($parsingArray);
require "table.php";
require "views/search.php";

17
mySimple.json Normal file
View File

@ -0,0 +1,17 @@
{
"meta": {
"title": "form 1",
"columns": {
"surname": "Фамилия",
"name": "Имя",
"patronymic":"Отчество",
"dateOfBirth": "Дата рождения",
"gender": "Пол",
"countryCode": "Код страны",
"phoneNumber": "Номер телефона",
"email": "Email"
},
"params": {"class": "table table-bordered", "border": "1"}
},
"data": []
}

26
post.php Normal file
View File

@ -0,0 +1,26 @@
<?php
use src\debug\Debug;
use src\dto\InformationDTO;
use src\file_db_driver\FileDatabaseDriver;
use src\models\PostModel;
use src\Processing;
require_once "vendor/autoload.php";
ini_set("display_errors", true);
error_reporting(-1);
$post = new PostModel();
$post->load($_REQUEST);
$post->save();
$post1 = new PostModel();
$res = $post1->find(['author' => ['Stas']])->limit(10)->all();
$json = new Processing();
$infArr = $json->createJsonArray($post->labels(), $res, "form2");
$table = new \Itguild\Tables\ListJsonTable($infArr);
$table->create();
$table->render();

6
post.txt Normal file
View File

@ -0,0 +1,6 @@
autoincrement=id;last_id=4;table_name=post
id;author;post
1;Stas;Hello, world!!!
2;Stas;Hello, world!!!
3;Stas;Hello,<br>My php<br>World!!!
4;Stas;Hello,<br>My php<br>World!!!

25
search.php Normal file
View File

@ -0,0 +1,25 @@
<?php
use src\dto\InformationDTO;
use src\Processing;
require_once "vendor/autoload.php";
ini_set("display_errors", true);
error_reporting(-1);
$user = new \src\models\UserModel();
//$res = $rep->find([$_REQUEST['key'] => $_REQUEST['result_search']])->limit(7)->all();
//$res = $rep->find($_REQUEST)->limit(10)->all();
$res = $user->find(['name' => ['Анжела']])->limit(10)->all();
$json = new Processing();
$infArr = $json->createJsonArray($user->labels(), $res, "form1");
$table = new \Itguild\Tables\ListJsonTable($infArr);
$table->create();
$table->render();

View File

@ -1,70 +0,0 @@
<?php
/**
* @property string $surname
* @property string $name
* @property string $patronymic
* @property string $dateOfBirth
* @property string $gender
* @property string $countryCode
* @property string $phoneNumber
* @property string $email
*/
class Information
{
public string $surname;
public string $name;
public string $patronymic;
public string $dateOfBirth;
public string $gender;
public string $countryCode;
public string $phoneNumber;
public string $email;
public function __construct()
{
}
/**
* @param array $dataArray
* @return void
*/
public function load(array $dataArray): void
{
if ($dataArray) {
$this->surname = $dataArray['surname'] ?? '';
$this->name = $dataArray['name'] ?? '';
$this->patronymic = $dataArray['patronymic'] ?? '';
$this->dateOfBirth = $dataArray['dateOfBirth'] ?? '';
$this->gender = $dataArray['gender'] ?? '';
$this->countryCode = $dataArray['countryCode'] ?? '';
$this->phoneNumber = $dataArray['phoneNumber'] ?? '';
$this->email = $dataArray['email'] ?? '';
}
}
/**
* @param string $key
* @return string|null
*/
public function getByKey(string $key): ?string
{
if (isset($this->{$key})) {
return $this->{$key};
}
return null;
}
/**
* @return string
*/
public function toString(): string
{
return $this->surname . ';' . $this->name . ';' . $this->patronymic . ';' . $this->dateOfBirth . ';' .
$this->gender . ';' . $this->countryCode . ';' . $this->phoneNumber . ';' . $this->email . "\n";
}
}

46
src/Processing.php Normal file
View File

@ -0,0 +1,46 @@
<?php
namespace src;
class Processing
{
public array $informationArray;
/**
* @param array $columns
* @param array $data
* @return string|null
*/
public function createJsonArray(array $columns, array $data, string $title): ?string
{
if($columns && $data) {
$this->informationArray = [
"meta" => [
"title" => $title,
"columns" => $columns,
"perPage" => 10,
"currentPage" => 1,
"params" =>
[
"class" => "table table-bordered",
"border" => "1"
]
],
"data" => $data
];
return $this->toJson($this->informationArray);
}
return null;
}
/**
* @param array $infArr
* @return string|null
*/
protected function toJson(array $infArr): ?string
{
if($infArr)
return json_encode($infArr,JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE);
return null;
}
}

View File

@ -0,0 +1,8 @@
<?php
namespace src\collections;
class BaseCollection
{
}

View File

@ -0,0 +1,10 @@
<?php
namespace src\collections;
class InformationCollection
{
public array $itemArr = [];
}

20
src/debug/Debug.php Normal file
View File

@ -0,0 +1,20 @@
<?php
namespace src\debug;
class Debug
{
public static function prn($content)
{
echo '<pre style="background: lightgray; border: 1px solid black; padding: 2px">';
print_r($content);
echo '</pre>';
}
public static function dd($content)
{
echo '<pre style="background: lightgray; border: 1px solid black; padding: 2px">';
print_r($content);
echo '</pre>';
die();
}
}

42
src/dto/BaseDTO.php Normal file
View File

@ -0,0 +1,42 @@
<?php
namespace src\dto;
#[\AllowDynamicProperties]
class BaseDTO
{
public int $id;
public function fillable(): array
{
return [];
}
public function load(array $array): void
{
if (is_array($array)) {
foreach ($array as $key => $value) {
$this->{$key} = $value;
}
}
}
public function toString(): string
{
return implode(";", $this->fillable());
}
/**
* @param string $key
* @return string|null
*/
public function getByKey(string $key): ?string
{
if (isset($this->{$key})) {
return $this->{$key};
}
return null;
}
}

View File

@ -0,0 +1,47 @@
<?php
namespace src\dto;
/**
* @property int $id
* @property string $surname
* @property string $name
* @property string $patronymic
* @property string $dateOfBirth
* @property string $gender
* @property string $countryCode
* @property string $phoneNumber
* @property string $email
*/
class InformationDTO extends BaseDTO
{
public int $id;
public string $surname;
public string $name;
public string $patronymic;
public string $dateOfBirth;
public string $gender;
public string $countryCode;
public string $phoneNumber;
public string $email;
public int $status = 0;
public function __construct()
{
}
/**
* @return array
*/
public function fillable(): array
{
// return [
// 'surname', 'name', 'patronymic', 'dateOfBirth', 'gender', 'countryCode', 'phoneNumber', 'email', 'status'
// ];
return [
$this->surname, $this->name, $this->patronymic, $this->dateOfBirth, $this->gender, $this->countryCode, $this->phoneNumber, $this->email, "\n"
];
}
}

View File

@ -0,0 +1,172 @@
<?php
namespace src\file_db_driver;
use src\debug\Debug;
class FileDatabaseDriver
{
public string $filePath;
public $file;
public array $headKeys = [];
public array $headValues = [];
private array $resArr = [];
private array $query = [];
private int $limitInt = 10;
public array $serviceInfo = [];
public function connect(string $filePath): bool
{
$this->filePath = $filePath;
if (file_exists($this->filePath)) {
$this->file = fopen($this->filePath, "a+");
if ($this->file) {
$this->getServiceInfo();
$this->setHeadKeys();
// $this->setHeadValues();
return true;
}
}
return false;
}
public function getServiceInfo(): void
{
$serviceInfo = explode(';', fgets($this->file));
foreach ($serviceInfo as $item){
$item = str_replace("\n", "", $item);
$item = str_replace("\r", "", $item);
$itemArr = explode("=", $item);
$this->serviceInfo[$itemArr[0]] = $itemArr[1];
}
}
public function setHeadKeys(): void
{
$headArr = explode(';', fgets($this->file));
foreach ($headArr as $item){
$item = str_replace("\n", "", $item);
$item = str_replace("\r", "", $item);
$this->headKeys[] = $item;
}
// $this->head = explode(';', fgets($this->file));
}
public function getHeadKeys(): array
{
return $this->headKeys;
}
// public function setHeadValues(): void
// {
// $headArr = explode(';', fgets($this->file));
// foreach ($headArr as $item){
// $item = str_replace("\n", "", $item);
// $item = str_replace("\r", "", $item);
// $this->headValues[] = $item;
// }
//// $this->head = explode(';', fgets($this->file));
// }
//
// public function getHeadValues(): array
// {
// return $this->headValues;
// }
public function find(array $query = []): self
{
foreach ($query as $key => $value) {
$this->query[$key] = $value;
}
return $this;
}
public function limit(int $limit): self
{
$this->limitInt = $limit;
return $this;
}
public function search(): array
{
$resArr = [];
$i = 1;
while (!feof($this->file)) {
if ($i > $this->limitInt) {
break;
}
$str = fgets($this->file);
if (!empty($str)) {
$str = str_replace("\n", "", $str);
$str = str_replace("\r", "", $str);
$item = explode(";", $str);
$item = array_combine($this->headKeys, $item);
$flag = false;
foreach ($this->query as $key => $value) {
foreach ($this->query[$key] as $k => $v) {
if ($this->searchInStr($v, $item, $key)) {
$flag = true;
break;
} else {
$flag = false;
}
}
if(!$flag) break;
}
if ($flag) {
$resArr[] = $item;
$i++;
}
}
}
return $resArr;
}
protected function searchInStr(string $strForSearch, array $item, string $column): ?array
{
if (isset($item[$column])) {
if (preg_match("/" . $strForSearch . "/", $item[$column])) {
return $item;
}
}
return null;
}
public function all(): array
{
$this->resArr = $this->search();
$this->close();
return $this->resArr;
}
public function close(): void
{
fclose($this->file);
}
public function save(string $string): void
{
$this->serviceInfo['last_id']++;
foreach ($this->serviceInfo as $key => $value) {
$arr[] = $key . '=' . $value;
}
$fileArr = file($this->filePath);
if (isset($arr)) {
$serviceStr = implode(';', $arr) . "\n";
}
$fileArr[0] = $serviceStr;
file_put_contents($this->filePath, $fileArr);
$str = $this->serviceInfo['last_id'] . ';' . str_replace("\r\n", "<br>", $string) . "\n";
fwrite($this->file, $str);
$this->close();
}
}

79
src/models/BaseModel.php Normal file
View File

@ -0,0 +1,79 @@
<?php
namespace src\models;
use src\debug\Debug;
use src\file_db_driver\FileDatabaseDriver;
#[\AllowDynamicProperties]
class BaseModel
{
protected FileDatabaseDriver $fdd;
// public int $id;
public function __construct()
{
$this->fdd = new FileDatabaseDriver();
$this->fdd->connect($this->file());
}
/**
* @return array
*/
public function fillable(): array
{
return [];
}
public function load(array $array): void
{
if (is_array($array)) {
foreach ($array as $key => $value) {
$this->{$key} = $value;
}
}
}
/**
* @return string
*/
public function file(): string
{
return "";
}
public function labels(): array
{
return [];
}
public function save(): void
{
$this->fdd->save($this->toString());
}
public function find(array $request = []): FileDatabaseDriver
{
return $this->fdd->find($request);
}
public function toString(): string
{
$str = '';
$lastItems = array_key_last($this->fdd->getHeadKeys());
foreach ($this->fdd->getHeadKeys() as $key => $value) {
if (isset($this->{$value})) {
if ($key === $lastItems) {
$str .= $this->{$value};
} else {
$str .= $this->{$value} . ";";
}
}
}
return $str;
}
}

31
src/models/PostModel.php Normal file
View File

@ -0,0 +1,31 @@
<?php
namespace src\models;
use src\models\BaseModel;
class PostModel extends BaseModel
{
public int $status = 1;
public function file(): string
{
return "post.txt";
}
public function fillable(): array
{
return [
'author', 'post'
];
}
public function labels(): array
{
return [
'author' => 'Автор',
'post' => 'Пост'
];
}
}

37
src/models/UserModel.php Normal file
View File

@ -0,0 +1,37 @@
<?php
namespace src\models;
class UserModel extends BaseModel
{
public int $status = 1;
public function file(): string
{
return "user.txt";
}
public function fillable(): array
{
return [
'surname', 'name', 'patronymic', 'dateOfBirth', 'gender', 'countryCode', 'phoneNumber', 'email', 'status'
];
}
public function labels(): array
{
return [
'surname' => 'Фамилия',
'name' => 'Имя',
'patronymic' => 'Отчество',
'dateOfBirth' => 'Дата рождения',
'gender' => 'Пол',
'countryCode' => 'Код страны',
'phoneNumber' => 'Номер телефона',
'email' => 'Email',
'status'=> 'Статус'
];
}
}

View File

@ -21,7 +21,7 @@
<body>
<?php
$file = fopen("Information.txt", "r");
function PrintStringOfTable($file)
function PrintStringOfTable($file): void
{
$buf = fgets($file, filesize("Information.txt")); ?>
<tr>

23
table2.php Normal file
View File

@ -0,0 +1,23 @@
<?php
use src\debug\Debug;
require_once "vendor/autoload.php";
$json = file_get_contents(__DIR__ . '/vendor/itguild/tables/simple.json');
$json2 = file_get_contents(__DIR__ . '/mySimple.json');
$table = new \Itguild\Tables\ListJsonTable($json);
$table2 = new \Itguild\Tables\ListJsonTable($json2);
$table->create();
$table->render();
$table2->create();
$table2->render();
//$table->beginTable();
/*echo "<pre>";
print_r($table);*/

21
user.txt Normal file
View File

@ -0,0 +1,21 @@
autoincrement=id;last_id=36;table_name=user
id;surname;name;patronymic;dateOfBirth;gender;countryCode;phoneNumber;email;status
3;Билай;Станислав;Романович;2002-03-11;Мужчина;+7;9493761924;stasbilay02@yandex.ru;0
4;Иванова;Мария;Сергеевна;2002-04-05;Женщина;+38;2222222222;sdguhnlnoih@gmail.com;1
5;Иванов;Иван;Иванович;2002-03-11;Мужчина;+7;1111111111;dsjgbdskgb@yandex.ru;1
6;Плешкова;Анастасия;Денисовна;2006-11-10;Женщина;+7;3333333333;ple.anastasiya@gmail.com;0
7;Зайцева;Анжела;Игоревна;1998-12-12;Женщина;+7;4444444444;aksjfhfka@mail.ru;0
8;Петров;Петр;Петрович;1987-03-02;Мужчина;+7;7777777777;jksghhsdkj@gmail.com;1
9;Зайцев;Федор;Александрович;2014-12-22;Мужчина;+7;6667774441;asert@mail.ru;1
10;Иванов;Петр;Михайлович;2002-03-11;Мужчина;+7;1111111111;asert@mail.ru;1
11;Иванов;Роман;Сергеевич;2002-03-11;Мужчина;+7;1111111111;ple.anastasiya@gmail.com;0
12;Билай;Станислав;Романович;4444-04-04;Мужчина;+7;9493761924;stasbilay02@yandex.ru;0
13;Билай;Станислав;Романович;4444-04-04;Мужчина;+7;9493761924;stasbilay02@yandex.ru;1
14;Билай;Станислав;Романович;4444-04-04;Мужчина;+7;9493761924;stasbilay02@yandex.ru;0
15;Билай;Станислав;Романович;4444-04-04;Мужчина;+7;9493761924;stasbilay02@yandex.ru;0
16;Билай;Станислав;Романович;4444-04-04;Женщина;+38;9493761924;stasbilay02@yandex.ru;0
17;Зайцева;Анжела;Игоревна;7777-07-07;Женщина;+7;4444444444;aksjfhfka@mail.ru;0
18;Зайцева;Анжела;Игоревна;7777-07-07;Женщина;+7;4444444444;aksjfhfka@mail.ru;1
19;Зайцева;Анжела;Игоревна;7777-07-07;Женщина;+7;4444444444;aksjfhfka@mail.ru;1
24;ddd;Кирилл;dfdf;2024-06-25;Мужчина;+7;9281234567;apuc06@mail.ru;1
36;ddd4;Кирилл;ddd4;2024-06-25;Мужчина;+7;9281234567;apuc06@mail.ru;1

48
views/form.php Normal file
View File

@ -0,0 +1,48 @@
<form action="../info.php" target="_blank" method="post">
Фамилия:<br>
<label>
<input type = "text" name = "surname" required size="50" autofocus placeholder="Фамилия">
</label> <br> <br>
Имя:<br>
<label>
<input type = "text" name = "name" required size="50" placeholder="Имя">
</label> <br> <br>
Отчество (если есть):<br>
<label>
<input type = "text" name = "patronymic" size="50" placeholder="Отчество">
</label> <br> <br>
Дата Рождения: <br>
<label>
<input type="date" name="dateOfBirth">
</label> <br> <br>
Ваш пол: <br>
<label>
<input type="radio" name="gender" value="Мужчина" checked>
</label> Мужчина
<label>
<input type="radio" name="gender" value="Женщина">
</label> Женжина<br> <br>
Номер телефона (Например 1234567890): <br>
<label>
<select name="countryCode">
<option value="+7" >Russia +7</option>
<option value="+38">Ukraine +38</option>
</select>
</label>
<label>
<input type="tel" name="phoneNumber" pattern="[0-9]{10}" maxlength="10" required placeholder="1234567890">
</label> <br> <br>
Email адрес: <br>
<label>
<input type="Email" name="email" required>
</label> <br><br>
<input type = "submit" value="Подтвердить">
<input type="reset">
</form>

14
views/post.php Normal file
View File

@ -0,0 +1,14 @@
<form action="post.php" target="_blank" method="post">
Автор:<br>
<label>
<input type = "text" name = "author" required size="50" autofocus placeholder="Автор">
</label> <br> <br>
Пост:<br>
<label>
<textarea name = "post" rows="10" cols="50" placeholder="Текст"></textarea>
</label> <br> <br>
<input type = "submit" value="Подтвердить">
<input type="reset">
</form>

43
views/search.php Normal file
View File

@ -0,0 +1,43 @@
<form action="../search.php" target="_blank" method="post">
<label>
<input type="search" placeholder="Фамилия" name="surname">
</label> <br> <br>
<label>
<input type="search" placeholder="Имя" name="name">
</label> <br> <br>
<label>
<input type="search" placeholder="Отчество" name="patronymic">
</label> <br> <br>
<label>
<input type="search" placeholder="Дата рождения(гггг-мм-дд)" name="dateOfBirth">
</label> <br> <br>
<label>
<input type="search" placeholder="Пол" name="gender">
</label> <br> <br>
<label>
<input type="search" placeholder="Код страны" name="countryCode">
</label> <br> <br>
<label>
<input type="search" placeholder="Номер телефона" name="phoneNumber">
</label> <br> <br>
<label>
<input type="search" placeholder="Email" name="email">
</label> <br> <br>
<label>
<input type="search" placeholder="Статус" name="status">
</label> <br> <br>
<!-- Среди чего найти? <br>-->
<!-- <label>-->
<!-- <select name="key">-->
<!-- <option value="surname">Фамилия</option>-->
<!-- <option value="name">Имя</option>-->
<!-- <option value="patronymic">Отчество</option>-->
<!-- <option value="dateOfBirth">Дата рождения</option>-->
<!-- <option value="gender">Пол</option>-->
<!-- <option value="countryCode">Код страны</option>-->
<!-- <option value="phoneNumber">Номер телефона</option>-->
<!-- <option value="email">Email</option>-->
<!-- </select>-->
<!-- </label> <br><br>-->
<input type="submit" value="Поиск">
</form>