From bd6bfca30efb85ba87e8ede787eac522b111accc Mon Sep 17 00:00:00 2001 From: Vital Vuillaume Date: Sun, 13 Oct 2024 09:17:55 +0200 Subject: [PATCH 1/6] For https --- new_product/new_product.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/new_product/new_product.js b/new_product/new_product.js index d9b6b57..236555e 100644 --- a/new_product/new_product.js +++ b/new_product/new_product.js @@ -50,7 +50,7 @@ function onFormSubmit() { } if(window.location.protocol != 'https:') { - location.href = "https://" + location.href.replace("http://", ""); + window.location.protocol = 'https:'; } From 4f1dc6c0a62fdbd9e4f838b89b61a64c508b6c1e Mon Sep 17 00:00:00 2001 From: JdM Date: Sun, 13 Oct 2024 15:25:00 +0200 Subject: [PATCH 2/6] Add FTP deployment workflow --- .github/workflows/main.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..2c78bcb --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,24 @@ +name: FTP Deployment + +on: + push: + branches: + - main + +jobs: + deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: FTP Deployment + uses: SamKirkland/FTP-Deploy-Action@v4.3.4 + with: + server: ${{ secrets.FTP_SERVER }} + username: ${{ secrets.FTP_USERNAME }} + password: ${{ secrets.FTP_PASSWORD }} + server-dir: "/www/recytech/shop" + local-dir: ./ + dry-run: false \ No newline at end of file From 20e9021e1077d1c1cfecc6c85f8bf2c8e6276dec Mon Sep 17 00:00:00 2001 From: JdM Date: Sun, 13 Oct 2024 15:33:45 +0200 Subject: [PATCH 3/6] Create README.md --- README.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..8d1c8b6 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ + From 85fa6fde2d243a3e3643ef8f5a965d1ab1075211 Mon Sep 17 00:00:00 2001 From: JdM Date: Sun, 13 Oct 2024 15:34:20 +0200 Subject: [PATCH 4/6] Update main.yml --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2c78bcb..0ace42e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -19,6 +19,6 @@ jobs: server: ${{ secrets.FTP_SERVER }} username: ${{ secrets.FTP_USERNAME }} password: ${{ secrets.FTP_PASSWORD }} - server-dir: "/www/recytech/shop" + server-dir: "/www/recytech/shop/" local-dir: ./ - dry-run: false \ No newline at end of file + dry-run: false From 91339748ef31ee3103a709c6678e7a6cbd2a2861 Mon Sep 17 00:00:00 2001 From: JdM Date: Sun, 13 Oct 2024 15:37:32 +0200 Subject: [PATCH 5/6] r --- .github/workflows/main.yml | 24 ------------------------ 1 file changed, 24 deletions(-) delete mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index 2c78bcb..0000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: FTP Deployment - -on: - push: - branches: - - main - -jobs: - deploy: - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: FTP Deployment - uses: SamKirkland/FTP-Deploy-Action@v4.3.4 - with: - server: ${{ secrets.FTP_SERVER }} - username: ${{ secrets.FTP_USERNAME }} - password: ${{ secrets.FTP_PASSWORD }} - server-dir: "/www/recytech/shop" - local-dir: ./ - dry-run: false \ No newline at end of file From 2ccf957ca652c6f7df663286e595c59ab4c416c5 Mon Sep 17 00:00:00 2001 From: JdM Date: Sun, 13 Oct 2024 17:47:29 +0200 Subject: [PATCH 6/6] Fix error reporting and include admin password check in new_product.php --- api/new_product.php | 7 +++++-- api/utils/database.php | 2 +- new_product/new_product.js | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/api/new_product.php b/api/new_product.php index fdc2be5..90f8bf1 100644 --- a/api/new_product.php +++ b/api/new_product.php @@ -1,7 +1,8 @@ "invalid admin password")); exit(); diff --git a/api/utils/database.php b/api/utils/database.php index 33ff110..00bfca6 100644 --- a/api/utils/database.php +++ b/api/utils/database.php @@ -7,7 +7,7 @@ class Database public function __construct() { include_once(dirname(__FILE__) . "/secrets.php"); - $this->conn = new mysqli(DB_HOST, DB_USERNAME, DB_PASSWORD, DB_NAME); + $this->conn = new mysqli(DB_HOST, DB_USERNAME, DB_PASSWORD, DB_NAME, DB_HOST_PORT); if ($this->conn->connect_error) { die("Connection failed: " . $this->conn->connect_error); diff --git a/new_product/new_product.js b/new_product/new_product.js index 236555e..7419085 100644 --- a/new_product/new_product.js +++ b/new_product/new_product.js @@ -38,7 +38,7 @@ function onFormSubmit() { const specificationsValuesInputs = document.getElementsByClassName("specificationValueInput") const specificationsTitlesInputs = document.getElementsByClassName("specificationTitleInput") - if(specificationsTitlesInputs[i].value != "" && specificationsValuesInputs.value != ""){ + if(specificationsTitlesInputs.value != "" && specificationsValuesInputs.value != ""){ let result = []; for (let i = 0; i < specificationsTitlesInputs.length; i++) {