Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/recylife/shop
Browse files Browse the repository at this point in the history
  • Loading branch information
judemont committed Oct 13, 2024
2 parents 55e5513 + 2ccf957 commit 007bb48
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

7 changes: 5 additions & 2 deletions api/new_product.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
<?php

error_reporting(E_ALL);
ini_set('display_errors', 1);
include_once(dirname(__FILE__) . "/utils/database.php");
include_once(dirname(__FILE__). "/secrets/database.php");
include_once(dirname(__FILE__). "/utils/secrets.php");

$db = new Database;
const ALLOWED_IMAGES_EXT = ["png", "jpg", "jpeg"];
const ALLOWED_IMAGES_MIMES = array("image/jpeg", "image/png");
const MAX_IMAGES_SIZE = 2 * 1000 * 1000; // 2 MB

$password = $_POST["password"];
echo $password;
echo ADMIN_PASSWORD;
if($password != ADMIN_PASSWORD) {
echo json_encode(array("error"=> "invalid admin password"));
exit();
Expand Down
2 changes: 1 addition & 1 deletion api/utils/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions new_product/new_product.js
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand All @@ -50,7 +50,7 @@ function onFormSubmit() {
}

if(window.location.protocol != 'https:') {
location.href = "https://" + location.href.replace("http://", "");
window.location.protocol = 'https:';
}


Expand Down

0 comments on commit 007bb48

Please sign in to comment.