diff --git a/app/controller/AboutController.php b/app/controller/AboutController.php deleted file mode 100644 index b3cdfa7..0000000 --- a/app/controller/AboutController.php +++ /dev/null @@ -1,17 +0,0 @@ - $result, - 'body' => 'ДОМОЙ!', - 'auth'=> false ], 'tpl_layout.php' )); - print("А теперь перерыв !!"); - } -} - - \ No newline at end of file diff --git a/app/controller/AdminController.php b/app/controller/AdminController.php new file mode 100644 index 0000000..3b4d526 --- /dev/null +++ b/app/controller/AdminController.php @@ -0,0 +1,15 @@ + ""], 'layout_admin.php' )); + } else { + header('Location: http://localhost:8080/login'); + } + } +} \ No newline at end of file diff --git a/app/controller/AuthController.php b/app/controller/AuthController.php new file mode 100644 index 0000000..c6d4352 --- /dev/null +++ b/app/controller/AuthController.php @@ -0,0 +1,38 @@ +login = $_POST['login']; + $this -> password = $_POST['password']; + } + + public function actionLogin(){ + + if (( $this->login == self::LOGIN ) AND ( $this -> password == self::PASSWD )) { + // редирект в админку + $_SESSION['IS_AUTH'] = true; + header("Location:". self::DOMAIN . "admin"); + } else { + // редирект на форму логина с предупреждением + header('Location:'. self::DOMAIN . "login" ); + } + } + + public function actionLogout(){ + session_unset(); + session_destroy(); + // echo('print Logout'); + header( 'Location:'. self::DOMAIN ); + } +} \ No newline at end of file diff --git a/app/controller/MainController.php b/app/controller/MainController.php index 30e351d..ec1fc72 100644 --- a/app/controller/MainController.php +++ b/app/controller/MainController.php @@ -1,6 +1,8 @@ $result ], 'index_tpl.php' )); } public function actionNotFound(){ diff --git a/app/controller/UploadController.php b/app/controller/UploadController.php new file mode 100644 index 0000000..642ef0a --- /dev/null +++ b/app/controller/UploadController.php @@ -0,0 +1,35 @@ + $portial ], 'layout_admin.php' )); + } else { + // var_dump() + header('Location: http://localhost:8080/login'); + } + } + public function actionAddfile(){ + + $uploaddir = '/home/vitaliy/project/itmo/php_engine/uploads/'; + $uploadfile = $uploaddir . basename($_FILES['userfile']['name']); + var_dump($uploadfile); + echo '
';
+        if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) 
+        {
+            echo "Файл не содержит ошибок и успешно загрузился на сервер.\n";
+        } else {
+            echo "Возможная атака на сервер через загрузку файла!\n";
+        }
+  }
+
+}
\ No newline at end of file
diff --git a/app/model/AboutModel.php b/app/model/AboutModel.php
deleted file mode 100644
index 584bd48..0000000
--- a/app/model/AboutModel.php
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
- - - - Отправить файл: - -
- - - - --> --> --> --> - --> --> diff --git a/app/template/index_tpl.php b/app/template/index_tpl.php index 1c93807..4958416 100644 --- a/app/template/index_tpl.php +++ b/app/template/index_tpl.php @@ -31,6 +31,58 @@ + +
+ + + +
+ +
+ + + +
+ + + + + + + + + + \ No newline at end of file diff --git a/app/template/admin.php b/app/template/layout_admin.php similarity index 74% rename from app/template/admin.php rename to app/template/layout_admin.php index 45769f2..dc73de4 100644 --- a/app/template/admin.php +++ b/app/template/layout_admin.php @@ -56,31 +56,29 @@
  • - + - Products + Загрузка
  • - + - Sign In - -
  • -
  • - - - Sign Up + Log Out
  • + + + + + + + + @@ -97,90 +95,14 @@

    - -

    -
    -
    -

    - -

    -
    - -
    -

    - -

    -
    -
    -
    -

    - -

    -
    -
    -

    - -

    -
    -
    -

    - -

    -
    -
    -

    - -

    -
    -
    -
    -

    - -

    -
    -
    -
    -

    - -

    -
    -
    -

    - -

    -
    -
    -

    - -

    -
    -
    -

    - + + + + + + + +

    diff --git a/app/template/login.php b/app/template/login.php index f3f3888..3de14e0 100644 --- a/app/template/login.php +++ b/app/template/login.php @@ -40,7 +40,8 @@ class="block w-full px-4 py-2 mt-2 text-purple-700 bg-white border rounded-md focus:border-purple-400 focus:ring-purple-300 focus:outline-none focus:ring focus:ring-opacity-40" - name="login"> + name="login" + value='none@none.ru'>
    @@ -49,7 +50,8 @@ class="block w-full px-4 py-2 mt-2 text-purple-700 bg-white border rounded-md focus:border-purple-400 focus:ring-purple-300 focus:outline-none focus:ring focus:ring-opacity-40" - name="password"> + name="password" + value=123>
    Forget Password?
    diff --git a/app/template/upload_tpl.php b/app/template/upload_tpl.php new file mode 100644 index 0000000..41b084d --- /dev/null +++ b/app/template/upload_tpl.php @@ -0,0 +1,11 @@ + + +
    + + + + + +
    + + diff --git a/archive/model_box.php b/archive/model_box.php deleted file mode 100644 index 9767ea6..0000000 --- a/archive/model_box.php +++ /dev/null @@ -1,15 +0,0 @@ - 'news/index', // actionIndex в NewsController 'products' => 'product/list', // actionList в ProductController - 'about' => 'about/index', 'login' => 'login/index', - "auth" => 'auth/index' + 'auth' => 'auth/login', + 'logout' => 'auth/logout', + 'admin' => 'admin/index', + 'upload' => 'upload/index', + 'file_upload' => 'upload/addfile' + ); diff --git a/upload/107_zuppe_uvertyura_k_opere_legkaya_kavaleriya.mp3 b/upload/107_zuppe_uvertyura_k_opere_legkaya_kavaleriya.mp3 deleted file mode 100644 index 70b154d..0000000 Binary files a/upload/107_zuppe_uvertyura_k_opere_legkaya_kavaleriya.mp3 and /dev/null differ diff --git a/upload/125_narodnaya_melodiya_zelenye_rukava.mp3 b/upload/125_narodnaya_melodiya_zelenye_rukava.mp3 deleted file mode 100644 index e63c294..0000000 Binary files a/upload/125_narodnaya_melodiya_zelenye_rukava.mp3 and /dev/null differ diff --git a/upload/1m98PsIsZ8Q.jpg b/upload/1m98PsIsZ8Q.jpg deleted file mode 100644 index 7e73804..0000000 Binary files a/upload/1m98PsIsZ8Q.jpg and /dev/null differ diff --git a/upload/photo_2024-12-22_23-12-08.jpg b/upload/photo_2024-12-22_23-12-08.jpg deleted file mode 100644 index ee6f806..0000000 Binary files a/upload/photo_2024-12-22_23-12-08.jpg and /dev/null differ