| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 
 | index.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >
   <head>
       <title>Intranet MARK IV Automotive</title>
       <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
	<meta http-equiv="refresh" content="10" >
 
	<script type='text/JavaScript'>
 
	 		function getXhr(){
                                var xhr = null; 
				if(window.XMLHttpRequest) // Firefox et autres
				   xhr = new XMLHttpRequest(); 
				else if(window.ActiveXObject){ // Internet Explorer 
				   try {
			                xhr = new ActiveXObject("Msxml2.XMLHTTP");
			            } catch (e) {
			                xhr = new ActiveXObject("Microsoft.XMLHTTP");
			            }
				}
				else { // XMLHttpRequest non supporté par le navigateur 
				   alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest..."); 
				   xhr = false; 
				} 
                                return xhr;
			}
 
			/**
			* Méthode qui sera appelée sur le click du bouton
			*/
			function go(name){
				var xhr = getXhr();
 
				xhr.onreadystatechange = function(){
					// On ne fait quelque chose que si on a tout reçu et que le serveur est ok
					if(xhr.readyState == 4 && xhr.status == 200){
						window.location.reload();
						//alert(xhr.responseText);
					}
				}
 
 
				xhr.open("GET","http://10.104.0.5/Demande.php?Name="+name,true);
				xhr.send(null);
			}
	</script>
 
 
   </head>
 
   <body>
 
 
 
<?php
 
		$db = mysql_connect('10.104.0.5', 'toto', 'toto');
		mysql_select_db('Markiv',$db);
 
		if($Cellule!='') $result = mysql_query("SELECT * FROM Demande WHERE Cellule='$Cellule'");
 
		if($Cellule2!='') $result = mysql_query("SELECT * FROM Demande WHERE Cellule IN ('$Cellule', '$Cellule2')"); 
 
		?>
 
		<table width="750" border="0" align="center" cellpadding="0" cellspacing="1">
		<tr>
		<td align="center">
 
		<?php include("Titre.php"); ?>
 
		<table width="99%" border="0" cellpadding="3" cellspacing="0" bgcolor="#FFFFFF">
		<tr>
		</tr>
		<tr>
		<td width="250">Cellules</td>
		<td width="50">Button</td>
		<td width="50">Statut</td>
        	<td width="150">Dernière modification</td>
		</tr>
 
		<?php
                while ($donnees = mysql_fetch_assoc($result))
                {
                ?>
 
		<tr>
		<td><font size=7><?php echo $donnees['Cellule']; ?></font></td>
		<td>
		<input 
 
		<?php if($donnees['Statut']!="Libre") echo "disabled"; ?>
		type='button' value='Demande AGV' onclick='go("<?php echo $donnees['Cellule']; ?>")' />
 
		</td>
		<td>
 
		<script type="text/javascript">
			if ( document.all )
			{
				function blink_show()
				{
					blink_tags  = document.all.tags('blink');
					blink_count = blink_tags.length;
					for ( i = 0; i < blink_count; i++ )
					{
						blink_tags[i].style.visibility = 'visible';
					}
 
					window.setTimeout( 'blink_hide()', 700 );
				}
 
				function blink_hide()
				{
				blink_tags  = document.all.tags('blink');
				blink_count = blink_tags.length;
				for ( i = 0; i < blink_count; i++ )
				{
					blink_tags[i].style.visibility = 'hidden';
				}
 
				window.setTimeout( 'blink_show()', 250 );
			}
 
			window.onload = blink_show;
		}
		</script>
 
		<?php if($donnees['Statut']=="Demande en cours") echo '<blink style="color:red">',$donnees['Statut'],'</blink>'; ?>
 
		<?php if($donnees['Statut']=="Libre") echo "Libre"; ?>
 
		<?php if($donnees['Statut']=="AGV en transit") echo '<blink style="color:green">',$donnees['Statut'],'</blink>'; ?>
 
		</td>
              <td><?php echo $donnees['Time']; ?></td>
		</tr>
		<tr>
		<td> </td>
		<td> </td>
 
 		<?php
                $celluletmp=$donnees['Cellule'];
                $minute = 5;
                $date = date("c");
                $date1= date('Y-m-d H:i:s',strtotime("+$minute minutes", strtotime($donnees['Time'])));
                
                if($donnees['Statut']=="AGV en transit"){
                        if(strtotime($date) > strtotime($date1)){
                                 $req = mysql_query("UPDATE Demande SET Statut ='Libre', Time='$date' WHERE Cellule='$celluletmp'");
                        }
                }
 
                }
 
                mysql_close($db);
                ?>
 
   </body>
</html> | 
Partager