I apologize to the PHP Professionals. How best to implement the definition of the request and content upload. I now have it all works as follows.
Template:
<?php include('classes/content.php'); if(!isset($_GET['show'])){ $show = 'main'; } else { $show = addslashes(strip_tags(trim($_GET['show']))); } $data = new Content; $result = $data->get_content($show); ?> <!DOCTYPE html> <html> <head> <title><?=$result["title"]?></title> <link rel="shortcut icon" href="icons/favicon.ico" type="image/x-icon" /> <link href="http://yandex.st/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet"> <link href="css/style.css" rel="stylesheet"> </head> <body> <div class="panel panel-default islogged"> <div class="panel-body"> <div class="admin_menu"> <a href="/">Главная</a> <a href="/edit">Редактирование</a> <a href="/?logout" style="color: red">Выход</a> </div> <hr> <?=$result["text"]?> </div> </div> </body> </html>
Class:
<?php class Content { public $connection = null; public function get_content ($show) { //Connection $this->connection = new mysqli(host,login,password,name); $this->connection->set_charset('utf8'); //Check connection if(!$this->connection->connect_errno) { //Check page $query = $this->connection->query("SELECT title, text FROM content WHERE name = '$show'"); //Check exist page if($query->num_rows == 1) { return $query->fetch_array(MYSQLI_ASSOC); } else { return array( "title" => "Ошибка", "text" => "Такой страницы не существует", ); } } else { return array( "title" => "Ошибка", "text" => "Ошибка подключения к базе", ); } } } ?>