This commit is contained in:
Билай Станислав 2024-05-21 11:53:40 +03:00
parent 8f07ea82bc
commit 8254407aae
12 changed files with 122 additions and 79 deletions

View File

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

View File

@ -5,7 +5,7 @@
<title>Form ФИО</title>
</head>
<body>
<form action="index.php" target="_blank" method="post">
<!--<form action="info.php" target="_blank" method="post">
Фамилия: <br>
<input type = "text" name = "surname" required size="50" autofocus placeholder="Фамилия"> <br> <br>
Имя: <br>
@ -14,7 +14,7 @@
<input type = "text" name = "patronymic" size="50" placeholder="Отчество"> <br> <br>
Дата Рождения: <br>
<input type="date" name="DateOfBirth" required> <br> <br>
<input type="date" name="dateOfBirth" required> <br> <br>
Ваш пол: <br>
<input type="radio" name="gender" value="Мужчина" checked> Мужчина
@ -32,6 +32,6 @@
<input type = "submit" value="Подтвердить">
<input type="reset">
</form>
</form>-->
</body>
</html>

29
form.php Normal file
View File

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

View File

@ -1,38 +1,37 @@
<?php
require_once "form.html";
require_once "src/Information.php";
require_once "src/fullName.php";
require_once "src/contacts.php";
require_once "src/additionallyInfo.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";
require_once "functions.php";
//require_once "table.php";
$flag = false;
/*$flag = false;
$surname = $_REQUEST["surname"];
$name = $_REQUEST["name"];
$patronymic = $_REQUEST["patronymic"];
$fullName = new fullName($surname, $name, $patronymic);
$fullName = new FullName($surname, $name, $patronymic);
$fullName = $fullName->getFoolName();
$gender = $_REQUEST["gender"];
$DateOfBirth = $_REQUEST["DateOfBirth"];
$dateOfBirth = $_REQUEST["dateOfBirth"];
$additionallyInfo = new additionallyInfo($DateOfBirth, $gender);
$additionallyInfo = new AdditionallyInfo($dateOfBirth, $gender);
$additionallyInfo = $additionallyInfo->getAdditionallyInfo();
$countryCode = $_REQUEST["countryCode"];
$phoneNumber = $_REQUEST["phoneNumber"];
$email = $_REQUEST["email"];
$contacts = new contacts($countryCode, $phoneNumber, $email);
$contacts = new Contacts($countryCode, $phoneNumber, $email);
$contacts = $contacts->getContacts();
$p1 = new Information($fullName, $additionallyInfo, $contacts);
$fullInformation = $p1->getFullInformation();
$fullInformation = new Information($fullName, $additionallyInfo, $contacts);
$fullInformation = $fullInformation->getFullInformation();
$flag = isFullInfo($fullName, $additionallyInfo, $contacts);
@ -40,4 +39,4 @@ if($flag) {
$file = fopen("Information.txt", "a");
fwrite($file, $fullInformation);
fclose($file);
} // if
} // if*/

View File

@ -1,34 +1,41 @@
<?php
/*$flag = false;
namespace src;
use AdditionallyInfo;
use Contacts;
use FullName;
use Information;
require_once "src/Information.php";
require_once "src/FullName.php";
require_once "src/Contacts.php";
require_once "src/AdditionallyInfo.php";
$surname = $_REQUEST["surname"];
$name = $_REQUEST["name"];
$patronymic = $_REQUEST["patronymic"];
$fullName = new fullName($surname, $name, $patronymic);
$fullName = new FullName($surname, $name, $patronymic);
$fullName = $fullName->getFoolName();
$gender = $_REQUEST["gender"];
$DateOfBirth = $_REQUEST["DateOfBirth"];
$dateOfBirth = $_REQUEST["dateOfBirth"];
$additionallyInfo = new additionallyInfo($DateOfBirth, $gender);
$additionallyInfo = new AdditionallyInfo($dateOfBirth, $gender);
$additionallyInfo = $additionallyInfo->getAdditionallyInfo();
$countryCode = $_REQUEST["countryCode"];
$phoneNumber = $_REQUEST["phoneNumber"];
$email = $_REQUEST["email"];
$contacts = new contacts($countryCode, $phoneNumber, $email);
$contacts = new Contacts($countryCode, $phoneNumber, $email);
$contacts = $contacts->getContacts();
$p1 = new Information($fullName, $additionallyInfo, $contacts);
$fullInformation = $p1->getFullInformation();
$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
*/
$file = fopen("Information.txt", "a");
fwrite($file, $fullInformation);
fclose($file);
require "table.php";

14
src/AdditionallyInfo.php Normal file
View File

@ -0,0 +1,14 @@
<?php
class AdditionallyInfo
{
public $bDay;
public $gender;
public function __construct($bDay, $gender) {
$this->bDay = $bDay;
$this->gender = $gender;
}
public function getAdditionallyInfo() {
return $this->bDay . ";" . $this->gender;
}
}

17
src/Contacts.php Normal file
View File

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

19
src/FullName.php Normal file
View File

@ -0,0 +1,19 @@
<?php
class FullName
{
public $surname;
public $name;
public $patronymic;
public function __construct($surname, $name, $patronymic)
{
$this->surname = $surname;
$this->name = $name;
$this->patronymic = $patronymic;
}
public function getFoolName()
{
return $this->surname . ' ' . $this->name . ' ' . $this->patronymic;
}
}

View File

@ -1,12 +0,0 @@
<?php
class additionallyInfo
{
public $additionallyInfo;
public function __construct($b_day, $gender) {
$this->additionallyInfo = $b_day . ";" . $gender;
}
public function getAdditionallyInfo() {
return $this->additionallyInfo;
}
}

View File

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

View File

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