iwa-panda1

Manage Weather Data by International Weather Agency (Version 1)
Log | Files | Refs

commit 0adf0a66c23e4ed7854f5df82f21a67e2cc7e43d
parent ebec84c2884f6d1445a0a2f0d5a8bf0110671e51
Author: LennartSchroot <[email protected]>
Date:   Mon, 17 Apr 2023 12:02:38 +0200

fixes

Diffstat:
Mnavbar.php | 1-
Msearch_contract.php | 5++---
Msearch_customer.php | 2--
Msearch_data.php | 2+-
Msearch_user.php | 5+++--
5 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/navbar.php b/navbar.php @@ -18,7 +18,6 @@ $admin_links = array( array('url' => '/add_user.php', 'title' => 'Add User'), array('url' => '/search_user.php', 'title' => 'Search for user'), - array('url' => '/alter_user.php', 'title' => 'Alter user') ); $links[] = array('name' => 'Admin', 'links' => $admin_links); } diff --git a/search_contract.php b/search_contract.php @@ -18,10 +18,10 @@ <button class="btn btn-outline-success" type="submit">Search</button> </form> <?php - if ($_SERVER["REQUEST_METHOD"] == "POST"){ + $query = []; if(isset($_POST['search_id'])) { - $query["customer_id"] = "%{$_POST['search_id']}%"; + $query["customer_id"] = "{$_POST['search_id']}"; } if(isset($_POST['delete'])){ $c = $db->get(Contract::class); @@ -32,7 +32,6 @@ $query['customer_id'] = "%"; } display_results($db, $query); - } function display_results($db, $query){ //create a User orm class and load all the records where user like query $results = $db->all_where(Contract::class, $query); diff --git a/search_customer.php b/search_customer.php @@ -20,7 +20,6 @@ <button class="btn btn-outline-success" type="submit">Search</button> </form> <?php - if ($_SERVER["REQUEST_METHOD"] == "POST"){ $query = []; if(isset($_POST['search_email'])) { $query["email"] = "%{$_POST['search_email']}%"; @@ -40,7 +39,6 @@ $query['email'] = "%"; } display_results($db, $query); - } function display_results($db, $query){ //create a User orm class and load all the records where user like query $results = $db->all_where(Customer::class, $query); diff --git a/search_data.php b/search_data.php @@ -33,7 +33,7 @@ error_reporting(0); $params[] = $dateEnd; } if (isset($_GET['station']) && $_GET['station']) { - if (isset($_GET['date-begin']) || isset($_GET['date-end'])){ + if ($_GET['date-begin'] || $_GET['date-end']){ $sql .= " AND "; } else{ diff --git a/search_user.php b/search_user.php @@ -18,7 +18,6 @@ <button class="btn btn-outline-success" type="submit">Search</button> </form> <?php - if ($_SERVER["REQUEST_METHOD"] == "POST"){ if(isset($_POST['search'])) { //set $query $query = "%" . $_POST['search'] . "%"; @@ -29,7 +28,9 @@ $u->delete(); display_results($db, $_POST['query']); } - } + else{ + display_results($db, '%'); + } function display_results($db, $query){ //create a User orm class and load all the records where user like query $results = $db->all_where(User::class, array('email' => $query));