Code javaScript pour mot de passe

Fermé
whistler71 Messages postés 44 Date d'inscription vendredi 15 février 2008 Statut Membre Dernière intervention 10 avril 2008 - 28 févr. 2008 à 17:32
Reivax962 Messages postés 3671 Date d'inscription jeudi 16 juin 2005 Statut Membre Dernière intervention 11 février 2021 - 29 févr. 2008 à 12:22
Bonjour la compagnie, je suis débutante et j'essay de mettre un mot de passe afin de "protéger" une page html.
Je suis consciente que ce n'est qu'une toute petite sécurité.
J'ai trouvé ce code que j'ai rentré sur la page a protéger, quand je l'ouvre avec mon navigateur on me demande le mot de passe, mais lorsque je met le tout sur mon serveur (free), on ne me demande plus le mot de passe avant d'ouvrir la page, je ne comprend pas pourquoi...
Pouvez vous m'aidez, je vous mais ici le code que j'ai trouvé:



<head><!--Voir : http://www.editeurjavascript.com/-->
<SCRIPT LANGUAGE="JavaScript">
/*
SCRIPT EDITE SUR L'EDITEUR JAVASCRIPT
http://www.editeurjavascript.com
*/
moncode = prompt('Et le mot de passe alors?? hi hi','');
if (moncode != "mon mot de passe")
        {
        location.href="http://monsite.free.fr/pageErreur.html";
        }
</SCRIPT></head>


J'ai essayé avec et sans les <head>

4 réponses

Reivax962 Messages postés 3671 Date d'inscription jeudi 16 juin 2005 Statut Membre Dernière intervention 11 février 2021 1 011
28 févr. 2008 à 17:40
Bonjour,

Il faudrait que tu fasses "afficher la source" quand tu regardes ta page sur ton serveur free, et que tu nous donnes le résultat.

Xavier
0
whistler71 Messages postés 44 Date d'inscription vendredi 15 février 2008 Statut Membre Dernière intervention 10 avril 2008 1
28 févr. 2008 à 17:47
merci pour t'as reponse,

<LINK REL="SHORTCUT ICON" href=" http://XXXXXX.free.fr/accueil/favicon.ico">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>XXXXXXX</title>
<link rel="stylesheet" href="template137/style.css" type="text/css" />
<style type="text/css">
<!--
.Style5 {font-size: small}
.Style6 {color: #996600}
-->
</style>
</head>
<body>
<div id="page">
<div id="header">
	<div id="headerimg">

		<h1><a href="#"></a></h1>
	</div>
</div>
<hr />
	<div id="content" class="narrowcolumn">
			<div class="post" id="post-1">
				<h2 align="center"><a href="#" title="Permanent Link to Hello world!">°° Téléchargement</a> °°</h2>
			  <div class="entry">

				  <p> </p>
					<p> </p>
					<p> </p>
			<div><div><div>
					  <p align="center"><img src="accueil/en construction.gif" width="254" height="193" border="0" /></p>
					  <p align="center"> </p>
					  <p align="center"><strong>--> <a href="http://XXXXXX.free.fr/Roma.rar">ici</a> <-- </strong></p>

			</div>
			            </div>
	            </div>
			  </div>
	  </div>
		<div class="navigation">
		  <p align="right"> </p>
		  <div class="alignright"></div>
	  </div>

	</div>
	<div id="sidebar">
		<ul>

			<li class="pagenav">
			  <h2 align="center"><img src="dl/logo.jpg" width="147" height="110" /></h2>
		  </li>
      </ul>
	    <ul>

	      <li class="pagenav"> </li>
      </ul>
	    <h3 align="center" class="pad"><span class="Style5"><a href="index.html">Accueil</a></span></h3>
	    <h3 align="center" class="pad Style5"><a href="page Gallerie.html">Gallerie</a></h3>
	    <h3 align="center" class="pad Style5"><a href="page trip.html">Trip</a></h3>
	    <h3 align="center" class="pad Style5"><a href="page--liens.html">Liens</a></h3>

	    <h3 align="center" class="pad Style5"><a href="pageContact.html">Contact</a></h3>
	    <h3 align="center" class="pad Style5"><a href="pageLivreOr.html">Livre d'or </a></h3>
	    <h3 align="center" class="pad Style5 Style6">Téléchargement</h3>
	    <ul><li>
	      <ul>
	        <li></li>
          </ul>

	    </li>
      </ul>
    </div>
<hr />
<div id="footer">
	<p>© XXXXX.</p>
</div>
<!-- We request you retain the full web design copyright notice below including the link to https://www.sarkis-webdesign.com/ . This not only gives respect to the large amount of time given freely by the designer but also helps build interest, traffic and use of template. If you cannot (for good reason) retain the full design copyright we request you at least leave in place the link Web design by Sarkis, with linked to https://www.sarkis-webdesign.com/ . Good luck! Web designer Sarkis -->
<div class="design_copyright">
<a href="https://www.sarkis-webdesign.com/" title="Web Design" class="web_design">Web design</a> by <a href="https://www.sarkis-webdesign.com/" title="Website Designer" class="website_designer">website designer</a> Sarkis. <a href="http://freelancewebmarket.com/" title="Outsourcing" class="outsourcing">Outsourcing</a> by FreelanceWebmarket.

</div>
</div>
</body>
</html>



C'est bien ce code que tu voulais?? mais c'est bizarre, le code javaScript ne s'affiche pas??
0
whistler71 Messages postés 44 Date d'inscription vendredi 15 février 2008 Statut Membre Dernière intervention 10 avril 2008 1
28 févr. 2008 à 18:13
s'il vous plait!! a l'aide !!!!
0
whistler71 Messages postés 44 Date d'inscription vendredi 15 février 2008 Statut Membre Dernière intervention 10 avril 2008 1
28 févr. 2008 à 20:17
C'est bon j'ai trouvé!!!! merci quand mm ;)
0
Reivax962 Messages postés 3671 Date d'inscription jeudi 16 juin 2005 Statut Membre Dernière intervention 11 février 2021 1 011
29 févr. 2008 à 12:22
Tu pourrais nous donner la solution, des fois que quelqu'un ait le même problème que toi ?
0