PHP Perfect Shower
by Stephen Blair on Jun.17, 2009, under A PHP Life
If your shower knew PHP, you would have a perfect shower every time!
// PHP Perfect Shower | Stephen R. Blair | www.srblair.com
require_once('water_control.php');
// Run the hot water if it is not already running
if(!isset($hotWater)) {
$hotWater = true;
hotWaterTemp(); //Get the hot water temperature
}
// Run the cold water if it is not already running
if(!isset($coldWater)) {
$coldWater = true;
coldWaterTemp(); //Get the cold water temperature
}
$targetWaterTemp = '107'; // Your ideal water temperature in degrees
$currentWaterTemp = $hotWaterTemp - $coldWaterTemp; // The current water temperature
// Adjust the hot and cold water until desired temperature is met
while($currentWaterTemp != $targetWaterTemp) {
if($currentWaterTemp > $targetWaterTemp) {
moreColdWater(); // Add cold water if it is too hot
} else
if($currentWaterTemp < $targetWaterTemp) {
moreHotWater(); // Add hot water if it is too cold
}
}



















December 21st, 2009 on 10:41 pm
Blair, good script (ads server) just a few lines for add ads that jacascript code I’ll try to do it and send you the code if yo agree, and also too add a click counter