This commit is contained in:
Билай Станислав 2024-05-20 15:11:17 +03:00
parent 6744d4e537
commit 8f07ea82bc
10 changed files with 161 additions and 35 deletions

View File

@ -1,6 +1,7 @@
Билай Станислав Романович;Мужчина;2002-03-11;+79493761924;stasbilay02@yandex.ru; Билай Станислав Романович; 2002-03-11; Мужчина; +79493761924; stasbilay02@yandex.ru;
Петров Петр Петрович;Мужчина;1234-12-12;+77777777777;jksghhsdkj@gmail.com; Иванов Иван Иванович; 2002-03-11; Мужчина; +71111111111; dsjgbdskgb@yandex.ru;
Петров Петр Петрович;Мужчина;1234-02-23;+77777777777;jksghhsdkj@gmail.com; Иванова Мария Сергеевна; 2002-04-05; Женжина; +382222222222; sdguhnlnoih@gmail.com;
Зайцева Анжела Игоревна;Мужчина;1999-05-05;+74444444444;aksjfhfka@mail.ru; Плешкова Анастасия Денисовна; 2006-11-10; Женжина; +73333333333; ple.anastasiya@gmail.com;
Билай Станислав Романович;Мужчина;1234-12-12;+79493761924;stasbilay02@yandex.ru; Зайцева Анжела Игоревна; 1998-12-12; Женжина; +74444444444; aksjfhfka@mail.ru;
Зайцева Анжела Игоревна;Мужчина;1234-12-12;+74444444444;aksjfhfka@mail.ru; Петров Петр Петрович; 1987-03-02; Мужчина; +77777777777; jksghhsdkj@gmail.com;
Зайцев Федор Александрович; 2014-12-22; Мужчина; +76667774441; asert@mail.ru;

View File

@ -5,7 +5,7 @@
<title>Form ФИО</title> <title>Form ФИО</title>
</head> </head>
<body> <body>
<form action="src\info.php" target="_blank" method="post"> <form action="index.php" target="_blank" method="post">
Фамилия: <br> Фамилия: <br>
<input type = "text" name = "surname" required size="50" autofocus placeholder="Фамилия"> <br> <br> <input type = "text" name = "surname" required size="50" autofocus placeholder="Фамилия"> <br> <br>
Имя: <br> Имя: <br>

View File

@ -1 +1,5 @@
<?php <?php
function isFullInfo($fullName, $additionallyInfo, $contacts)
{
return strlen($fullName) > 1 && strlen($additionallyInfo) > 1 && strlen($contacts) > 1 ? true : false;
} // isFullInfo

View File

@ -1,13 +1,43 @@
<?php <?php
use src\fullName; require_once "form.html";
use src\Information;
//require_once "src/form.html";
require_once "src/Information.php"; require_once "src/Information.php";
require_once "src/fullName.php"; require_once "src/fullName.php";
require_once "src/contacts.php";
require_once "src/additionallyInfo.php";
//require_once "info.php";
require_once "table.php";
require_once "functions.php";
$fullName = new fullName('Билай', 'Станислав', 'Романович'); $flag = false;
$fn = $fullName->foolName();
$p1 = new Information($fn, 'hfd', '11', '+7', '11111111', 'ashg@ajhi'); $surname = $_REQUEST["surname"];
$p1->writeInformation(); $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();
$p1 = new Information($fullName, $additionallyInfo, $contacts);
$fullInformation = $p1->getFullInformation();
$flag = isFullInfo($fullName, $additionallyInfo, $contacts);
if($flag) {
$file = fopen("Information.txt", "a");
fwrite($file, $fullInformation);
fclose($file);
} // if

View File

@ -1 +1,34 @@
<?php <?php
/*$flag = false;
$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();
$p1 = new Information($fullName, $additionallyInfo, $contacts);
$fullInformation = $p1->getFullInformation();
$flag = isFullInfo($fullName, $additionallyInfo, $contacts);
if($flag) {
$file = fopen("Information.txt", "a");
fwrite($file, $fullInformation);
fclose($file);
} // if
*/

View File

@ -4,25 +4,19 @@
class Information class Information
{ {
public $foolName; public $foolName;
public $gender; public $additionallyInfo;
public $DateOfBirthday; public $contacts;
public $countryCode;
public $phoneNumber;
public $email;
public function __construct($foolName, $gender, $DateOfBirthday, $countryCode, $phoneNumber, $email) public function __construct($foolName, $additionallyInfo, $contacts)
{ {
$this->foolName = $foolName; $this->foolName = $foolName;
$this->gender = $gender; $this->additionallyInfo = $additionallyInfo;
$this->DateOfBirthday = $DateOfBirthday; $this->contacts = $contacts;
$this->countryCode = $countryCode;
$this->phoneNumber = $phoneNumber;
$this->email = $email;
} }
public function fullInformation() public function getFullInformation()
{ {
return $this->foolName . ";" . $this->gender . ";" . $this->DateOfBirthday . ";" . $this->countryCode . $this->phoneNumber . ";" . $this->email . ";"; return $this->foolName . ";" . $this->additionallyInfo . ";" . $this->contacts . ";\n";
} }
} }

View File

@ -2,5 +2,11 @@
class additionallyInfo class additionallyInfo
{ {
public $additionallyInfo;
public function __construct($b_day, $gender) {
$this->additionallyInfo = $b_day . ";" . $gender;
}
public function getAdditionallyInfo() {
return $this->additionallyInfo;
}
} }

View File

@ -1,6 +1,13 @@
<?php <?php
class contacnts class contacts
{ {
public $contacts;
public function __construct($countryCode, $phoneNumber, $email){
$this->contacts = $countryCode . $phoneNumber . ";" . $email;
}
public function getContacts(){
return $this->contacts;
}
} }

View File

@ -1,17 +1,14 @@
<?php <?php
class fullName class fullName
{ {
public $surname;
public $name; public $name;
public $patronymic;
public function __construct($surname, $name, $patronymic) public function __construct($surname, $name, $patronymic)
{ {
$this->name = $surname . " " . $name . " " . $patronymic; $this->name = $surname . " " . $name . " " . $patronymic;
} }
public function foolName() public function getFoolName()
{ {
return $this->name; return $this->name;
} }

View File

@ -1 +1,55 @@
<?php <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Information table</title>
<style>
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
th {
padding: 10px;
}
td {
padding: 5px;
text-align: left;
}
tr:hover {background-color: #d6eeee}
</style>
</head>
<body>
<?php
$file = fopen("Information.txt", "r");
function PrintStringOfTable($file)
{
$buf = fgets($file, filesize("Information.txt")); ?>
<tr>
<?php $tok = strtok($buf, ";\n");
while ($tok != null) { ?>
<td> <?php echo $tok ?> </td>
<?php $tok = strtok(";\n");
} // while
?>
</tr>
<?php
} // PrintStringOfTable
?>
<caption>Инфрмацмонная таблица </caption>
<table style="width: 100%">
<tr>
<th>ФИО</th>
<th>Дата рождения</th>
<th>Пол</th>
<th>Номер Телефона</th>
<th>Email</th>
</tr>
<?php
while (!feof($file)) {
PrintStringOfTable($file);
} // while
?>
</table>
<?php fclose($file); ?>
</body>
</html>