From 6ea9b8bce34b91f3e2f3ebac0a07f58c831950b4 Mon Sep 17 00:00:00 2001 From: quoije Date: Mon, 21 Feb 2022 00:57:00 -0500 Subject: [PATCH 1/4] login page added, no sql to db tho. bisou --- about.html | 9 ++-- api/ayy.php | 131 ++++++++++++++++++++++++++++++++++++++++++++++++++ api/db.php | 16 ++++++ api/mmn.js | 19 ++++++++ api/yeet.php | 48 ++++++++++++++++++ index.html | 9 ++-- login.html | 58 ++++++++++++++++++++++ products.html | 7 +-- 8 files changed, 280 insertions(+), 17 deletions(-) create mode 100644 api/ayy.php create mode 100644 api/db.php create mode 100644 api/mmn.js create mode 100644 api/yeet.php create mode 100644 login.html diff --git a/about.html b/about.html index dcfb97b..f7bd0bb 100644 --- a/about.html +++ b/about.html @@ -7,10 +7,6 @@ À propos - Le pain bleu - - - - @@ -23,9 +19,10 @@ diff --git a/api/ayy.php b/api/ayy.php new file mode 100644 index 0000000..9b4bbd6 --- /dev/null +++ b/api/ayy.php @@ -0,0 +1,131 @@ +0 && $num3>0) + { + echo "" . $ach . " || good shit boiis <3
quote already added"; + } + else if ($num3>0) + { + echo "" . $ach . " || good shit boiis <3
you can add your quote by entering quote:your quote"; + } + else + { + echo "" . $ach . ""; + } +} + +if (isset($_POST["invite"])) +{ + $query = "SELECT code FROM invites where code LIKE '". $_POST["invite"] ."'"; + $result = mysqli_query($conn, $query); + $num = mysqli_num_rows($result); + + if (strpos($_POST["invite"], $quotestr) !== false && $num3>0) + { + if ($num5 > 0) + { + json("quote.alreadyadded"); + } + else + { + $quote = str_replace($quotestr, "", $_POST["invite"]); + $sqlquote = "INSERT into quotes (id, quote, ip) VALUES ('". $idquotes ."', '" . $quote . "', '" . $ip . "')"; + + if (mysqli_query($conn, $sqlquote)) + json("db.success"); + else + { + json("db.error"); + } + + } + } + + elseif ($_POST["invite"] == $noi) + { + json("noi"); + } + + elseif ($_POST["invite"] == $sui) + { + json("sui"); + } + + elseif ($_POST["invite"] == $str) + { + json($strb64); + } + + elseif ($num>0) + { + if ($num3>0) + { + json("already.done"); + } + else + { + $sql = "INSERT into achieved (id, ip) VALUES ('". $id ."', '" . $ip . "')"; + mysqli_query($conn, $sql); + json(true); + } + } + + else + { + json(false); + } +} + +function getUserIpAddr() +{ +// https://www.codexworld.com/how-to/get-user-ip-address-php/ +if (!empty($_SERVER['HTTP_CLIENT_IP'])) +{ + $ip = $_SERVER['HTTP_CLIENT_IP']; +} +elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) +{ + $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; +} +else +{ + $ip = $_SERVER['REMOTE_ADDR']; +} +return $ip; +} + +function json($x) +{ + header("Content-type: application/json"); + echo json_encode(array('x'=>$x)); +} + + + +?> \ No newline at end of file diff --git a/api/db.php b/api/db.php new file mode 100644 index 0000000..55d30dc --- /dev/null +++ b/api/db.php @@ -0,0 +1,16 @@ + connect_errno) { + echo "La connection à rip: " . $conn -> connect_error; + exit(); +} + +?> \ No newline at end of file diff --git a/api/mmn.js b/api/mmn.js new file mode 100644 index 0000000..df5729d --- /dev/null +++ b/api/mmn.js @@ -0,0 +1,19 @@ +var str = "Aucun pain bleu ici, malheureusement. keep looking tho, may find something."; +console.log(str); + +function chkLogin(woof, miaw) { + $.post( "./api/yeet.php", { dog: woof, cat: miaw }, function(data) { + console.log("au moins ta fonction chkLogin se fait caller, c'est déjà ça..."); + console.log(data); + document.getElementById("nomd").value = ""; + document.getElementById("mdp").value = ""; + + if (typeof data.x === "string") +{ + document.getElementById("oof").innerHTML = data.x; +} + +}); +} + + diff --git a/api/yeet.php b/api/yeet.php new file mode 100644 index 0000000..8b8a039 --- /dev/null +++ b/api/yeet.php @@ -0,0 +1,48 @@ +$hash_cat, 'ip'=>$uip)); +} +else { + echo json_encode(array('x'=>"will never happened, like never. this is not supposed to work", 'ip'=>$uip)); +} +//json($dog,$hash_cat,$uip); + +function json($x, $y, $ip) +{ + header("Content-type: application/json"); + echo json_encode(array('x'=>$x, 'y'=>$y, 'ip'=>$ip)); +} + +function getUserIpAddr() +{ + + if (!empty($_SERVER['HTTP_CLIENT_IP'])) +{ + $ip = $_SERVER['HTTP_CLIENT_IP']; +} +elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) +{ + $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; +} +else +{ + $ip = $_SERVER['REMOTE_ADDR']; +} +return $ip; + +/// Source - https://www.codexworld.com/how-to/get-user-ip-address-php/ +} + +?> \ No newline at end of file diff --git a/index.html b/index.html index 0cf7473..35e9340 100644 --- a/index.html +++ b/index.html @@ -7,10 +7,6 @@ Le pain bleu - - - - @@ -23,9 +19,10 @@ diff --git a/login.html b/login.html new file mode 100644 index 0000000..0e7405c --- /dev/null +++ b/login.html @@ -0,0 +1,58 @@ + + + + + + + Le pain bleu + + + + + + + + + + + +

LE PAIN BLEUSEULEMENT BLEU  

+ +
+
+
+
+
+
+ + + +
+
+
+
+
+
+
+
+ + + + + \ No newline at end of file diff --git a/products.html b/products.html index ab48bbb..6b6a192 100644 --- a/products.html +++ b/products.html @@ -7,10 +7,6 @@ Produits - Le pain bleu - - - - @@ -25,7 +21,8 @@ - + + -- 2.54.0 From 89ed03cb2e5a6e8ad443755915dd12ef3973e8bb Mon Sep 17 00:00:00 2001 From: quoije Date: Sun, 27 Feb 2022 20:19:58 -0500 Subject: [PATCH 2/4] Add login and functional password verification --- api/db.php | 6 +++--- api/yeet.php | 35 ++++++++++++++++++++++------------- 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/api/db.php b/api/db.php index 55d30dc..ec064da 100644 --- a/api/db.php +++ b/api/db.php @@ -1,9 +1,9 @@ $hash_cat, 'ip'=>$uip)); -} -else { - echo json_encode(array('x'=>"will never happened, like never. this is not supposed to work", 'ip'=>$uip)); -} -//json($dog,$hash_cat,$uip); +if ($rus->num_rows > 0) { + echo "** found user **"; + while($row = $rps->fetch_assoc()) { + $oof = password_verify($cat, $row["pass"]); + if ($oof) + { + jsonLogin("oof","moof","1234"); + } + else + { + echo "***** nope"; + } + } + } else { + echo "no result :("; + } + $conn->close(); -function json($x, $y, $ip) +function jsonLogin($x, $y, $ip) { header("Content-type: application/json"); echo json_encode(array('x'=>$x, 'y'=>$y, 'ip'=>$ip)); -- 2.54.0 From 0dcce8f75c10771852c8c6d238e588c6b12d4b66 Mon Sep 17 00:00:00 2001 From: Mathieu Moran Date: Sun, 27 Feb 2022 20:22:19 -0500 Subject: [PATCH 3/4] Update README.md very important commit --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 88d0c7d..df32d5c 100644 --- a/README.md +++ b/README.md @@ -1 +1,2 @@ # web_lepainbleu.ca +blue bread is best bread. -- 2.54.0 From b5000109350d248003375381eaa2d25f7985e8c0 Mon Sep 17 00:00:00 2001 From: quoije Date: Sun, 27 Feb 2022 23:33:57 -0500 Subject: [PATCH 4/4] login functional but no disconnect ayy. --- about.html | 4 +- api/ayy.php | 131 ------------------------------------ api/client.php | 97 ++++++++++++++++++++++++++ api/client_files/fds.txt | 0 api/client_files/fdsa.txt | 0 api/client_files/fdsfds.txt | 0 api/mmn.js | 5 +- api/yeet.php | 6 +- index.html | 4 +- login.html | 10 ++- products.html | 6 +- 11 files changed, 117 insertions(+), 146 deletions(-) delete mode 100644 api/ayy.php create mode 100644 api/client.php create mode 100644 api/client_files/fds.txt create mode 100644 api/client_files/fdsa.txt create mode 100644 api/client_files/fdsfds.txt diff --git a/about.html b/about.html index f7bd0bb..9630cf9 100644 --- a/about.html +++ b/about.html @@ -20,8 +20,8 @@ diff --git a/api/ayy.php b/api/ayy.php deleted file mode 100644 index 9b4bbd6..0000000 --- a/api/ayy.php +++ /dev/null @@ -1,131 +0,0 @@ -0 && $num3>0) - { - echo "" . $ach . " || good shit boiis <3
quote already added"; - } - else if ($num3>0) - { - echo "" . $ach . " || good shit boiis <3
you can add your quote by entering quote:your quote"; - } - else - { - echo "" . $ach . ""; - } -} - -if (isset($_POST["invite"])) -{ - $query = "SELECT code FROM invites where code LIKE '". $_POST["invite"] ."'"; - $result = mysqli_query($conn, $query); - $num = mysqli_num_rows($result); - - if (strpos($_POST["invite"], $quotestr) !== false && $num3>0) - { - if ($num5 > 0) - { - json("quote.alreadyadded"); - } - else - { - $quote = str_replace($quotestr, "", $_POST["invite"]); - $sqlquote = "INSERT into quotes (id, quote, ip) VALUES ('". $idquotes ."', '" . $quote . "', '" . $ip . "')"; - - if (mysqli_query($conn, $sqlquote)) - json("db.success"); - else - { - json("db.error"); - } - - } - } - - elseif ($_POST["invite"] == $noi) - { - json("noi"); - } - - elseif ($_POST["invite"] == $sui) - { - json("sui"); - } - - elseif ($_POST["invite"] == $str) - { - json($strb64); - } - - elseif ($num>0) - { - if ($num3>0) - { - json("already.done"); - } - else - { - $sql = "INSERT into achieved (id, ip) VALUES ('". $id ."', '" . $ip . "')"; - mysqli_query($conn, $sql); - json(true); - } - } - - else - { - json(false); - } -} - -function getUserIpAddr() -{ -// https://www.codexworld.com/how-to/get-user-ip-address-php/ -if (!empty($_SERVER['HTTP_CLIENT_IP'])) -{ - $ip = $_SERVER['HTTP_CLIENT_IP']; -} -elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) -{ - $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; -} -else -{ - $ip = $_SERVER['REMOTE_ADDR']; -} -return $ip; -} - -function json($x) -{ - header("Content-type: application/json"); - echo json_encode(array('x'=>$x)); -} - - - -?> \ No newline at end of file diff --git a/api/client.php b/api/client.php new file mode 100644 index 0000000..cba6f8a --- /dev/null +++ b/api/client.php @@ -0,0 +1,97 @@ + + + + + + + Le pain bleu + + + + + + + + + + +

LE PAIN BLEUSEULEMENT BLEU  

+ + num_rows > 0) { + while($row = $rps->fetch_assoc()) { + if ($cat == $row["pass"]) + { + } + else + { + echo $cat; + echo "_____ IN BETWEEN _____"; + echo $row["pass"]; + die("DENIED"); + } + } + } else { + echo "no result :("; + } + $conn->close(); + ?> +
+
+
+
+
+ +
+ '.$file.''; + } + } + closedir($handle); + } + ?> +

Fichiers:

+
+
+
+
+
+
+
+
+

copyright © le pain bleu - deux mille vingt-deux

+
+
+ + + + \ No newline at end of file diff --git a/api/client_files/fds.txt b/api/client_files/fds.txt new file mode 100644 index 0000000..e69de29 diff --git a/api/client_files/fdsa.txt b/api/client_files/fdsa.txt new file mode 100644 index 0000000..e69de29 diff --git a/api/client_files/fdsfds.txt b/api/client_files/fdsfds.txt new file mode 100644 index 0000000..e69de29 diff --git a/api/mmn.js b/api/mmn.js index df5729d..f10d60d 100644 --- a/api/mmn.js +++ b/api/mmn.js @@ -8,11 +8,10 @@ function chkLogin(woof, miaw) { document.getElementById("nomd").value = ""; document.getElementById("mdp").value = ""; - if (typeof data.x === "string") + if (data == "redirect" || document.cookie) { - document.getElementById("oof").innerHTML = data.x; + window.location = 'api/client.php'; } - }); } diff --git a/api/yeet.php b/api/yeet.php index 475f4b8..ae88bf9 100644 --- a/api/yeet.php +++ b/api/yeet.php @@ -11,16 +11,16 @@ $rus = mysqli_query($conn, $user_sql); $rps = mysqli_query($conn, $pass_sql); if ($rus->num_rows > 0) { - echo "** found user **"; while($row = $rps->fetch_assoc()) { $oof = password_verify($cat, $row["pass"]); if ($oof) { - jsonLogin("oof","moof","1234"); + setcookie("user", $dog, time() + (86400 * 30), "/"); + setcookie("pass", $row["pass"], time() + (86400 * 30), "/"); + echo "redirect"; } else { - echo "***** nope"; } } } else { diff --git a/index.html b/index.html index 35e9340..f262d5e 100644 --- a/index.html +++ b/index.html @@ -20,8 +20,8 @@ diff --git a/login.html b/login.html index 0e7405c..23cf7fb 100644 --- a/login.html +++ b/login.html @@ -13,6 +13,12 @@ + @@ -23,8 +29,8 @@ diff --git a/products.html b/products.html index 6b6a192..446f1dc 100644 --- a/products.html +++ b/products.html @@ -19,10 +19,10 @@ -- 2.54.0