From 6ea9b8bce34b91f3e2f3ebac0a07f58c831950b4 Mon Sep 17 00:00:00 2001 From: quoije Date: Mon, 21 Feb 2022 00:57:00 -0500 Subject: [PATCH] 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 @@ - + +