File "keynum02_bis_debug.html"

Full Path: /home/analogde/www/RaspBerry/HTML/keynum02_bis_debug.html
File size: 8.55 KB
MIME-type: text/html
Charset: utf-8

<!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>Alarme control</title>

<style type="text/css">

.keypad {
    margin: 150px auto;
    padding: 20;
    width: 500px; /* not actually a static size, % in real use */
}

.keypad .key-row {
    width: 100%
}

.keypad .key-row .key-cell {
    padding: 2px;
    width: 20%;
}

.keypad .key-row .key-cell button.key {
    font-size: 3 ;  /*medium;*/
    font-weight: bold;
    height: 110px;
    width: 100%;
}

.keypad .key-row .key-cell button.key.tall-key {
    height: 224px;
}

.keypad .key-row .key-cell button.key.wide-key {
}

.keypad .key-row .key-cell button .key-alt-fn {
    font-size: 5; /*small;*/
    font-weight: normal;
}

</style>

<script language="javascript">

var nbr=16;
var pic=new Array(" "," "," "," "," "," "," ","0","1","2","3","4","5","6","7","8","9");
var mis=new Array(nbr); 

total=0; 
somme=0;

for(i=1;i<nbr;i++)
{  mis[i]=1+Math.round(Math.random()*(nbr-1));
   trouve=0; 
   for (j=1;j<i;j++) 
		{if (mis[j]==mis[i]) {trouve=1;} 
} 
   if (trouve==1) {i=i-1;}
   if (trouve==0) {total=total+mis[i];}
}

for(i=1;i<(nbr+1);i++)
{	somme=somme+i;
	mis[nbr]=somme-total;
}

var code=0
var code2=0
var digit=0

function enter_code(number)
{
	//var hu = document.getElementById(thecode).value; 

	codepad.thecode.value += number
	
	//code=code*10+number
	//document.codepad.thecode.value=code
	//code2=code2*10+number
	//document.codepad.password.value=code2
	digit++
	
	if (digit>6)
	{	
	   alert("Code limité à 6 chiffre");
	   location="login.php";
	}
}

function corriger()
{
	location="login.php";
}

function essai(valeur)
{
	var numero = pic[mis[valeur]] 
	enter_code(numero)
	//alert(numero);
}



function call()
{
	alert("zorro");
	//var userName = document.getElementById("userName").value;
    var user = "patrice";
	var password = document.getElementById("password").value;
	//var lulu = document.codepad.password.value
	
	xmlHttpRequest=new XMLHttpRequest();
	xmlHttpRequest.onreadystatechange=function() 
	{
		if (xmlHttpRequest.readyState==4) 
		{
			ajax_action(xmlHttpRequest.responseText);
			
		}
	}

	xmlHttpRequest.open("GET","traitement.php?user="+user+"&password="+password,true);
	xmlHttpRequest.send();

}


function ajax_action(str)
{

	if(str == 1)
	{
		alert("GOOD");
		document.location.href="gestion_systeme.php"
	}
	else{
		  alert("Password failed try again later");
		  document.location.href="login.php"
		}
}

</script>

</head>

<body oncontextmenu="return false">
<!--
<form name="codepad"  method="post" >
<input type=hidden name=thecode value=""> 
</form>
-->

<form name="codepad"  method="post" >

<table class="keypad">

	<tr class="key-row">
		<td class="key-cell">
			<!-- <input disabled size=16 type="password" name="password" id="password">
			<!-- <input type=hidden name=thecode value="">  -->
			<input type="text" name=thecode value="">
		</td>
	</tr>

	<tr class="key-row">
		<td class="key-cell">
			<button class="btn btn-default key" type="button" onClick=essai(1)>
			<script language="javascript">
			document.write("<a name=" + pic[mis[1]] + "><font color=black><b>"
			+ pic[mis[1]] + "</b></font></a>")
			</script></button>
		</td>
        <td class="key-cell">
			<button class="btn btn-default key" type="button" onClick=essai(2)>
            <script language="javascript">
			document.write("<a name=" + pic[mis[2]] + "><font color=black><b>"
			+ pic[mis[2]] + "</b></font></a>")
			</script></button>
		</td>
		<td class="key-cell">
			<button class="btn btn-default key" type="button"  onClick=essai(3)>
            <script language="javascript">
			document.write("<a name=" + pic[mis[3]] + "><font color=black><b>"
			+ pic[mis[3]] + "</b></font></a>")
			</script></button>
		</td>
		<td class="key-cell">
			<button class="btn btn-default key" type="button" onClick=essai(4)>
			<script language="javascript">
			document.write("<a name=" + pic[mis[4]] + "><font color=black><b>"
			+ pic[mis[4]] + "</b></font></a>")
			</script></button>
		</td>
        <!--
		<td class="key-cell">
   			<button class="btn btn-default key" type="button" disabled>Num<br/>Lock</button>
		</td>-->
        <td class="key-cell" rowspan="2">
			<button class="btn btn-default key tall-key" type="button">Corriger</button>
		</td>
        
	</tr>
    
	<tr class="key-row">
		<td class="key-cell">
			<button class="btn btn-default key" type="button"  onClick=essai(5)>
            <script language="javascript">
			document.write("<a name=" + pic[mis[5]] + "><font color=black><b>"
			+ pic[mis[5]] + "</b></font></a>")
			</script></button>
		</td>
		<td class="key-cell">
			<button class="btn btn-default key" type="button" onClick=essai(6)>
            <script language="javascript">
			document.write("<a name=" + pic[mis[6]] + "><font color=black><b>"
			+ pic[mis[6]] + "</b></font></a>")
			</script></button>
		</td>
		<td class="key-cell">
			<button class="btn btn-default key" type="button"  onClick=essai(7)>
            <script language="javascript">
			document.write("<a name=" + pic[mis[7]] + "><font color=black><b>"
			+ pic[mis[7]] + "</b></font></a>")
			</script></button>
		</td>
        <td class="key-cell">
			<button class="btn btn-default key" type="button"  onClick=essai(8)>
			<script language="javascript">
			document.write("<a name=" + pic[mis[8]] + "><font color=black><b>"
			+ pic[mis[8]] + "</b></font></a>")
			</script></button>
		</td>
<!--		<td class="key-cell" rowspan="2">
			<button class="btn btn-default key tall-key" type="button">+</button>
		</td> -->
	</tr>
    
	<tr class="key-row">
		<td class="key-cell">
            <button class="btn btn-default key" type="button"  onClick=essai(9)>
            <script language="javascript">
			document.write("<a name=" + pic[mis[9]] + "><font color=black><b>"
			+ pic[mis[9]] + "</b></font></a>")
			</script></button>
		</td>
		<td class="key-cell">
			<button class="btn btn-default key" type="button"  onClick=essai(10)>
            <script language="javascript">
			document.write("<a name=" + pic[mis[10]] + "><font color=black><b>"
			+ pic[mis[10]] + "</b></font></a>")
			</script></button>
		</td>
		<td class="key-cell">
			<button class="btn btn-default key" type="button"  onClick=essai(11)>
            <script language="javascript">
			document.write("<a name=" + pic[mis[11]] + "><font color=black><b>"
			+ pic[mis[11]] + "</b></font></a>")
			</script></button>
		</td>
        <td class="key-cell">
			<button class="btn btn-default key" type="button"  onClick=essai(12)>
            <script language="javascript">
			document.write("<a name=" + pic[mis[12]] + "><font color=black><b>"
			+ pic[mis[12]] + "</b></font></a>")
			</script></button>
		</td>
        <td class="key-cell" rowspan="2">
			<button class="btn btn-default key tall-key" onclick=essai(); type="button">
            Valider</button>
		</td>
	</tr>
    
	<tr class="key-row">
		<td class="key-cell">
			<button class="btn btn-default key" type="button"  onClick=essai(13)>
            <script language="javascript">
			document.write("<a name=" + pic[mis[13]] + "><font color=black><b>"
			+ pic[mis[13]] + "</b></font></a>")
			</script></button>
		</td>
		<td class="key-cell">
			<button class="btn btn-default key" type="button"  onClick=essai(14)>
            <script language="javascript">
			document.write("<a name=" + pic[mis[14]] + "><font color=black><b>"
			+ pic[mis[14]] + "</b></font></a>")
			</script></button>
		</td>
		<td class="key-cell">
			<button class="btn btn-default key" type="button"  onClick=essai(15)>
            <script language="javascript">
			document.write("<a name=" + pic[mis[15]] + "><font color=black><b>"
			+ pic[mis[15]] + "</b></font></a>")
			</script></button>
		</td>
		<td class="key-cell">
			<button class="btn btn-default key" type="button" onClick=essai(16)>
            <script language="javascript">
			document.write("<a name=" + pic[mis[16]] + "><font color=black><b>"
			+ pic[mis[16]] + "</b></font></a>")
			</script></button>
		</td>
						
						
						
						
<!--
		<td class="key-cell" rowspan="2">
			<button class="btn btn-default key tall-key" type="button">Enter</button>
		</td> -->
	</tr>
<!--    
	<tr class="key-row">
		<td class="key-cell" colspan="2">
			<button class="btn btn-default key wide-key" type="button">0<br/><span class="key-alt-fn">Insert</span></button>
		</td>
		<td class="key-cell">
			<button class="btn btn-default key" type="button">.<br/><span class="key-alt-fn">Delete</span></button>
		</td>
	</tr> -->
</table>

</form>

</body>
</html>