From 9962aff3221cfffb00953231847c1ec15eb71e8c Mon Sep 17 00:00:00 2001 From: /jedi/ Date: Thu, 27 Dec 2018 19:51:29 +0100 Subject: [PATCH] minor improvements --- action.php | 14 ++ index.php | 31 +++ templates/dashboard.php | 536 ++-------------------------------------- templates/insert.php | 14 +- templates/lost.php | 14 +- templates/losttable.php | 11 +- templates/matches.php | 69 ++++++ templates/sidebar.php | 16 +- templates/table.php | 11 +- templates/tinder.php | 62 +++++ 10 files changed, 217 insertions(+), 561 deletions(-) create mode 100644 templates/matches.php create mode 100644 templates/tinder.php diff --git a/action.php b/action.php index a6faa3d..2e61523 100644 --- a/action.php +++ b/action.php @@ -42,6 +42,20 @@ switch($_GET["action"]) { } } break; + case "tinder": + if (hasval($_POST["lost"]) && hasval($_POST["found"])) { + /* Prepared statement, stage 1: prepare */ + if (!($stmt = $mysqli->prepare("INSERT INTO matches(l_id, f_id) VALUES (?, ?)"))) { + echo "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error; + } + if (!$stmt->bind_param("ii", $_POST["lost"], $_POST["found"])) { + echo "Binding parameters failed: (" . $stmt->errno . ") " . $stmt->error; + } + if (!$stmt->execute()) { + echo "Execute failed: (" . $stmt->errno . ") " . $stmt->error; + } + } + break; } header('Location: '.$_SERVER['HTTP_REFERER']); diff --git a/index.php b/index.php index 7d5d37f..939c034 100644 --- a/index.php +++ b/index.php @@ -40,6 +40,37 @@ function get_lostitems(){ return $ret; } +function get_matches(){ + global $mysqli; + $res = $mysqli->query("SELECT matches.id AS id, matches.f_id as f_id, matches.l_id as l_id, lost.was as l_desc, items.was as f_desc " + ."FROM lost, items, matches WHERE lost.id = matches.l_id and items.id = matches.f_id ORDER BY matches.id ASC;"); + $ret = array(); + while ($row = $res->fetch_assoc()) { + $ret[] = $row; + } + return $ret; +} + +function get_stats(){ + global $mysqli; + $ret = array(); + $ret["lost"]=0; + $ret["found"]=0; + $res = $mysqli->query("SELECT COUNT(*) AS c FROM lost ORDER BY id ASC"); + if ($row = $res->fetch_assoc()) { + $ret["lost"] = $row["c"]; + } + $res = $mysqli->query("SELECT COUNT(*) AS c FROM items ORDER BY id ASC"); + if ($row = $res->fetch_assoc()) { + $ret["found"] = $row["c"]; + } + $res = $mysqli->query("SELECT COUNT(*) AS c FROM matches ORDER BY id ASC"); + if ($row = $res->fetch_assoc()) { + $ret["match"] = $row["c"]; + } + return $ret; +} + $page = isset($_GET["page"])?$_GET["page"]:"dashboard"; if (!auth()) { diff --git a/templates/dashboard.php b/templates/dashboard.php index e366366..8e79204 100644 --- a/templates/dashboard.php +++ b/templates/dashboard.php @@ -6,29 +6,31 @@ * Time: 4:46 AM */ ?> +
-
+
- +
-
26 New Messages!
+
Lost Items
- + View Details @@ -37,14 +39,14 @@
-
+
-
11 New Tasks!
+
Found Items
-
+ View Details @@ -56,11 +58,11 @@
- +
-
123 New Orders!
+
Matched Items
-
+ View Details @@ -72,11 +74,11 @@ -
+ -
-
- - Data Table Example
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NamePositionOfficeAgeStart dateSalary
NamePositionOfficeAgeStart dateSalary
Tiger NixonSystem ArchitectEdinburgh612011/04/25$320,800
Garrett WintersAccountantTokyo632011/07/25$170,750
Ashton CoxJunior Technical AuthorSan Francisco662009/01/12$86,000
Cedric KellySenior Javascript DeveloperEdinburgh222012/03/29$433,060
Airi SatouAccountantTokyo332008/11/28$162,700
Brielle WilliamsonIntegration SpecialistNew York612012/12/02$372,000
Herrod ChandlerSales AssistantSan Francisco592012/08/06$137,500
Rhona DavidsonIntegration SpecialistTokyo552010/10/14$327,900
Colleen HurstJavascript DeveloperSan Francisco392009/09/15$205,500
Sonya FrostSoftware EngineerEdinburgh232008/12/13$103,600
Jena GainesOffice ManagerLondon302008/12/19$90,560
Quinn FlynnSupport LeadEdinburgh222013/03/03$342,000
Charde MarshallRegional DirectorSan Francisco362008/10/16$470,600
Haley KennedySenior Marketing DesignerLondon432012/12/18$313,500
Tatyana FitzpatrickRegional DirectorLondon192010/03/17$385,750
Michael SilvaMarketing DesignerLondon662012/11/27$198,500
Paul ByrdChief Financial Officer (CFO)New York642010/06/09$725,000
Gloria LittleSystems AdministratorNew York592009/04/10$237,500
Bradley GreerSoftware EngineerLondon412012/10/13$132,000
Dai RiosPersonnel LeadEdinburgh352012/09/26$217,500
Jenette CaldwellDevelopment LeadNew York302011/09/03$345,000
Yuri BerryChief Marketing Officer (CMO)New York402009/06/25$675,000
Caesar VancePre-Sales SupportNew York212011/12/12$106,450
Doris WilderSales AssistantSidney232010/09/20$85,600
Angelica RamosChief Executive Officer (CEO)London472009/10/09$1,200,000
Gavin JoyceDeveloperEdinburgh422010/12/22$92,575
Jennifer ChangRegional DirectorSingapore282010/11/14$357,650
Brenden WagnerSoftware EngineerSan Francisco282011/06/07$206,850
Fiona GreenChief Operating Officer (COO)San Francisco482010/03/11$850,000
Shou ItouRegional MarketingTokyo202011/08/14$163,000
Michelle HouseIntegration SpecialistSidney372011/06/02$95,400
Suki BurksDeveloperLondon532009/10/22$114,500
Prescott BartlettTechnical AuthorLondon272011/05/07$145,000
Gavin CortezTeam LeaderSan Francisco222008/10/26$235,500
Martena MccrayPost-Sales supportEdinburgh462011/03/09$324,050
Unity ButlerMarketing DesignerSan Francisco472009/12/09$85,675
Howard HatfieldOffice ManagerSan Francisco512008/12/16$164,500
Hope FuentesSecretarySan Francisco412010/02/12$109,850
Vivian HarrellFinancial ControllerSan Francisco622009/02/14$452,500
Timothy MooneyOffice ManagerLondon372008/12/11$136,200
Jackson BradshawDirectorNew York652008/09/26$645,750
Olivia LiangSupport EngineerSingapore642011/02/03$234,500
Bruno NashSoftware EngineerLondon382011/05/03$163,500
Sakura YamamotoSupport EngineerTokyo372009/08/19$139,575
Thor WaltonDeveloperNew York612013/08/11$98,540
Finn CamachoSupport EngineerSan Francisco472009/07/07$87,500
Serge BaldwinData CoordinatorSingapore642012/04/09$138,575
Zenaida FrankSoftware EngineerNew York632010/01/04$125,250
Zorita SerranoSoftware EngineerSan Francisco562012/06/01$115,000
Jennifer AcostaJunior Javascript DeveloperEdinburgh432013/02/01$75,650
Cara StevensSales AssistantNew York462011/12/06$145,600
Hermione ButlerRegional DirectorLondon472011/03/21$356,250
Lael GreerSystems AdministratorLondon212009/02/27$103,500
Jonas AlexanderDeveloperSan Francisco302010/07/14$86,500
Shad DeckerRegional DirectorEdinburgh512008/11/13$183,000
Michael BruceJavascript DeveloperSingapore292011/06/27$183,000
Donna SniderCustomer SupportNew York272011/01/25$112,000
-
-
- -
+
- -
-
- -
-
diff --git a/templates/insert.php b/templates/insert.php index c4ce839..d6ebe9b 100644 --- a/templates/insert.php +++ b/templates/insert.php @@ -15,7 +15,8 @@ - + + @@ -26,7 +27,7 @@
-

+

">

@@ -38,15 +39,6 @@
- -
-
- -
-
-
diff --git a/templates/lost.php b/templates/lost.php index b2c7723..b4ad00d 100644 --- a/templates/lost.php +++ b/templates/lost.php @@ -15,7 +15,8 @@ - + + @@ -26,7 +27,7 @@
-

+

">

@@ -39,15 +40,6 @@
- -
-
- -
-
-
diff --git a/templates/losttable.php b/templates/losttable.php index 0d616b5..90fe71e 100644 --- a/templates/losttable.php +++ b/templates/losttable.php @@ -15,7 +15,7 @@ - + @@ -82,13 +82,4 @@
- -
-
- -
-
-
diff --git a/templates/matches.php b/templates/matches.php new file mode 100644 index 0000000..25ee4a0 --- /dev/null +++ b/templates/matches.php @@ -0,0 +1,69 @@ + +
+ +
+ + + + + +
+
+ + Data Table Example
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
IDgefundenverloren
IDgefundenverloren
+
+
+ +
+ +

+ More table examples coming soon... +

+ +
+ + +
diff --git a/templates/sidebar.php b/templates/sidebar.php index dcb285b..670a5d2 100644 --- a/templates/sidebar.php +++ b/templates/sidebar.php @@ -8,12 +8,12 @@ ?>
- - - diff --git a/templates/tinder.php b/templates/tinder.php new file mode 100644 index 0000000..e594736 --- /dev/null +++ b/templates/tinder.php @@ -0,0 +1,62 @@ + +
+ +
+ + + + + +
+
+ + Insert Item into DB +
+
+ +

+

+

+ +
+ +
+ +
+ + +
+ + + + + + + + + + + + + + + + + + + + +