From 2645f9c733fcab7491238c88a27826fb090aa6b0 Mon Sep 17 00:00:00 2001 From: Hannah Isopod Date: Wed, 25 Jun 2025 21:40:34 -0600 Subject: guestbook reflects .well-known/button in your site also: - moved johnvertisement and mothverisement to landing page - minor css fixes and other routine updates --- guestbook/submit.php | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'guestbook/submit.php') diff --git a/guestbook/submit.php b/guestbook/submit.php index 0e53fb3..bb745a2 100644 --- a/guestbook/submit.php +++ b/guestbook/submit.php @@ -52,6 +52,38 @@ error_reporting(E_ALL); $returnCode = "review"; } + $button = ""; // URL for the submitter's .well-known/button.json + if($_POST["website"]) { + $buttonjson = ""; + $buttonjsonurl = 'https://'.parse_url($_POST["website"], PHP_URL_HOST).'/.well-known/button.json'; + + $ch = curl_init($buttonjsonurl); + + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_HEADER, 0); + + $buttonjson = curl_exec($ch); + if(curl_error($ch)) { + //echo curl_error($ch); + $buttonjson = ""; + } + curl_close($ch); + + if($buttonjson) { + $buttonobj = json_decode($buttonjson); + if($buttonobj->default) { + foreach ($buttonobj->buttons as $btn) { + if($btn->id === $buttonobj->default) { + $button = $btn->uri; + break; + } + } + } else { + $button = $buttonobj->buttons[0]->uri; + } + } + } + $currentPost = array( "entry" => $_POST["entry"], "sourceip" => $sourceip, @@ -61,6 +93,7 @@ error_reporting(E_ALL); "found" => $_POST["found"], "website" => $_POST["website"], + "button" => $button, "cool" => $_POST["cool"], "reply" => "", "modstatus" => $modstatus -- cgit v1.2.3