about summary refs log tree commit diff stats
path: root/public_html
diff options
context:
space:
mode:
Diffstat (limited to 'public_html')
-rw-r--r--public_html/browser/get.php35
-rw-r--r--public_html/browser/index.php87
2 files changed, 122 insertions, 0 deletions
diff --git a/public_html/browser/get.php b/public_html/browser/get.php
new file mode 100644
index 0000000..fa346c3
--- /dev/null
+++ b/public_html/browser/get.php
@@ -0,0 +1,35 @@
+<?php
+
+require_once('/home/grizzly/store/browser/db.php');
+
+$member = $_GET['member'];
+
+if (isset($_GET["random"]) || !isset($member)) {
+    $stmt = $db->prepare("SELECT * FROM `websites` ORDER BY RANDOM() LIMIT 1;");
+    $stmt->execute();
+    $row = $stmt->fetch();
+
+    die(header("Location: https://tilde.team/~grizzly/browser/?member=" . $row['login_name']));
+} else {
+    $stmt = $db->prepare("SELECT * FROM `websites` WHERE login_name = :login_name;");
+    $stmt->execute(array(':login_name' => $member));
+    $row = $stmt->fetch(); // works
+
+    $stmt = $db->prepare("SELECT login_name FROM `websites` WHERE id > :id;");
+    $stmt->execute(array(':id' => $row['id']));
+    $next = $stmt->fetch(); // works
+
+    $stmt = $db->prepare("SELECT login_name FROM `websites` WHERE id < :id;");
+    $stmt->execute(array(':id' => $row['id']));
+    $prev = $stmt->fetch(); // always return first record from database, why?
+}
+
+$current = $row["login_name"];
+$next = $next["login_name"] ? $next["login_name"] : null;
+$prev = $prev["login_name"] ? $prev["login_name"] : null;
+
+// echo "current: " . $current . "\n";
+// echo "next: " . $next . "\n";
+// echo "prev: " . $prev . "\n";
+
+?>
\ No newline at end of file
diff --git a/public_html/browser/index.php b/public_html/browser/index.php
new file mode 100644
index 0000000..08aecd6
--- /dev/null
+++ b/public_html/browser/index.php
@@ -0,0 +1,87 @@
+<?php require_once ('get.php');
+?><!DOCTYPE html>
+<html lang="en">
+  <head>
+    <meta charset="UTF-8" />
+    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+    <title>Members websites on tilde.team</title>
+  </head>
+  <body>
+    <div class="app">
+      <div class="view">
+        <iframe
+          src="https://tilde.team/~<?=$current?>"
+          frameborder="0"
+        ></iframe>
+      </div>
+      <div class="control">
+        <div>
+          you are viewing
+          <a href="https://tilde.team/~<?=$current?>" target="_blank"
+            ><?=$current?></a
+          >
+          site
+        </div>
+        <div>
+          <?php if (isset($prev)) { ?>
+          <a href="https://tilde.team/~grizzly/browser/?member=<?=$prev?>"
+            >[previous]</a
+          >
+          <?php } ?>
+          <a href="https://tilde.team/~grizzly/browser/?random">[random]</a>
+          <?php if (isset($next)) { ?>
+          <a href="https://tilde.team/~grizzly/browser/?member=<?=$next?>"
+            >[next]</a
+          >
+          <?php } ?>
+        </div>
+        <div class="cache">user list cache is updated once a day</div>
+      </div>
+    </div>
+
+    <style>
+      * {
+        padding: 0;
+        margin: 0;
+        box-sizing: border-box;
+      }
+      body {
+        font-family: "lucida sans unicode", "lucida grande", sans-serif;
+        line-height: 1.7;
+        font-size: 14px;
+        background-color: #0e0e0e;
+      }
+      .app {
+        display: flex;
+        flex-direction: column;
+        min-height: 100vh;
+      }
+      .view {
+        display: flex;
+        flex-direction: column;
+        flex-grow: 1;
+        border: 5px dotted #3ee77b;
+      }
+      iframe {
+        flex-grow: 1;
+        background-color: #cecece;
+      }
+      .control {
+        display: flex;
+        flex-direction: column;
+        border-top: 5px dotted #3ee77b;
+        padding: 10px;
+        color: #3ee77b;
+        align-items: center;
+      }
+      .control a {
+        color: #99f2b9;
+      }
+      .cache {
+        font-size: 10px;
+        margin-top: 5px;
+      }
+    </style>
+  </body>
+</html>
\ No newline at end of file
'n308' href='#n308'>308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443