From f6f257067f4fe535749db265e8f7aa021f2aa6d7 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Tue, 20 Oct 2015 23:41:55 +0200 Subject: [PATCH] =?UTF-8?q?Connection=20ok,=20reste=20=C3=A0=20faire=20mod?= =?UTF-8?q?ifications=20css=20(bouton=20quitter[OPT])?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- css/layout.css | 41 +++++++++-- css/menu.css | 2 + index.php | 66 ++++++++++++------ js/actionScript.js | 0 src/userlist.json | 32 +++++++++ ...-UI-Components-Responsive-web-template.jpg | Bin xdoc/final2.png | Bin 7 files changed, 116 insertions(+), 25 deletions(-) mode change 100644 => 100755 js/actionScript.js create mode 100755 src/userlist.json mode change 100644 => 100755 xdoc/Flat-Design-UI-Components-Responsive-web-template.jpg mode change 100644 => 100755 xdoc/final2.png diff --git a/css/layout.css b/css/layout.css index 9c4e47a..25724ed 100755 --- a/css/layout.css +++ b/css/layout.css @@ -128,15 +128,44 @@ body{ left: calc( 50% - 250px/2 ); width: 250px; + /* z axis */ + z-index: 101; +} + +/* style des labels */ +#AUTH label{ /* foreground */ color: #fff; font-weight: bold; text-transform: uppercase; line-height: 3em; text-shadow: 1px 1px 0 #666; +} - /* z axis */ - z-index: 101; +/* bouton quitter */ +#AUTH::after{ + content: 'x'; + display: block; + position: absolute; + top: 0; + left: calc( 100% - 25px ); + width: 25px; + height: 25px; + + border-radius: 100% / 100%; + border: 2px solid #aaa; +} + + +/* message qui dit que les identifiants sont incorrects */ +#AUTH .errorbox{ + display: inline-block; + width: 100%; + height: 2em; + + font-size: .8em; + color: #d50c4d; + line-height: 1em; } #AUTH_FILTER.active + #AUTH{ display: block; } @@ -144,7 +173,7 @@ body{ /* tout les INPUT */ #AUTH input{ /* position */ - display: block; + display: inline-block; position: relative; top: 0; left: 0; @@ -153,7 +182,7 @@ body{ padding: .8em; /* border */ - border-radius: 5px; + border-radius: 3px; border: 1px solid #A1A1A1; /* foreground */ @@ -166,6 +195,9 @@ body{ -o-transition: .2s ease-in-out; } + +#AUTH input[type=password]{ margin-bottom: 0; } + /* INPUT text/password */ #AUTH input[type=text]:focus, #AUTH input[type=password]:focus{ @@ -189,6 +221,7 @@ body{ cursor: pointer; } + #AUTH input[type=submit]:hover{ background-color: #2494de; } diff --git a/css/menu.css b/css/menu.css index aded677..d2fb944 100755 --- a/css/menu.css +++ b/css/menu.css @@ -35,6 +35,8 @@ cursor: pointer; } +#HEADER a.colored{ background: #6c336d; } + #HEADER #MENU a:nth-child(1):hover, #HEADER a:hover{ background-color: #6c336d; } #HEADER #MENU a:nth-child(2):hover{ background-color: #6eab2e; } diff --git a/index.php b/index.php index 44611b9..0ab7986 100755 --- a/index.php +++ b/index.php @@ -1,15 +1,27 @@ 1 && strlen($_POST['password']) > 1; // d'au moins 2 caractères +$LOGIN_postAreSet = isset($_POST['username']) && isset($_POST['password']); // variables POST existent +$LOGIN_postStrings = $LOGIN_postAreSet && is_string($_POST['username']) && is_string($_POST['password']); // sont toutes 2 des strings +$LOGIN_postNotEmpty = $LOGIN_postStrings && strlen($_POST['username']) > 1 && strlen($_POST['password']) > 1; // d'au moins 2 caractères -if( $postNotEmpty ){ - $userlist = file_get_contents('src/userlist.json'); +// $_SESSION['username'] = null; + +// si on a soumis le formulaire +if( $LOGIN_postNotEmpty ){ + $userlist = file_get_contents('src/userlist.json'); + $userlistObj = json_decode($userlist); + + if( $userlistObj != null ){ // si format non corrompu + + if( isset($userlistObj->{$_POST['username']}) ) // si non d'utilisateur connu + if( $userlistObj->{$_POST['username']}->password == $_POST['password'] ) // si mot de passe ok + $_SESSION['username'] = $_POST['username']; + } } - // $_SERVER['HTTP_USER_AGENT']; // dépends du navigateur (version, système X, OS) - // $_SERVER['REMOTE_ADDR']; // ip publique de l'utilisateur +if( !(isset($_SESSION['username']) && is_string($_SESSION['username']) && strlen($_SESSION['username']) > 1) ) + $_SESSION['username'] = null; + ?> @@ -59,21 +71,37 @@ if( $postNotEmpty ){ 1 ) - echo ''.$_SESSION['username'].''; + echo "".$_SESSION['username'].""; else - echo "Authentificaiton"; + echo "Authentification"; ?> + "; + echo "
"; + echo ""; + echo ""; + echo ""; + echo "  Identifiants incorrects."; + echo ""; + echo "
"; -
-
- Connection - - - -
+ }else{ // si chargement normal de la page + + echo "
"; + echo "
"; + echo ""; + echo ""; + echo ""; + echo " "; + echo ""; + echo "
"; + } + ?> + @@ -91,8 +119,4 @@ if( $postNotEmpty ){ - - - - - + \ No newline at end of file diff --git a/js/actionScript.js b/js/actionScript.js old mode 100644 new mode 100755 diff --git a/src/userlist.json b/src/userlist.json new file mode 100755 index 0000000..5b1059e --- /dev/null +++ b/src/userlist.json @@ -0,0 +1,32 @@ +{ + "eleve1": { + "permissions": "student", + "password" : "eleve1password" + }, + + "eleve2": { + "permissions": "student", + "password" : "eleve2password" + }, + + "prof1": { + "permissions": "teacher", + "password" : "prof1password" + }, + + "prof2": { + "permissions": "master", + "password" : "prof2password" + }, + + "admin1": { + "permissions": "admin", + "password" : "admin1password" + }, + + "admin2": { + "permissions": "admin", + "password" : "admin2password" + } + +} \ No newline at end of file diff --git a/xdoc/Flat-Design-UI-Components-Responsive-web-template.jpg b/xdoc/Flat-Design-UI-Components-Responsive-web-template.jpg old mode 100644 new mode 100755 diff --git a/xdoc/final2.png b/xdoc/final2.png old mode 100644 new mode 100755