From: bochard Date: Sun, 21 Dec 2025 06:17:12 +0000 (+0800) Subject: new guestbook! X-Git-Url: https://git.bochard.net/?a=commitdiff_plain;h=eceaa63c4555f09ae4840fb7ca5b4c6606d10188;p=mysite.git new guestbook! --- diff --git a/guestbook.php b/guestbook.php index d47d28e..432dce6 100644 --- a/guestbook.php +++ b/guestbook.php @@ -6,33 +6,98 @@ $pgjs = []; head($pgtitle, $pgdescription, $pgcss, $pgjs); ?> - +
+ + + +
-
+
connect_error){ + die("Connection failed: {$conn->connect_error}"); + } + + // entry submission if ($_SERVER["REQUEST_METHOD"] == "POST"){ - $name = $POST['name']; - $website = $POST['website']; - $email = $POST['email']; - $comment = $POST['comment']; + $name = $_POST['name']; + $country = $_POST['country']; + $website = $_POST['website']; + $email = $_POST['email']; + $comment = $_POST['comment']; + $ip_addr = $_SERVER['REMOTE_ADDR']; + + // query + $sql = "INSERT INTO entries (name, country, website, email, comment, ip_addr) + VALUES ('$name', '$country', '$website', '$email', '$comment', '$ip_addr');"; + $conn->query($sql); // submit query + + header("Location: " . $_SERVER["PHP_SELF"]); + die(); }; + + $result = $conn->query("SELECT name, country, website, email, comment, written_at + FROM entries + WHERE status='visible' + ORDER BY written_at DESC;"); ?> -
"> - -
- -
- -
-
-
- -
+
+
"> + +
+ +
+ +
+ +
+
+
+ +
+
+ +

+ +

Entries

+ + + + + + + + num_rows > 0){ + while($row = $result->fetch_assoc()){ + echo ""; + echo ""; + echo ""; + if(!empty($row['website'])){ + echo ""; + } else{ + echo ""; + } + echo ""; + echo ""; + } + } + ?> +
NameCountryWeb siteComment
" . htmlspecialchars($row['name']) . "" . htmlspecialchars($row['country']) . "" . htmlspecialchars($row['website']) . "" . htmlspecialchars($row['comment']) . "


diff --git a/index.php b/index.php index f382ae6..705c7ff 100644 --- a/index.php +++ b/index.php @@ -101,6 +101,10 @@
update description date
the site has now its own guestbookDec/21/2025
new layout!! Dec/15/2025