]> git.bochard.net Git - mysite.git/commitdiff
new layout for guestbook entries
authorbochard <git@bochard.net>
Mon, 22 Dec 2025 02:57:57 +0000 (10:57 +0800)
committerbochard <git@bochard.net>
Mon, 22 Dec 2025 02:57:57 +0000 (10:57 +0800)
guestbook.php

index 39c7f5b820d6ffe036815e1cec88e35e779ceee2..6ddd1e50259cfa6662bbfe37f613615e8aae4188 100644 (file)
                                        <br><br>
                                        
                                        <center><h2>Entries</h2></center>
-                                       <table border="1" cellspacing="" width="600">
-                                               <tr>
-                                                       <th>Name</th>
-                                                       <th>Country</th>
-                                                       <th>Web site</th>
-                                                       <th>Comment</th>
-                                               </tr>
-                                       <?php
-                                               if($result && $result->num_rows > 0){
-                                                       while($row = $result->fetch_assoc()){
-                                                               echo "<tr>";
-                                                                       echo "<td>" . htmlspecialchars($row['name']) . "</td>";
-                                                                       echo "<td>" . htmlspecialchars($row['country']) . "</td>";
-                                                                       if(!empty($row['website'])){
-                                                                               echo "<td><a href='" . htmlspecialchars($row['website']) . "' target='_blank'>" . htmlspecialchars($row['website']) . "</a></td>";
-                                                                       } else{
-                                                                               echo "<td></td>";
+                                       <table cellspacing="7" cellpadding="3" width="500" bgcolor="#0087fc">
+                                                       <?php
+                                                               if($result && $result->num_rows > 0){
+                                                                       while($row = $result->fetch_assoc()){
+                                                                               $name = htmlspecialchars($row['name'] ?? '');
+                                                                               $country = htmlspecialchars($row['country'] ?? '');
+                                                                               $website = htmlspecialchars($row['website'] ?? '');
+                                                                               $email = htmlspecialchars($row['email'] ?? '');
+                                                                               $comment = htmlspecialchars($row['comment'] ?? '');
+                                                                               $written_at = $row['written_at'] ?? '';
+                                                                               $ip_addr = $row['ip_addr'] ?? '';
+                                                                               
+                                                                               echo "<tr>";
+                                                                                       echo "<td>";
+                                                                                               echo "By <b>$name</b> at <b>$written_at</b><br>";
+                                                                                               echo "Country: <b>$country</b><br>";
+                                                                                               echo "Website: <b><a href='$website'>$website</a></b><br>";
+                                                                                               echo "Message: <b>$comment</b>";
+                                                                                               echo "<hr>";
+                                                                                       echo "</td>";
+                                                                               echo "</tr>";
                                                                        }
-                                                                       echo "<td>" . htmlspecialchars($row['comment']) . "</td>";
-                                                               echo "</tr>";
-                                                       }
-                                               }
-                                       ?>
+                                                               } else{
+                                                                       echo "<tr><td>No entries yet.</td></tr>";
+                                                               }
+                                                       ?>
                                        </table>
                                        
                                        <br><br>