From ab246b3f20c77a9fc6fc0cf279bf446dc62a4ce6 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Sun, 17 Jul 2016 18:22:04 +0200 Subject: [PATCH] Graphismes client virtuel --- test/client/background.php | 20 ++- test/client/interface.php | 278 +++++++++++++++++++------------------ 2 files changed, 154 insertions(+), 144 deletions(-) diff --git a/test/client/background.php b/test/client/background.php index f8d05c6..f7e1811 100644 --- a/test/client/background.php +++ b/test/client/background.php @@ -53,9 +53,14 @@ '@data' => json_encode( $_SESSION['history'] ), '@renew' => sessionManager::secure_hash( $_COOKIE['mac_password'], 10) ]); + $parsedResponse = json_decode( $response, true ); - $_COOKIE['mac_count'] = 9; - setcookie('mac_count', $_COOKIE['mac_count'], time()+3600*24*365, '/'); + + // On change les données locales uniquement si on a une réponse positive + if( $parsedResponse['ModuleError'] == 0 ){ + $_COOKIE['mac_count'] = 9; + setcookie('mac_count', $_COOKIE['mac_count'], time()+3600*24*365, '/'); + } }else{ @@ -64,17 +69,20 @@ '@token' => $token, '@data' => json_encode( $_SESSION['history'] ) ]); + $parsedResponse = json_decode( $response, true ); - $_COOKIE['mac_count']--; - setcookie('mac_count', $_COOKIE['mac_count'], time()+3600*24*365, '/'); + + // On change les données locales uniquement si on a une réponse positive + if( $parsedResponse['ModuleError'] == 0 ){ + $_COOKIE['mac_count']--; + setcookie('mac_count', $_COOKIE['mac_count'], time()+3600*24*365, '/'); + } } - $parsedResponse = json_decode( $response, true ); $toReturn = [ 'response' => $parsedResponse, - 'pwd' => $_COOKIE['mac_password'], 'count' => $_COOKIE['mac_count'], 'token' => $token, 'status' => $parsedResponse['ModuleError'], diff --git a/test/client/interface.php b/test/client/interface.php index 80fe77d..9042584 100644 --- a/test/client/interface.php +++ b/test/client/interface.php @@ -4,7 +4,7 @@ $_SESSION['history'] = []; if( !isset($_COOKIE['mac_password']) || !isset($_COOKIE['mac_count']) ){ - $_COOKIE['mac_count'] = 9; + $_COOKIE['mac_count'] = 10; $_COOKIE['mac_password'] = 'macPassword'; setcookie('mac_count', $_COOKIE['mac_count'], time()+3600*24*365, '/'); @@ -25,156 +25,158 @@ + + + -

-

+
+
+
+ + +
+
AB-CD-EF-GH
+
12-CD-56-GH
+
+ + + -

-

-

-

-

-

- - -
- -


-
-

-
-