소스 검색

Pages defined by user. Landing page added for user selection.

Inigo Valentin 6 년 전
부모
커밋
a1d3fa9538

+ 24 - 1
application/Controller.php

@@ -8,6 +8,8 @@
     require_once(__DIR__ . "/Constant.php");
     require_once(__DIR__ . "/Filter.php");
 
+    $UID = 0;
+
     /**
      * Application controller.
      *
@@ -24,13 +26,34 @@
          *
          * @param Array $params POST parameters of the request.
          */
-        public function __construct($params){
+        public function __construct($uid, $params){
 
             global $path;
+            global $UID;
             $page;
 
             $db = start_db();
 
+            // TODO: Validate private/public user with cookie and redirect
+            $UID = $uid;
+            error_log('UID: ' . $uid);
+            if (preg_match("/\d{7}/", $UID)){
+                $q = $db->query("SELECT count(uid) AS c FROM player WHERE uid = $UID;");
+                $r = $q->fetchArray(SQLITE3_ASSOC);
+                if ($r["c"] == 0){
+                    require_once($path["page"] . "Landing_Page.php");
+                    $page = new Landing_Page($db);
+                    require_once($page->view);
+                    return;
+                }
+            }
+            else{
+                require_once($path["page"] . "Landing_Page.php");
+                $page = new Landing_Page($db);
+                require_once($page->view);
+                return;
+            }
+
             // Parse parameters, get lang and build the route.
             $pars = [];
             foreach($params as $p){

+ 13 - 10
application/page/Guild_Page.php

@@ -29,24 +29,27 @@
         public function __construct($db){
             global $path;
             global $root;
+            global $UID;
             parent::__construct($db);
             $this->view = $path["view"] . "guild.php";
-            $s =
-              "SELECT DISTINCT guild AS id " .
-              "FROM " .
-              "  guild_member " .
-              "  guild; ";
+            $s = "
+              SELECT id
+              FROM guild
+              WHERE id = (SELECT guild FROM guild_member WHERE id = '$UID');
+            ";
             // TODO: Where guild.member.player = ...
             $q = $this->db->query($s);
             $r = $q->fetchArray(SQLITE3_ASSOC);
             if ($r){
-                $this->guild = new Guild($db, $r["id"]);
+                $guild_id =  $r["id"];
+                $this->guild = new Guild($db, $guild_id);
                 $this->title = $this->guild->name . " - SWDB";
                 $this->description = $this->guild->name . " Guild details";
-                $s =
-                  "SELECT id " .
-                  "FROM k_guild_skill_group " .
-                  "ORDER BY id; ";
+                $s = "
+                  SELECT id
+                  FROM k_guild_skill_group
+                  ORDER BY id;
+                ";
                 $q = $this->db->query($s);
                 while ($r = $q->fetchArray(SQLITE3_ASSOC)){
                     array_push($this->skill_groups, new K_Guild_Skill_Group($db, $r["id"]));

+ 38 - 28
application/page/Home_Page.php

@@ -108,34 +108,37 @@
             global $path;
             global $root;
             global $INVENTORY_TYPE;
+            global $UID;
             parent::__construct($db);
             $this->view = $path["view"] . "home.php";
-            // TODO:Filter by player?
-            $s =
-              "SELECT " .
-              "  uid, " .
-              "  name, " .
-              "  country, " .
-              "  experience, " .
-              "  rep, " .
-              "  mana, " .
-              "  crystal, " .
-              "  energy, " .
-              "  energy_max, " .
-              "  arena_energy, " .
-              "  arena_energy_max, " .
-              "  darkportal_energy, " .
-              "  darkportal_energy_max, " .
-              "  dimension_energy, " .
-              "  dimension_energy_max, " .
-              "  honor_point, " .
-              "  guild_point, " .
-              "  honor_medal, " .
-              "  honor_mark, " .
-              "  event_coin, " .
-              "  social_point, " .
-              "  costume_point " .
-              "FROM player ";
+            $s = "
+              SELECT
+                uid,
+                name,
+                country,
+                experience,
+                rep,
+                mana,
+                crystal,
+                energy,
+                energy_max,
+                arena_energy,
+                arena_energy_max,
+                darkportal_energy,
+                darkportal_energy_max,
+                dimension_energy,
+                dimension_energy_max,
+                honor_point,
+                guild_point,
+                honor_medal,
+                honor_mark,
+                event_coin,
+                social_point,
+                costume_point
+              FROM player
+              WHERE uid = '$UID';
+            ";
+            error_log($s);
             $q = $this->db->query($s);
             $r = $q->fetchArray(SQLITE3_ASSOC);
             if ($r){
@@ -167,6 +170,7 @@
             $s = "
                 SELECT unit
                 FROM defense
+                WHERE uid = '$UID'
                 ORDER BY position;
             ";
             $q = $this->db->query($s);
@@ -175,7 +179,8 @@
             }
             $s = "
                 SELECT DISTINCT building
-                FROM building;
+                FROM building
+                WHERE uid = '$UID';
             ";
             $q = $this->db->query($s);
             while ($r = $q->fetchArray(SQLITE3_ASSOC)){
@@ -183,7 +188,8 @@
             }
             $s = "
                 SELECT decoration
-                FROM decoration;
+                FROM decoration
+                WHERE uid = '$UID';
             ";
             $q = $this->db->query($s);
             while ($r = $q->fetchArray(SQLITE3_ASSOC)){
@@ -193,6 +199,7 @@
                 SELECT id
                 FROM inventory
                 WHERE
+                  uid = '$UID' AND
                   type = " . $INVENTORY_TYPE["SCROLL"] . " AND
                   amount > 0;
             ";
@@ -207,6 +214,7 @@
                   inventory,
                   k_inventory
                 WHERE
+                  inventory.uid = '$UID' AND
                   inventory.id = k_inventory.id AND
                   k_inventory.type = " . $INVENTORY_TYPE["RUNE_CRAFT"] . " AND
                   amount > 0;
@@ -221,6 +229,7 @@
                   inventory,
                   k_inventory
                 WHERE
+                  inventory.uid = '$UID' AND
                   inventory.id = k_inventory.id AND
                   k_inventory.type = " . $INVENTORY_TYPE["CRAFT_STUFF"] . " AND
                   amount > 0;
@@ -235,6 +244,7 @@
                   inventory,
                   k_inventory
                 WHERE
+                  inventory.uid = '$UID' AND
                   k_inventory.id = inventory.id AND
                   k_inventory.type = " . $INVENTORY_TYPE["ESSENCES"] . "
                 ORDER BY

+ 37 - 0
application/page/Landing_Page.php

@@ -0,0 +1,37 @@
+<?php
+
+    require_once($path["page"] . "Page.php");
+
+    /**
+     * Landing page model.
+     */
+    class Landing_Page extends Page{
+
+        /**
+         * Array of players [uid]=>[name].
+         */
+        public $players = [];
+
+        /**
+         * Constructor.
+         *
+         * Retrieves the data and initializes the variables.
+         *
+         * @param SQLite3 $db Connection to the database.
+         */
+        public function __construct($db){
+            global $path;
+            global $root;
+            parent::__construct($db);
+            $this->view = $path["view"] . "landing.php";
+            $s = "SELECT uid, name FROM player";
+            $q = $this->db->query($s);
+            while ($r = $q->fetchArray(SQLITE3_ASSOC)){
+                $this->players[$r["uid"]] = $r["name"];
+            }
+            $this->title = "Player - SWDB";
+            $this->description = "Select a player";
+            $this->canonical = $root . "landing/";
+        }
+    }
+?>

+ 0 - 16
application/page/Monster_Info_Page.php

@@ -72,22 +72,6 @@
                 $title = $this->monster[1]->name . " - " .$this->monster[0]->element_name . " " . $this->monster[0]->name;
             }
 
-            // TODO REWORK
-            /*$s = "
-              SELECT
-                id,
-                element
-              FROM k_unit
-              WHERE
-                family = " . $monster->family . " AND
-                base_stars 
-                element <> " . $monster->element . ";
-            ";
-            $q_mon = $this->db->query($s);
-            while ($r = $q_mon->fetchArray(SQLITE3_ASSOC)){
-                $this->family[$r["element"]] = $r["id"];
-            }*/
-
             $this->title = $title ." - SWDB";
             $this->description = $title . " info - SWDB";
             $this->canonical = $root . "monster_info/" . $id;

+ 1 - 0
application/page/Monster_Page.php

@@ -69,6 +69,7 @@
                 k_decoration_level,
                 decoration
               WHERE
+                decoration.uid = '$UID' AND
                 k_decoration.id = decoration.decoration AND
                 decoration.decoration = k_decoration_level.decoration AND
                 decoration.level = k_decoration_level.level AND

+ 7 - 3
application/page/Monsters_Page.php

@@ -97,12 +97,14 @@
          */
         private function build_query(){
             global $ELEMENT;
+            global $UID;
             $s = "
-                SELECT unit.id AS id 
+                SELECT unit.id AS id
                 FROM
                   unit,
-                  k_unit 
-                WHERE 
+                  k_unit
+                WHERE
+                  unit.uid = '$UID' AND
                   unit.unit = k_unit.id AND 
                   stars >= " . $this->filters["min_stars"] . " AND 
                   stars <= " . $this->filters["max_stars"];
@@ -138,6 +140,7 @@
         private function calculate_buildings(){
             global $STAT;
             global $EFFECT_AREA;
+            global $UID;
             $s = "
               SELECT
                 affected_stat,
@@ -148,6 +151,7 @@
                 k_decoration_level,
                 decoration
               WHERE
+                decoration.uid = '$UID' AND
                 k_decoration.id = decoration.decoration AND
                 decoration.decoration = k_decoration_level.decoration AND
                 decoration.level = k_decoration_level.level AND

+ 2 - 2
application/page/Page.php

@@ -62,8 +62,8 @@
             global $path;
             global $root;
             $this->db = $db;
-            $this->favicon = $path["img"]["layout"] . "logo/sw.png";
-            $this->icon = $path["img"]["layout"] . "logo/sw.png";
+            $this->favicon = $path["logo"] . "sw.png";
+            $this->icon = $path["logo"] . "sw.png";
             $this->name = "SWDB";
             $this->author = $root;
         }

+ 4 - 1
application/page/Report_Runecraft_Page.php

@@ -46,7 +46,6 @@
             $this->view = $path["view"] . "report_runecraft.php";
             $this->parse_filters();
             $s = $this->build_query();
-error_log($s);
             $q = $this->db->query($s);
             $prev_monster = "";
             $prev_rune = "";
@@ -197,6 +196,7 @@ error_log($s);
          * @return The query to be executed.
          */
         private function build_query(){
+            global $UID;
             $s = "
                 SELECT
                   unit.id AS unit,
@@ -209,6 +209,9 @@ error_log($s);
                   rune_craft,
                   k_rune_craft_type
                 WHERE
+                  unit.uid = '$UID' AND
+                  rune.uid = '$UID' AND
+                  rune_craft.uid = '$UID' AND
                   unit.id = rune.assigned_to AND
                   unit.unit = k_unit.id AND
                   rune_craft.type = k_rune_craft_type.id AND

+ 4 - 0
application/page/Report_Runeupgrade_Page.php

@@ -209,6 +209,7 @@
          * @return The query to be executed.
          */
         private function build_query(){
+            global $UID;
             $s = "
               SELECT
                 unit.id AS unit,
@@ -220,6 +221,9 @@
                 unit,
                 k_unit
               WHERE
+                unit.uid = '$UID' AND
+                rune.uid = '$UID' AND
+                rune_alt.uid = '$UID' AND
                 unit.id = rune.assigned_to AND
                 unit.unit = k_unit.id AND
                 unit.stars >= " . $this->filters["monster_min_stars"] . " AND

+ 3 - 0
application/page/Report_Skillup_Page.php

@@ -99,6 +99,7 @@
          * @return The query to be executed.
          */
         private function build_query(){
+            global $UID;
             $s =
               "SELECT DISTINCT " .
               "  unit.id AS id, " .
@@ -113,6 +114,8 @@
               "  k_unit_skill, " .
               "  k_skill " .
               "WHERE " .
+              "  unit.uid = '$UID' AND " .
+              "  unit_skill.uid = '$UID' AND " .
               "  unit.unit = k_unit.id AND " .
               "  unit_skill.unit = unit.id AND " .
               "  unit_skill.skill = k_unit_skill.skill AND " .

+ 2 - 0
application/page/Runes_Page.php

@@ -151,12 +151,14 @@
          * @return The query to be executed.
          */
         private function build_query(){
+            global $UID;
             $s =
               "SELECT " .
               "  id, " .
               "  assigned_to " .
               "FROM rune " .
               "WHERE " .
+              "  uid = '$UID' AND " .
               "  stars >= " . $this->filters["min_stars"] . " AND " .
               "  stars <= " . $this->filters["max_stars"] . " AND " .
               "  level >= " . $this->filters["min_level"] . " AND " .

+ 2 - 2
application/page/Runs_Page.php

@@ -49,7 +49,6 @@
             global $FILTER_RUN;
             global $DIFFICULTY;
             $this->filters = $FILTER_RUN;
-            
             if (isset($_GET["area_type"]) && intval($_GET["area_type"]) > 0){
                 $this->filters["area_type"] = $_GET["area_type"];
             }
@@ -93,10 +92,11 @@
          * @return The query to be executed.
          */
         private function build_query(){
+            global $UID;
             $s = "
                 SELECT id
                 FROM run
-                WHERE 1 = 1
+                WHERE uid = '$UID'
              ";
             if ($this->filters["area"] > 0){
                 $s = $s . " AND area =  " . $this->filters["area"] . " ";

+ 1 - 1
application/view/catalog.php

@@ -62,7 +62,7 @@
                     }
 ?>
                     <div class='monster'>
-                        <a href='/catalog/<?=$mon->id?>'>
+                        <a href='/<?=$UID?>/catalog/<?=$mon->id?>'>
                             <div class='monster_panel'>
                                 <?=html_unit_panel($mon)?>
                             </div>

+ 10 - 10
application/view/fusion.php

@@ -77,7 +77,7 @@
                 <article>
                     <div class='f5'>
                         <div class='product'>
-                            <a target='_blank' title='<?=$fusion->product->name?>' href='/catalog/<?=$fusion->product->id?>'>
+                            <a target='_blank' title='<?=$fusion->product->name?>' href='/<?=$UID?>/catalog/<?=$fusion->product->id?>'>
                                 <div class='monster_panel'>
                                     <span class='stars'>
                                         <img class='star star_gold' src='<?=$path["img"]["icon"]?>star.png'/>
@@ -122,7 +122,7 @@
                                     }
                                     $mon_title = $mon_title . " - " . $owned->stars . "* - Lv." . $owned->level;
 ?>
-                                    <a target="_blank" title='<?=$mon_title?>' href='/monsters/<?=$owned->id?>'>
+                                    <a target="_blank" title='<?=$mon_title?>' href='/<?=$UID?>/monsters/<?=$owned->id?>'>
                                         <div class='monster_panel'>
                                             <span class='stars'>
 <?php
@@ -149,7 +149,7 @@
 ?>
                                 <div class='f4'>
                                     <div class='product'>
-                                        <a target='_blank' title='<?=$sub_fusion->product_awaken->name?>' href='/catalog/<?=$sub_fusion->product_awaken->id?>'>
+                                        <a target='_blank' title='<?=$sub_fusion->product_awaken->name?>' href='/<?=$UID?>/catalog/<?=$sub_fusion->product_awaken->id?>'>
                                             <div class='awakened monster_panel'>
                                                 <span class='stars'>
                                                     <img class='star star_purple' src='<?=$path["img"]["icon"]?>star.png'/>
@@ -164,7 +164,7 @@
                                                 </span>
                                             </div><!-- .awakened .monster_panel -->
                                         </a>
-                                        <a target='_blank' title='<?=$sub_fusion->product->name?>' href='/catalog/<?=$sub_fusion->product->id?>'>
+                                        <a target='_blank' title='<?=$sub_fusion->product->name?>' href='/<?=$UID?>/catalog/<?=$sub_fusion->product->id?>'>
                                             <div class='unawakened monster_panel'>
                                                 <span class='stars'>
 <?php
@@ -225,7 +225,7 @@
                                                 }
                                                 $mon_title = $mon_title . " - " . $owned->stars . "* - Lv." . $owned->level;
 ?>
-                                                <a target="_blank" title='<?=$mon_title?>' href='/monsters/<?=$owned->id?>'>
+                                                <a target="_blank" title='<?=$mon_title?>' href='/<?=$UID?>/monsters/<?=$owned->id?>'>
                                                     <div class='monster_panel'>
                                                         <span class='stars'>
 <?php
@@ -253,7 +253,7 @@
 ?>
                                             <div class='f3'>
                                                 <div class='product'>
-                                                    <a target='_blank' title='<?=$sub_monster->name?>' href='/catalog/<?=$sub_monster->id?>'>
+                                                    <a target='_blank' title='<?=$sub_monster->name?>' href='/<?=$UID?>/catalog/<?=$sub_monster->id?>'>
                                                         <div class='awakened monster_panel'>
                                                             <span class='stars'>
                                                                 <img class='star star_purple' src='<?=$path["img"]["icon"]?>star.png'/>
@@ -281,7 +281,7 @@
                                                         }
 ?>
                                                     </div><!-- .essences -->
-                                                    <a target='_blank' title='<?=$sub_fusion->ingredient_unawaken[$num]->name?>' href='/catalog/<?=$sub_fusion->ingredient_unawaken[$num]->id?>'>
+                                                    <a target='_blank' title='<?=$sub_fusion->ingredient_unawaken[$num]->name?>' href='/<?=$UID?>/catalog/<?=$sub_fusion->ingredient_unawaken[$num]->id?>'>
                                                         <div class='unawakened monster_panel'>
                                                             <span class='stars'>
 <?php
@@ -328,7 +328,7 @@
                                                             }
                                                             $mon_title = $mon_title . " - " . $owned->stars . "* - Lv." . $owned->level;
 ?>
-                                                            <a target="_blank" title='<?=$mon_title?>' href='/monsters/<?=$owned->id?>'>
+                                                            <a target="_blank" title='<?=$mon_title?>' href='/<?=$UID?>/monsters/<?=$owned->id?>'>
                                                                 <div class='monster_panel'>
                                                                     <span class='stars'>
 <?php
@@ -363,7 +363,7 @@
                             <!-- Last ingredient, non fuseable -->
                             <div class='f4 extra'>
                                 <div class='product'>
-                                    <a target='_blank' title='<?=$fusion->ingredient[0]->name?>' href='/catalog/<?=$fusion->ingredient[0]->id?>'>
+                                    <a target='_blank' title='<?=$fusion->ingredient[0]->name?>' href='/<?=$UID?>/catalog/<?=$fusion->ingredient[0]->id?>'>
                                         <div class='awakened monster_panel'>
                                             <span class='stars'>
                                                 <img class='star star_purple' src='<?=$path["img"]["icon"]?>star.png'/>
@@ -392,7 +392,7 @@
                                         }
 ?>
                                     </div><!-- .essences -->
-                                    <a target='_blank' title='<?=$fusion->ingredient_unawaken[0]->name?>' href='/catalog/<?=$fusion->ingredient_unawaken[0]->id?>'>
+                                    <a target='_blank' title='<?=$fusion->ingredient_unawaken[0]->name?>' href='/<?=$UID?>/catalog/<?=$fusion->ingredient_unawaken[0]->id?>'>
                                         <div class='unawakened monster_panel'>
                                             <span class='stars'>
 <?php

+ 1 - 1
application/view/inc/filter_catalog.php

@@ -1,7 +1,7 @@
 <?php
     global $ELEMENT;
 ?>
-<form action='/catalog/' method='get' id='filter_catalog' class='filter'>
+<form action='/<?=$UID?>/catalog/' method='get' id='filter_catalog' class='filter'>
     <table>
         <tr>
             <td class='filter'>

+ 1 - 1
application/view/inc/filter_monsters.php

@@ -1,7 +1,7 @@
 <?php
     global $ELEMENT;
 ?>
-<form action='/monsters/' method='get'  id='filter_monsters' class='filter'>
+<form action='/<?=$UID?>/monsters/' method='get'  id='filter_monsters' class='filter'>
     <table>
         <tr>
             <td class='filter'>

+ 1 - 1
application/view/inc/filter_report_runecraft.php

@@ -2,7 +2,7 @@
     global $RUNE_STAT;
     global $QUALITY;
 ?>
-<form action='/report/runecraft/' method='get' id='filter_runecraft' class='filter'>
+<form action='/<?=$UID?>/report/runecraft/' method='get' id='filter_runecraft' class='filter'>
     <table>
         <tr>
             <td class='filter filter_title' rowspan='2'>

+ 1 - 1
application/view/inc/filter_report_runeupgrade.php

@@ -1,7 +1,7 @@
 <?php
     global $QUALITY;
 ?>
-<form action='/report/runeupgrade/' method='get' id='filter_runeupgrade' class='filter'>
+<form action='/<?=$UID?>/report/runeupgrade/' method='get' id='filter_runeupgrade' class='filter'>
     <table>
         <tr>
             <td class='filter filter_title' rowspan='2'>

+ 1 - 1
application/view/inc/filter_report_skillup.php

@@ -1,4 +1,4 @@
-<form action='/report/skillup/' method='get' id='filter_skillup' class='filter'>
+<form action='/<?=$UID?>/report/skillup/' method='get' id='filter_skillup' class='filter'>
     <table>
         <tr>
             <td class='filter' id='filter_stars'>

+ 1 - 1
application/view/inc/filter_runes.php

@@ -3,7 +3,7 @@
     global $RUNE_STAT;
     global $QUALITY;
 ?>
-<form action='/runes/' method='get' id='filter_runes' class='filter'>
+<form action='/<?=$UID?>/runes/' method='get' id='filter_runes' class='filter'>
     <table>
         <tr>
             <td class='filter' rowspan='3'>

+ 2 - 2
application/view/inc/filter_runs.php

@@ -1,7 +1,7 @@
 <?php
     global $AREA_TYPE;
 ?>
-<form action='runs' method='get' id='filter_runeupgrade' class='filter'>
+<form action='/<?=$UID?>/runs/' method='get' id='filter_runeupgrade' class='filter'>
     <table>
         <tr>
             <td class='filter filter_title'>
@@ -34,7 +34,7 @@
             <td class='filter'>
 <?php
                 $selected = [];
-                $selected[$filters["area00"]] = "selected";
+                $selected[$filters["area"]] = "selected";
 ?>
                 <span>Area:</span>
                 <select name='area_scenario'>

+ 8 - 8
application/view/inc/header.php

@@ -9,28 +9,28 @@
         </h1>
     </div>
     <nav>
-        <a href='/'>
+        <a href='/<?=$UID?>/'>
             Home
         </a>
-        <a href='/catalog'>
+        <a href='/<?=$UID?>/catalog'>
             Catalog
         </a>
-        <a href='/monsters'>
+        <a href='/<?=$UID?>/monsters'>
             Monsters
         </a>
-        <a href='/runes'>
+        <a href='/<?=$UID?>/runes'>
             Runes
         </a>
-        <a href='/fusion'>
+        <a href='/<?=$UID?>/fusion'>
             Fusion
         </a>
-        <a href='/guild'>
+        <a href='/<?=$UID?>/guild'>
             Guild
         </a>
-        <a href='/runs'>
+        <a href='/<?=$UID?>/runs'>
             Runs
         </a>
-        <a href='/report'>
+        <a href='/<?=$UID?>/report'>
             Reports
         </a>
     </nav>

+ 82 - 0
application/view/landing.php

@@ -0,0 +1,82 @@
+<!DOCTYPE html>
+<html lang='en'>
+    <head>
+        <meta content='text/html; charset=utf-8' http-equiv='content-type'/>
+        <meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1'/>
+        <title><?=$page->title?></title>
+        <link rel='shortcut icon' href='<?=$page->favicon?>'/>
+        <!-- CSS files -->
+        <link rel='stylesheet' type='text/css' href='<?=$path["css"]?>ui.css'/>
+        <link rel='stylesheet' type='text/css' href='<?=$path["css"]?>landing.css'/>
+        <!-- Script files -->
+        <script src="<?=$path["js"]?>ui.js"></script>
+        <!-- Meta tags -->
+        <link rel='canonical' href='<?=$page->canonical?>'/>
+        <link rel='author' href='<?=$page->author?>'/>
+        <link rel='publisher' href='<?=$page->author?>'/>
+        <meta name='description' content='<?=$page->description?>'/>
+        <meta property='og:title' content='<?=$page->title?>'/>
+        <meta property='og:url' content='<?=$page->canonical?>'/>
+        <meta property='og:description' content='<?=$page->description?>'/>
+        <meta property='og:image' content='<?=$page->icon?>'/>
+        <meta property='og:site_name' content='<?=$page->name?>'/>
+        <meta property='og:type' content='website'/>
+        <meta property='og:locale' content='en'/>
+        <meta name='twitter:card' content='summary'/>
+        <meta name='twitter:title' content='<?=$page->title?>'/>
+        <meta name='twitter:description' content='<?=$page->description?>'/>
+        <meta name='twitter:image' content='<?=$page->icon?>'/>
+        <meta name='twitter:url' content='<?=$page->canonical?>'/>
+        <meta name='robots' content='index follow'/>
+        <script>
+            /**
+             * Performs the login action, andrredirects to the user home page.
+             *
+             * Intended to be called before parsing form action.
+             *
+             * @return Always false, to stop th actual form to be submitted.
+             */
+            function login(){
+                sel = document.getElementById('uid');
+                uid = sel.options[sel.selectedIndex].value;
+                if (uid.match(/^[0-9]{7}$/g) != null){
+                    document.location='/' + uid + '/';
+                }
+                //else{
+                    // TODO alert('N UID');
+                //}
+                return false;
+            }
+        </script>
+    </head>
+    <body>
+<?php
+        include __DIR__ . "/inc/header.php";
+?>
+        <section class='list'>
+            <h2>
+                Select player
+            </h2>
+            <article>
+                <!-- TODO: Action via JS, and fllback in controller -->
+                <form method='GET' action='/' onsubmit="return login();">
+                    <select id='uid' name='uid'>
+                        <option value='0'> </option>
+<?php
+                        foreach ($page->players as $player_id => $player_name){
+?>
+                            <option value='<?=$player_id?>'><?=$player_name?></option>
+<?php
+                        }
+?>
+                    </select>
+                    <input type='submit' value='Go'/>
+                </form>
+            </article>
+        </section> <!-- #catalog -->
+
+<?php
+        include __DIR__ . "/inc/footer.php";
+?>
+    </body>
+</html>

+ 1 - 1
application/view/monsters.php

@@ -55,7 +55,7 @@
                     foreach ($page->monsters as $mon){
 ?>
                         <div class='monster'>
-                            <a href='/monsters/<?=$mon->id?>'>
+                            <a href='/<?=$UID?>/monsters/<?=$mon->id?>'>
                                 <div class='monster_panel'>
                                     <?=html_unit_panel($mon)?>
                                 </div>

+ 1 - 1
application/view/runs.php

@@ -123,7 +123,7 @@
                                         }
                                         if ($disabled == ""){
 ?>
-                                            <a target='_blank' href='/monster/<?=$party->id?>'>
+                                            <a target='_blank' href='/<?=$UID?>>/monster/<?=$party->id?>'>
 <?php
                                         }
 ?>

+ 0 - 0
public/css/landing.css


+ 7 - 1
public/index.php

@@ -5,6 +5,12 @@
     //$request = $_SERVER['REQUEST_URI'];
     $request = parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH);
     $params = explode('/', $request);
+    array_shift($params);
+    $uid = "";
+    if (count($params) > 0 && preg_match("/\d{7}/", $params[0])){
+        $uid = $params[0];
+        array_shift($params);
+    }
 
-    $controller = new Controller($params);
+    $controller = new Controller($uid, $params);
 ?>