dir = $dir; } public function GetFileList($filtr){ $fileList = array(); $fileList = glob($this->dir.$filtr); return $fileList; } public function GetTextFileContent($file){ $userContent = array(); $handle = @fopen($file, "r"); $userContent[] = fgets($handle); return $userContent; } } class Person{ private $email; private $name; private $date; private $site; public function __construct($email, $name, $date, $site){ $this->email = $email; $this->name = $name; $this->date = $date; $this->site = $site; } public function GetNormalMail(){ return $this->email; } public function GetNormalName(){ return $this->name; } public function GetNormalDate(){ return $this->date; } public function GetNormalSite(){ return $this->site; } public function GetMail(){ $newMail = $this->ConversEmail(); return $newMail; } public function GetName(){ return $this->name; } public function GetDate(){ $newDate = $this->ConversDate(); return $newDate; } public function GetSite(){ $newSite = $this->ConversSite(); return $newSite; } private function ConversEmail() { if (substr($this->email, 0, 4) == "www.") return "email, 4)."\">Отправить e-mail ".$this->name.""; else if (substr($this->email, 0, 11) == "http://www.") return "email, 11)."\">Отправить e-mail ".$this->name.""; else if (substr($this->email, 0, 7) == "http://") return "email, 7)."\">Отправить e-mail ".$this->name.""; else return "email."\">Отправить e-mail ".$this->name.""; } private function ConversDate(){ return date("F j, Y", $this->date); } private function ConversSite(){ if (substr($this->site, 0, 4) == "www.") return "site."\">"; else if (substr($this->site, 0, 11) == "http://www.") return "site, 11)."\">"; else if (substr($this->site, 0, 7) == "http://") return "site, 7)."\">"; else return "site."\">"; } public function &GetPersonData(){ $user = array(); $user['mail'] = $this->email; $user['FIO'] = $this->name; $user['date'] = $this->date; $user['site'] = $this->site; return $user; } } class DataBase{ private static $number = 1; private $link; public function __construct($nameDataBase, $host, $admin, $password){ $this->link = mysql_connect("$host", "$admin", "$password"); mysql_select_db($nameDataBase); } public function INSERT_ONE_PERSON($person){ $number2 = self::$number; $mail = $person->GetMail(); $res = mysql_query("INSERT INTO `persons`(`id`, `mail`, `FIO`, `date`, `site`) VALUES ($number2, $mail, $person->GetFIO(), $person->GetDate(), $person->GetSite())"); self::$number++; } public function INSERT_PERSONS($persons){ foreach($persons as $key->$value){ $person = $persons[$key]; INSERT_ONE_PERSON($person); } } } $db = new DataBase('newdatabase', 'localhost', 'root', ''); $person = new person("wew@mail.ru", "WE", "29.12.1995", "fghrr.com"); $db->INSERT_ONE_PERSON($person); $res = mysql_query("SELECT * FROM `persons` WHERE `id` = 1"); while($row = mysql_fetch_assoc($res)) var_dump($row); ?>