No cache version.

Caching disabled. Default setting for this page:enabled (code LNG204)
If the display is too slow, you can disable the user mode to view the cached version.

Vous devez être membre et vous identifier pour publier un article.
Les visiteurs peuvent toutefois commenter chaque article par une réponse.

[98] Protection d'un répertoire

Astuces de l’Infobrol (Windows (Généralités))Article publié le 25/10/2003 17:15:56


Depuis Windows 98 il est possible de personnaliser l'apparence d'un dossier. Ce qui se cache derrière cette personnalisation est en fait un joli code HTML et ... JAVASCRIPT.
Il est donc aisé d'y introduire un code demandant un mot de passe et n'autorisant l'accès à la fenêtre du dossier que si le mot de passe est correct.

Étapes de création
1. Prenez un dossier au hasard et faites un clic droit là où il n'y a pas d'icone
2. Choisissez 'Personnaliser ce dossier' puis 'Choisir ou modifier un modèle HTML pour ce dossier'
3. Prenez le modèle qui vous plait et cliquez sur la case 'Modifier ce modèle'
4. Mettez onload="CheckPassword();" dans l'ouverture de la balise BODY
5. Entrez ce code dans le fichier en début de fichier par exemple :

  1. ‹script language=JScript›
  2. var pass="";
  3. var child;
  4.  
  5. function CheckPassword()
  6. {
  7. document.body.style.visibility="hidden";
  8. child=window.open("", "", "menubar=no,alwaysRaised=yes,resizable=no,scrollbars=no,status=no,width=250,height=100");
  9. child.document.open();
  10.  
  11. child.document.write("‹html›‹head›‹title›Mot de passe requis‹/title›‹sc");
  12. child.document.write("cript language=javascript›‹/scr");
  13. child.document.write("ipt›‹scri");
  14. child.document.write("pt›function nop() { return false; }‹/scri");
  15. child.document.write("pt›‹scr");
  16. child.document.write("ipt›function login() { window.opener.pass='.'+pwd.value; } ‹/scri");
  17. child.document.write("pt›‹/head›‹style›body { font-family: Tahoma; font-size: 9pt; font-weight:bold; color: #333399; } input { font-family: Tahoma; font-size: 8pt; color: #993333; }‹/style›");
  18. child.document.write("‹body bgcolor=#e0e0e0 onUnLoad='bye();'›‹center›Entrez le mot de passe :‹br›‹input type='password' name='pwd' size='20' value='undefined'›‹br›‹br›‹input type='button' value=' Login ' onClick='login();' style='color=#228822'›‹/p›‹/body›‹sc");
  19. child.document.write("ript language=JScript›document.oncontextmenu=nop; document.body.onclick=nop;‹/scri");
  20. child.document.write("pt›‹/html›");
  21. setTimeout("GetPwd()", 150);
  22. }
  23.  
  24. function GetPwd()
  25. {
  26. if(pass=="")
  27. setTimeout("GetPwd()", 150);
  28. else
  29. {
  30. child.close();
  31.  
  32. if(pass!=".OpenMe")
  33. {
  34. window.location="C:";
  35. return false;
  36. }
  37. else
  38. {
  39. document.body.style.visibility="visible";
  40. return true;
  41. }
  42. }
  43. return false;
  44. }
  45. ‹/script›


Trouvé sur http://www.javascriptfr.com

Avatar :: guest Un article de Knowledge Base

Source : indéterminée


Sélection, tri et recherche d'articles
FILTRER :
TRIER :1er critère : 2e critère :
CHERCHER : Dans les titres Dans le contenu


[Afficher les liens en fonction des critères du formulaire ci-dessus]

English translation

You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.

If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.

Thank you in advance.

Document created the 13/09/2004, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/ast-rf-22.html

The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.