ver.0.3
This commit is contained in:
51
info.php
51
info.php
@ -2,10 +2,12 @@
|
||||
|
||||
namespace src;
|
||||
|
||||
use Information;
|
||||
use src\debug\Debug;
|
||||
use src\file_db_driver\FileDatabaseDriver;
|
||||
use src\Information;
|
||||
use src\Forms;
|
||||
|
||||
require_once "src/Information.php";
|
||||
/*require_once "Search.php";*/
|
||||
require_once "vendor/autoload.php";
|
||||
|
||||
$fileName = "Information.txt";
|
||||
$fileModeOpen = "a";
|
||||
@ -13,44 +15,11 @@ $fileModeOpen = "a";
|
||||
$fullInformation = new Information();
|
||||
$fullInformation->load($_REQUEST);
|
||||
|
||||
echo "<pre>";
|
||||
print_r($fullInformation);
|
||||
$string = $fullInformation->toString();
|
||||
|
||||
$file = fopen($fileName, $fileModeOpen);
|
||||
fwrite($file, $string);
|
||||
fclose($file);
|
||||
$obj = new FileDatabaseDriver();
|
||||
$obj->connect(__DIR__ . "/Information.txt");
|
||||
$obj->save($string);
|
||||
$obj->close();
|
||||
|
||||
$formSearch =
|
||||
'<form action="search_result.php" target="_blank" method="post">
|
||||
<input type="search" name="result_search"> <br> <br>
|
||||
<input type="submit" value="Поиск">
|
||||
</form>';
|
||||
|
||||
echo $formSearch;
|
||||
|
||||
/*$file = fopen($fileName, "r");
|
||||
|
||||
$arrKey = array('surname', 'name', 'patronymic', 'dateOfBirth', 'gender', 'countryCode', 'phoneNumber', 'email');
|
||||
|
||||
$parsingArray = array();
|
||||
|
||||
echo "<pre>";
|
||||
print_r($_REQUEST);
|
||||
|
||||
$forSearch = $_REQUEST['result_search'];
|
||||
|
||||
while (!feof($file)) {
|
||||
$str = fgets($file);
|
||||
//if(search($str, '/\b(иванов)\b/ui')){
|
||||
if(search($str, $forSearch)){
|
||||
$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";
|
Reference in New Issue
Block a user