~skye/poker/etc/patches/0.diff

view raw


diff --git a/act/room.php b/act/room.php
index 6d5ce9e..413f623 100644
--- a/act/room.php
+++ b/act/room.php
@@ -34,6 +34,7 @@ $ut = mk_user_table($r);
 echo page(
 	"$n",
 	<<<HTML
+	<script src="/spt/room.js">Enable JS!</script>
 	<span><h3>$n</h3><p>owned by {$o->name}</p>
 	<table>
 		<tr>
diff --git a/jax/room.php b/jax/room.php
new file mode 100644
index 0000000..f19bcb4
--- /dev/null
+++ b/jax/room.php
@@ -0,0 +1,20 @@
+<?php
+
+require '../com.php';
+require '../src/db.php';
+
+$data = array();
+
+$db = new Database('../run/poker.db');
+$me = whoami($db);
+
+if (!!$me) {
+    $data["room"] = "Valid!";
+} else {
+    $data["error"] = "You are not logged in!";
+}
+
+
+echo json_encode($data);
+
+?>
\ No newline at end of file
diff --git a/spt/room.js b/spt/room.js
new file mode 100644
index 0000000..5ea15ca
--- /dev/null
+++ b/spt/room.js
@@ -0,0 +1,7 @@
+setInterval(function () {
+    fetch("/jax/room.php").then(function(response) {
+        return response.json();
+    }).then(function(data) {
+        console.log(data);
+    });
+}, 1000); 
\ No newline at end of file