diff --git a/.github/workflows/Nhom_2_Web_Nang_Cao b/.github/workflows/Nhom_2_Web_Nang_Cao new file mode 100644 index 000000000..18a6a3e3d --- /dev/null +++ b/.github/workflows/Nhom_2_Web_Nang_Cao @@ -0,0 +1,36 @@ +# This is a basic workflow to help you get started with Actions + +name: CI + +# Controls when the workflow will run +on: + # Triggers the workflow on push or pull request events but only for the "main" branch + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v3 + + # Runs a single command using the runners shell + - name: Run a one-line script + run: echo Hello, world! + + # Runs a set of commands using the runners shell + - name: Run a multi-line script + run: | + echo Add other actions to build, + echo test, and deploy your project. diff --git a/README.md b/README.md index 6eaa82ecb..98123b176 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ # Try Out Development Containers: PHP +Team members: +"Nguyễn Mạnh Hưng", +"Văn Công Minh" + [![Open in Dev Containers](https://img.shields.io/static/v1?label=Dev%20Containers&message=Open&color=blue&logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/microsoft/vscode-remote-try-php) A **development container** is a running container with a well-defined tool/runtime stack and its prerequisites. You can try out development containers with **[GitHub Codespaces](https://github.com/features/codespaces)** or **[Visual Studio Code Dev Containers](https://aka.ms/vscode-remote/containers)**. diff --git a/baiTap/tuan1/index.php b/baiTap/tuan1/index.php new file mode 100644 index 000000000..95151c254 --- /dev/null +++ b/baiTap/tuan1/index.php @@ -0,0 +1,26 @@ + + + + + + + + + + Web n�ng cao + + + + + + + + + + + + \ No newline at end of file diff --git a/baiTap/tuan1/logged_in.php b/baiTap/tuan1/logged_in.php new file mode 100644 index 000000000..24e857e4e --- /dev/null +++ b/baiTap/tuan1/logged_in.php @@ -0,0 +1,49 @@ + + + + + + + + + + Web n�ng cao + + + + + + + +
+
+ + +
+
+ + +
+
+ + + + \ No newline at end of file diff --git a/baiTap/tuan1/login.php b/baiTap/tuan1/login.php new file mode 100644 index 000000000..61e00aa8f --- /dev/null +++ b/baiTap/tuan1/login.php @@ -0,0 +1,20 @@ +
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+ +
+
+
diff --git a/baiTap/tuan3/databases/db_test.sql b/baiTap/tuan3/databases/db_test.sql new file mode 100644 index 000000000..02886df73 --- /dev/null +++ b/baiTap/tuan3/databases/db_test.sql @@ -0,0 +1,51 @@ +-- -------------------------------------------------------- +-- Host: 127.0.0.1 +-- Server version: 11.3.2-MariaDB - mariadb.org binary distribution +-- Server OS: Win64 +-- HeidiSQL Version: 12.6.0.6765 +-- -------------------------------------------------------- + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET NAMES utf8 */; +/*!50503 SET NAMES utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + + +-- Dumping database structure for db_test +CREATE DATABASE IF NOT EXISTS `db_test` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci */; +USE `db_test`; + +-- Dumping structure for table db_test.images +CREATE TABLE IF NOT EXISTS `images` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `path` varchar(255) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `path` (`path`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +-- Dumping data for table db_test.images: ~0 rows (approximately) +DELETE FROM `images`; + +-- Dumping structure for table db_test.users +CREATE TABLE IF NOT EXISTS `users` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `username` varchar(50) NOT NULL, + `password` varchar(50) NOT NULL, + PRIMARY KEY (`id`) USING BTREE, + UNIQUE KEY `username` (`username`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +-- Dumping data for table db_test.users: ~0 rows (approximately) +DELETE FROM `users`; + +INSERT INTO `users` (`id`, `username`, `password`) VALUES (1, 'admin', 'f865b53623b121fd34ee5426c792e5c33af8c227'); + +/*!40103 SET TIME_ZONE=IFNULL(@OLD_TIME_ZONE, 'system') */; +/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */; +/*!40014 SET FOREIGN_KEY_CHECKS=IFNULL(@OLD_FOREIGN_KEY_CHECKS, 1) */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40111 SET SQL_NOTES=IFNULL(@OLD_SQL_NOTES, 1) */; diff --git a/baiTap/tuan3/db_connect.php b/baiTap/tuan3/db_connect.php new file mode 100644 index 000000000..b2490a44a --- /dev/null +++ b/baiTap/tuan3/db_connect.php @@ -0,0 +1,8 @@ +connect_error) { + die("Connection failed: " . $db->connect_error); + } +?> \ No newline at end of file diff --git a/baiTap/tuan3/delete.php b/baiTap/tuan3/delete.php new file mode 100644 index 000000000..26c4a0d0e --- /dev/null +++ b/baiTap/tuan3/delete.php @@ -0,0 +1,22 @@ +query($query) === TRUE) { + echo "Record deleted successfully"; + } else { + echo "Error deleting record: " . $db->error; + } + + header("Location: home.php"); +} +?> diff --git a/baiTap/tuan3/filelist.php b/baiTap/tuan3/filelist.php new file mode 100644 index 000000000..c370a05c2 --- /dev/null +++ b/baiTap/tuan3/filelist.php @@ -0,0 +1,32 @@ +'; + echo 'File Type: ' . mime_content_type('uploads/' . $file) . '
'; + echo 'Upload Time: ' . date ("F d Y H:i:s.", filemtime('uploads/' . $file)) . '
'; + echo 'File Size: ' . filesize('uploads/' . $file) . '

'; + echo '
+ + +
'; +} + +echo 'Sort by Name
'; +echo 'Sort by Date
'; +?> diff --git a/baiTap/tuan3/home.php b/baiTap/tuan3/home.php new file mode 100644 index 000000000..b715c88ea --- /dev/null +++ b/baiTap/tuan3/home.php @@ -0,0 +1,27 @@ + + + + + + + Tuần 3 + + + + +
+
+
+ +
+
+
+ + \ No newline at end of file diff --git a/baiTap/tuan3/login.php b/baiTap/tuan3/login.php new file mode 100644 index 000000000..ecc1cf7e5 --- /dev/null +++ b/baiTap/tuan3/login.php @@ -0,0 +1,40 @@ + + + + + + + Đăng nhập + + +
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+ +
+
+
+ alert("' . $_GET['error'] . '");'; + } + ?> + + \ No newline at end of file diff --git a/baiTap/tuan3/logout.php b/baiTap/tuan3/logout.php new file mode 100644 index 000000000..3f11acefd --- /dev/null +++ b/baiTap/tuan3/logout.php @@ -0,0 +1,5 @@ + diff --git a/baiTap/tuan3/upload.php b/baiTap/tuan3/upload.php new file mode 100644 index 000000000..aee85dcf3 --- /dev/null +++ b/baiTap/tuan3/upload.php @@ -0,0 +1,49 @@ + + +
+ Select file to upload: + + +
+
+ +
+ +query("SELECT MAX(id) AS max_id FROM images"); + + if ($result->num_rows > 0) { + $row = $result->fetch_assoc(); + + $max_id = $row['max_id']; + + if (isset($max_id)) { + $_SESSION['index'] = $max_id + 1; + } else { + $_SESSION['index'] = 1; + } + } else { + $_SESSION['index'] = 1; + } + $id = $_SESSION['index']; + $query = "INSERT INTO images (id, path) VALUES ('$id', '$target_file')"; + if ($db->query($query) === TRUE) { + echo "New record created successfully"; + } else { + echo "Error: " . $query . "
" . $db->error; + } + } else { + echo "Sorry, there was an error uploading your file."; + } +} +?> diff --git a/baiTap/tuan3/uploads/dog_hehe.png b/baiTap/tuan3/uploads/dog_hehe.png new file mode 100644 index 000000000..0f81118a2 Binary files /dev/null and b/baiTap/tuan3/uploads/dog_hehe.png differ diff --git a/baiTap/tuan3/validateuser.php b/baiTap/tuan3/validateuser.php new file mode 100644 index 000000000..4790c221d --- /dev/null +++ b/baiTap/tuan3/validateuser.php @@ -0,0 +1,20 @@ +query($query); + + if ($result->num_rows > 0) { + $_SESSION["IsLogin"] = true; + header("Location: home.php"); + } else { + header("Location: login.php?error=Tên đăng nhập hoặc mật khẩu không đúng. Vui lòng thử lại."); + } +?> diff --git a/index.php b/index.php deleted file mode 100644 index f15e93536..000000000 --- a/index.php +++ /dev/null @@ -1,27 +0,0 @@ - - - - - Visual Studio Code Remote :: PHP - - - - - \ No newline at end of file