File "page.php"

Full Path: /home/analogde/www/RaspBerry/Dev/Raspberry/page.php
File size: 1.72 KB
MIME-type: text/x-php
Charset: utf-8

<?php

	session_start();
	
	//error_reporting(0);

	$user = "root";
	$password = "";
	$host = "localhost";
	$db = "raspberry";

	$db_connection = mysql_connect($host, $user, $password);
	mysql_select_db($db, $db_connection); 

	/* prevoir une base de donnée pour sauvegarder l'état de l'alarme */

/*******************************************************************/	
/* lire un ligne du fichier */
    $fp = fopen ("status.txt", "r+"); /* lecture + ecriture */
    $status_alarme = fgets($fp);
    fclose ($fp);
    //echo 'Notre fichier contient : '.$status_alarme;

/*******************************************************************/
/* lire toutes les lignes du fichier */
/*	$f = fopen("unitednations.txt", "r");
	while(!feof($f)) {
	    echo fgets($f) . "<br />";
	}
	fclose($f);*/



/*******************************************************************/	
	/*<?php echo $champ_nom; ?>	*/
?>

<!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>Document sans nom</title>
</head>



<body>
<table width="515" border="1">
  <tr>
    <th width="18" scope="col">GPIO #</th>
    <th width="56" scope="col">Description</th>
    <th width="24" scope="col">Statut</th>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
<?php

    if($status_alarme == 'off')
	{
	   echo '<td><img id="button1" src="off.jpg" width="100" height="100" alt="off" title="off" /></td>';
	}
	else
	{
	   echo '<td><img id="button1" src="on.jpg" width="100" height="100" alt="on" title="on" /></td>';
	}
?>
	
  </tr>
 
</table>


<script src="script.js"></script>



</body>
</html>