Commit bb6a08e5d6a1718f775650f51c13379c1eab88ab

Authored by Jean Wasilewski
1 parent 757d26ad

Added full creds authentication

Showing 2 changed files with 35 additions and 0 deletions   Show diff stats
checkCreds.php 0 → 100644
... ... @@ -0,0 +1,25 @@
  1 +<?php
  2 +
  3 +if(!(isset($_GET["user"])&&isset($_GET["pass"])))
  4 + die("Nop");
  5 +
  6 +$link = mysql_connect(__MYSQL_HOSTNAME__, __MYSQL_USERNAME__, __MYSQL_PASSWORD__)
  7 + or die("Nop");
  8 +
  9 +if(!mysql_select_db('crep', $link))
  10 + die 'Nop';
  11 +
  12 +$requete = 'SELECT pk, admin FROM users WHERE username=\''.$_GET["user"].'\' AND password=\''.$_GET["password"].'\'';
  13 +$resultat = mysql_query($requete);
  14 +
  15 +if (!$resultat)
  16 + die("Nop");
  17 +
  18 +if(row = mysql_fetch_assoc($resultat))
  19 + echo 'Yep';
  20 +else
  21 + echo 'Nop';
  22 +
  23 +
  24 +mysql_close($link);
  25 +?>
... ...
connect.php
... ... @@ -46,5 +46,15 @@ $(&#39;#afficherMotDePasse&#39;)[0].addEventListener(&#39;mouseup&#39;, function()
46 46 $('#validCreds')[0].addEventListener('click', function()
47 47 {
48 48 $("#validCreds")[0].disabled=true;
  49 + var checkPath = "checkCreds.php?user=";
  50 + checkCreds += $("#Entrer_Identifiant_3")[0].value;
  51 + checkCreds += "&pass=";
  52 + checkCreds += Whirlpool($("#entrer_mot_de_passe_3")[0].value);
  53 + ret = file(checkCreds);
  54 + if(ret=="yep")
  55 + document.location.reload();
  56 + else
  57 + alert("Mauvais identifiants");
  58 + $("#validCreds")[0].disabled=false;
49 59 });
50 60 </script>
... ...