version 0.1.1
[fms.git] / admin / introduce.php
index f2103a8..aafb20c 100644 (file)
@@ -53,19 +53,25 @@ function content()
        print "<br>Type answers for a few puzzles and submit<br>";\r
        \r
        \r
-       $st=$db->prepare("SELECT UUID,Day FROM tblIntroductionPuzzleRequests WHERE UUID NOT IN (SELECT UUID FROM tblIdentityIntroductionInserts) AND Day>='".gmdate('Y-m-d',strtotime('-1 day'))."' AND Found='true';");\r
+       $st=$db->prepare("SELECT UUID,Day,IdentityID FROM tblIntroductionPuzzleRequests WHERE UUID NOT IN (SELECT UUID FROM tblIdentityIntroductionInserts) AND Day>='".gmdate('Y-m-d',strtotime('-1 day'))."' AND Found='true' ORDER BY IdentityID, Day DESC, RequestIndex DESC;");\r
        $st->execute();\r
        \r
+       // only show latest captcha for each known identity\r
+       $lastid='';\r
        while($record=$st->fetch())\r
        {\r
-               print "<img src=\"showcaptcha.php?UUID=".$record[0]."\">";\r
-               print "<input type=\"hidden\" name=\"uuid[]\" value=\"".$record[0]."\">";\r
-               print "<input type=\"hidden\" name=\"day[]\" value=\"".$record[1]."\">";\r
-               print "<input type=\"text\" name=\"solution[]\">";\r
-               print "<br>";\r
+               if($lastid!=$record[2])\r
+               {\r
+                       $lastid=$record[2];\r
+                       print "<img src=\"showcaptcha.php?UUID=".$record[0]."\">";\r
+                       print "<input type=\"hidden\" name=\"uuid[]\" value=\"".$record[0]."\">";\r
+                       print "<input type=\"hidden\" name=\"day[]\" value=\"".$record[1]."\">";\r
+                       print "<input type=\"text\" name=\"solution[]\">";\r
+                       print "<br>";\r
+               }\r
        }\r
        ?>\r
-       <input type="submit">\r
+       <input type="submit" value="Announce">\r
        </form> \r
        <?php   \r
 }\r