Skip to content

Instantly share code, notes, and snippets.

@ZenCocoon
Created December 21, 2009 14:11
Show Gist options
  • Save ZenCocoon/260962 to your computer and use it in GitHub Desktop.
Save ZenCocoon/260962 to your computer and use it in GitHub Desktop.
<html>
<Head>
<Title> Identifiez vous </Title>
<script type="text/javascript">
//Verifie coté client que le formulaire est bien rempli
function control(form_Authentification)
{
var va_login=document.form_Authentification.login.value;
var va_password=document.form_Authentification.password.value;
//AMELIORATION POSSIBLE :Fonction verif saisie() + parametres login et password
if((va_login.length < 6)&&(va_login.length != 0))
{
// NE FONCTIONNE PAS SOUS FIREFOX window.showModalDialog("Page principale.html",null,"dialogWidth:430px;dialogHeight:280px;center:1;scroll:0;help:0;status:0");
//window.alert=boiteMessage("a","b","c","PS");
window.alert=boiteMessage("Message d'erreur","Votre IDENTIFIANT comporte au minimum 6 caractères","ok","");
//alert("Votre IDENTIFIANT comporte au minimum 6 caractères");//A REMPLACER PAR boiteMessage()
document.form_Authentification.login.focus();
}
else if (va_login.length == 0 )
{
alert("Vous n'avez pas renseigné votre IDENTIFIANT");
document.form_Authentification.login.focus();
}
else if((va_password.length < 6)&&(va_password.length != 0))
{
alert("Votre MOT DE PASSE comporte au minimum 6 caractères");
document.form_Authentification.password.focus();
}
else if (va_password.length == 0 )
{
alert("Vous n'avez pas renseigné votre MOT DE PASSE");
document.form_Authentification.password.focus();
}
else window.parent.document.forms[0].submit();
//alert("Vous avez tapé:\nIDENTIFIANT: "+ va_login +"\nMOT DE PASSE: "+ va_password);
}
//Initialiser la boite de dialogue
function boiteMessage(titre,texte,nomBouton,image)
{
//
var titreBoite=titre;
var newTitre = document.createElement('span');
newTitre.setAttribute('class','titreBoite');
newTitre.innerHTML=titreBoite;
var texteBoite = texte;
var newTexte = document.createElement('span')
newTexte.setAttribute('class','texte');
newTexte.innerHTML=texteBoite;
var nomBtn= nomBouton;
var newBouton=document.createElement('button');
newBouton.setAttribute('class','nomBouton');
newBouton.setAttribute('onclick',"alert('ok');");
newBouton.innerHTML=nomBtn;
//A Ameliorer pour une insertion auto de l'image en fonction du nom du message
var IMG= image;
var nomIMG = titreBoite+'.png';
var newImage=document.createElement('span');
newImage.setAttribute('class','img');
//newImage.setAttribute('src',nomIMG);
// newImage.setAttribute('style','background:#111111;background-image:url(../../'+nomIMG+');background-repeat: no-repeat;background-position: 10px center;;width:50px;height:50px;'); //Opacity obligatoire sinon transparent par defaut
newImage.innerHTML=IMG;
var boiteModal=document.createElement('div');
boiteModal.setAttribute('class','boiteModal');
//boiteModal.setAttribute('style','width:'+(screen.width)+'px;height:'+(screen.height)+'px;position:absolute;top:0px;left:0px;z-index:50;background-color:#636466;opacity:0.20;');
var newBoite=document.createElement('div');
newBoite.setAttribute('id','boiteMessage');
newBoite.setAttribute('class','boite');
document.body.appendChild(boiteModal);
document.body.appendChild(newBoite);
newBoite.appendChild(newTitre);
newBoite.appendChild(newTexte);
newBoite.appendChild(newBouton);
newBoite.appendChild(newImage);
this.persist();
}
</script>
<style>
.titreBoite
{
display:block;
border-bottom:1px solid #ccc;
background-color:#999999;
}
.boite
{
width:350px;
height:200px;
border:2px solid #ccc;
background-color:#fff;
position:absolute;
top:50%;
margin-top:-100px;
left:50%;
margin-left:-175px;
z-index:51;
}
.nomBouton
{
color:#666666;
position:absolute;
left:140px;
width:70px;
height:20px;
top:150px;
}
.texte
{
text-align:center;
color:#666666;
font-size:14;
display:block;
width:75%;
height:60%;
margin-left:70px;
margin-top:15px;
position:absolute;
}
.img
{
width:50px;
height:50px;
top:40%;
left:10px;
position:absolute;
background:transparent;
background-repeat: no-repeat;
background-position: 10px center;
background-image: url(http://www.gravatar.com/avatar/27d2d30a76ac78db57e29659ad3d9771?rating=PG&size=50&default=https%3A%2F%2Fbookingsync.local%2Fimages%2Fadmin%2Fno-avatar.png);
}
.boiteModal
{
width:100%;
height:100%;
position:absolute;
top:0px;
left:0px;
z-index:50;
background-color:#636466;
opacity:0.80;
}
</style>
</Head>
<Body>
<Center>
<form name="form_Authentification" method='POST' action='http://localhost/Projet2/www/PRIVATE/php/Connection.php'>
<BR></BR>
<B>IDENTIFIANT</B>
<BR></BR>
<input Type="text" Size = "40" Name="login" Maxlength="20" accept-charset="0-9">
<BR></BR>
<BR></BR>
<B>MOT DE PASSE</B>
<BR></BR>
<INPUT Type="password" Size = "40" Name="password" Maxlength="20" accept-charset="0-9">
<BR></BR>
<INPUT TYPE="button" name="valider" value="VALIDER" onClick="control(form_Authentification)">
</form>
</center
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment