From 08627484da73fe92bc393e7c429272c9e077ff91 Mon Sep 17 00:00:00 2001 From: Ricsi Date: Wed, 7 Dec 2016 15:58:20 +0100 Subject: [PATCH] admin password hotfix --- _class/class_user.php | 33 +++++++++++++++++++++++---------- event_handler.php | 5 ++++- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/_class/class_user.php b/_class/class_user.php index 31d4cc2..827b74e 100755 --- a/_class/class_user.php +++ b/_class/class_user.php @@ -135,16 +135,29 @@ class user { public static function update_user($_name, $_helper, $_password, $_ua_id) { global $sql; - return $sql->update_table('user_coach', - array( - 'ua_name' => $_name, - 'ua_helper' => $_helper, - 'ua_password' => $_password - ), - array( - 'ua_id' => $_ua_id - ) - ); + if ($_password != "-1") { + return $sql->update_table('user_coach', + array( + 'ua_name' => $_name, + 'ua_helper' => $_helper, + 'ua_password' => $_password + ), + array( + 'ua_id' => $_ua_id + ) + ); + } + else { + return $sql->update_table('user_coach', + array( + 'ua_name' => $_name, + 'ua_helper' => $_helper + ), + array( + 'ua_id' => $_ua_id + ) + ); + } } } diff --git a/event_handler.php b/event_handler.php index 01e1edb..df07956 100755 --- a/event_handler.php +++ b/event_handler.php @@ -142,9 +142,12 @@ if (isset($_POST['action'])) { break; case 'coach_data_edit': # edző update - if (isset($_POST['ua_can_login']) && !empty($_POST['ua_can_login'])) { + if (isset($_POST['ua_can_login']) && !empty($_POST['ua_can_login']) && !empty($_POST['ua_password'])) { $psw = md5($_POST['ua_password']); } + elseif (isset($_POST['ua_can_login']) && !empty($_POST['ua_can_login']) && empty($_POST['ua_password'])) { + $psw = "-1"; //ez jelzi h nem szabad updatelni + } else { $psw = "null"; }