File "keynum02_bis.html"

Full Path: /home/analogde/www/RaspBerry/HTML/keynum02_bis.html
File size: 8.37 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: 10px auto;
    padding: 0;
    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)
{
	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()
{
	alert("plouf");
}



function call()
{
	
	//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>

<form name="codepad"  method="post" >
<input type=hidden name=thecode value=""> 
</form>

<table class="keypad">
	<tr class="key-row">
		<td class="key-cell">
			<button class="btn btn-default key" type="button">
			<script language="javascript">
			document.write("<a onClick=enter_code(" + pic[mis[1]] + ") 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">
            <script language="javascript">
			document.write("<a onClick=enter_code(" + pic[mis[2]] + ") 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">
            <script language="javascript">
			document.write("<a onClick=enter_code(" + pic[mis[3]] + ") 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">
			<script language="javascript">
			document.write("<a onClick=enter_code(" + pic[mis[4]] + ") 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">
            <script language="javascript">
			document.write("<a onClick=enter_code(" + pic[mis[5]] + ") 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">
            <script language="javascript">
			document.write("<a onClick=enter_code(" + pic[mis[6]] + ") 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">
            <script language="javascript">
			document.write("<a onClick=enter_code(" + pic[mis[7]] + ") 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"><script language="javascript">
			document.write("<a onClick=enter_code(" + pic[mis[8]] + ") 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">
            <script language="javascript">
			document.write("<a onClick=enter_code(" + pic[mis[9]] + ") 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">
            <script language="javascript">
			document.write("<a onClick=enter_code(" + pic[mis[10]] + ") 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">
            <script language="javascript">
			document.write("<a onClick=enter_code(" + pic[mis[11]] + ") 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">
            <script language="javascript">
			document.write("<a onClick=enter_code(" + pic[mis[12]] + ") 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">
            <script language="javascript">
			document.write("<a onClick=enter_code(" + pic[mis[13]] + ") 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">
            <script language="javascript">
			document.write("<a onClick=enter_code(" + pic[mis[14]] + ") 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">
            <script language="javascript">
			document.write("<a onClick=enter_code(" + pic[mis[15]] + ") 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"><script language="javascript">
			document.write("<a onClick=enter_code(" + pic[mis[16]] + ") 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>


</body>
</html>