third
This commit is contained in:
parent
6744d4e537
commit
8f07ea82bc
@ -1,6 +1,7 @@
|
||||
Билай Станислав Романович;Мужчина;2002-03-11;+79493761924;stasbilay02@yandex.ru;
|
||||
Петров Петр Петрович;Мужчина;1234-12-12;+77777777777;jksghhsdkj@gmail.com;
|
||||
Петров Петр Петрович;Мужчина;1234-02-23;+77777777777;jksghhsdkj@gmail.com;
|
||||
Зайцева Анжела Игоревна;Мужчина;1999-05-05;+74444444444;aksjfhfka@mail.ru;
|
||||
Билай Станислав Романович;Мужчина;1234-12-12;+79493761924;stasbilay02@yandex.ru;
|
||||
Зайцева Анжела Игоревна;Мужчина;1234-12-12;+74444444444;aksjfhfka@mail.ru;
|
||||
Билай Станислав Романович; 2002-03-11; Мужчина; +79493761924; stasbilay02@yandex.ru;
|
||||
Иванов Иван Иванович; 2002-03-11; Мужчина; +71111111111; dsjgbdskgb@yandex.ru;
|
||||
Иванова Мария Сергеевна; 2002-04-05; Женжина; +382222222222; sdguhnlnoih@gmail.com;
|
||||
Плешкова Анастасия Денисовна; 2006-11-10; Женжина; +73333333333; ple.anastasiya@gmail.com;
|
||||
Зайцева Анжела Игоревна; 1998-12-12; Женжина; +74444444444; aksjfhfka@mail.ru;
|
||||
Петров Петр Петрович; 1987-03-02; Мужчина; +77777777777; jksghhsdkj@gmail.com;
|
||||
Зайцев Федор Александрович; 2014-12-22; Мужчина; +76667774441; asert@mail.ru;
|
||||
|
@ -5,7 +5,7 @@
|
||||
<title>Form ФИО</title>
|
||||
</head>
|
||||
<body>
|
||||
<form action="src\info.php" target="_blank" method="post">
|
||||
<form action="index.php" target="_blank" method="post">
|
||||
Фамилия: <br>
|
||||
<input type = "text" name = "surname" required size="50" autofocus placeholder="Фамилия"> <br> <br>
|
||||
Имя: <br>
|
||||
|
@ -1 +1,5 @@
|
||||
<?php
|
||||
function isFullInfo($fullName, $additionallyInfo, $contacts)
|
||||
{
|
||||
return strlen($fullName) > 1 && strlen($additionallyInfo) > 1 && strlen($contacts) > 1 ? true : false;
|
||||
} // isFullInfo
|
||||
|
46
index.php
46
index.php
@ -1,13 +1,43 @@
|
||||
<?php
|
||||
|
||||
use src\fullName;
|
||||
use src\Information;
|
||||
|
||||
//require_once "src/form.html";
|
||||
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 "info.php";
|
||||
require_once "table.php";
|
||||
require_once "functions.php";
|
||||
|
||||
$fullName = new fullName('Билай', 'Станислав', 'Романович');
|
||||
$fn = $fullName->foolName();
|
||||
$p1 = new Information($fn, 'hfd', '11', '+7', '11111111', 'ashg@ajhi');
|
||||
$p1->writeInformation();
|
||||
$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
|
||||
|
33
info.php
33
info.php
@ -1 +1,34 @@
|
||||
<?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
|
||||
*/
|
@ -4,25 +4,19 @@
|
||||
class Information
|
||||
{
|
||||
public $foolName;
|
||||
public $gender;
|
||||
public $DateOfBirthday;
|
||||
public $countryCode;
|
||||
public $phoneNumber;
|
||||
public $email;
|
||||
public $additionallyInfo;
|
||||
public $contacts;
|
||||
|
||||
public function __construct($foolName, $gender, $DateOfBirthday, $countryCode, $phoneNumber, $email)
|
||||
public function __construct($foolName, $additionallyInfo, $contacts)
|
||||
{
|
||||
$this->foolName = $foolName;
|
||||
$this->gender = $gender;
|
||||
$this->DateOfBirthday = $DateOfBirthday;
|
||||
$this->countryCode = $countryCode;
|
||||
$this->phoneNumber = $phoneNumber;
|
||||
$this->email = $email;
|
||||
$this->additionallyInfo = $additionallyInfo;
|
||||
$this->contacts = $contacts;
|
||||
}
|
||||
|
||||
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";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,5 +2,11 @@
|
||||
|
||||
class additionallyInfo
|
||||
{
|
||||
|
||||
public $additionallyInfo;
|
||||
public function __construct($b_day, $gender) {
|
||||
$this->additionallyInfo = $b_day . ";" . $gender;
|
||||
}
|
||||
public function getAdditionallyInfo() {
|
||||
return $this->additionallyInfo;
|
||||
}
|
||||
}
|
@ -1,6 +1,13 @@
|
||||
<?php
|
||||
|
||||
class contacnts
|
||||
class contacts
|
||||
{
|
||||
public $contacts;
|
||||
public function __construct($countryCode, $phoneNumber, $email){
|
||||
$this->contacts = $countryCode . $phoneNumber . ";" . $email;
|
||||
}
|
||||
|
||||
public function getContacts(){
|
||||
return $this->contacts;
|
||||
}
|
||||
}
|
@ -1,17 +1,14 @@
|
||||
<?php
|
||||
|
||||
|
||||
class fullName
|
||||
{
|
||||
public $surname;
|
||||
public $name;
|
||||
public $patronymic;
|
||||
|
||||
public function __construct($surname, $name, $patronymic)
|
||||
{
|
||||
$this->name = $surname . " " . $name . " " . $patronymic;
|
||||
}
|
||||
public function foolName()
|
||||
public function getFoolName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
56
table.php
56
table.php
@ -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>
|
Loading…
Reference in New Issue
Block a user