Witam,
Jestem mega początkujący i mam problem z połączeniem dwóch kodów w jeden duży działający.

Ten kod działa i jest wszystko OK:
  1. <?
  2. if(isset($_GET['on'])){
  3. $message = shell_exec("/var/www/power.sh on ".intval($_GET['on'],10));
  4. header("Location: test.php");
  5. exit;
  6. }
  7. if(isset($_GET['off'])){
  8. $message = shell_exec("/var/www/power.sh off ".intval($_GET['off'],10));
  9. header("Location: test.php");
  10. exit;
  11. }
  12. $lastRelay=10;
  13. ?>
  14. <!DOCTYPE html>
  15. body{
  16. min-width:500px;
  17. min-height:500px;
  18. height:100%;
  19. width:100%;
  20. background:#000 url('images/test.jpg') no-repeat left top;
  21. position:relative;
  22. margin:0;
  23. }
  24. a{
  25. position:absolute;
  26. display:block;
  27. }
  28. </style>
  29. <?php
  30. $buttonsPosition=array(
  31. array(50,50),
  32. array(100,100),
  33. array(150,150),
  34. array(200,200),
  35. array(250,250),
  36. array(300,300),
  37. );
  38. for($i=1;$i<$lastRelay;$i++){
  39. if(trim(shell_exec("/var/www/power.sh status ".$i))=='on')
  40. echo '<a href="?off='.$i.'" '.(isset($buttonsPosition[$i-1])?'style="left:'.$buttonsPosition[$i-1][0].'px;top:'.$buttonsPosition[$i-1][1].'px;"':'').'><img style="width: 50px; height: 50px;" src="images/on.png"></a>';
  41. else
  42. echo '<a href="?on='.$i.'" '.(isset($buttonsPosition[$i-1])?'style="left:'.$buttonsPosition[$i-1][0].'px;top:'.$buttonsPosition[$i-1][1].'px;"':'').'><img style="width: 50px; height: 50px;" src="images/off.png"></a>';
  43. usleep(10000);
  44. }
  45. ?>
  46. </html>

Tamten kod chciałbym połączyć z tym, ale nie bardzo wiem jak to zrobić poprawnie sad.gif
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <title>sypialnia swiatlo</title>
  6. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><style type="text/css">
  7.  
  8. #exCenter {
  9. background-color : #000000;
  10. width : 970px;
  11. margin : auto;
  12. }
  13.  
  14. #exHeader, #exContent, #exFooter {
  15. background-color : #000000;
  16. border : #000000 solid 0;
  17. margin-bottom : 0;
  18. }
  19.  
  20. #exLeftColumn {
  21. float : left;
  22. width : 245px;
  23. height : 440px;
  24. background-color : #000000;
  25. }
  26.  
  27. #exRightColumn {
  28. float : right;
  29. width : 725px;
  30. height : 440px;
  31. background : url('images/sypialnia_sciany.png') center top no-repeat #000000;
  32. position : relative;
  33. margin : 0;
  34. }
  35.  
  36. .exClear {
  37. clear : both;
  38. line-height : 0;
  39. }
  40.  
  41. </style>
  42. </head>
  43. <body>
  44. <div id="exCenter">
  45. <div id="exHeader">
  46. <br />
  47. <a href="index.html"><img style="width: 150px; height: 30px;" alt="" src="images/home.jpg" onmouseover="this.src = 'images/home_ne.jpg'" onmouseout="this.src = 'images/home.jpg'" /></a>
  48. <a href="edom.php"><img style="width: 150px; height:30px;" alt="" src="images/edom.jpg" onmouseover="this.src = 'images/edom_ne.jpg'" onmouseout="this.src = 'images/edom.jpg'" /></a>
  49. <a href="forums.html"><img style="width: 150px; height:30px;" alt="" src="images/temperatura.jpg" onmouseover="this.src = 'images/temperatura_ne.jpg'" onmouseout="this.src = 'images/temperatura.jpg'" /></a>
  50. <a href="energia.php"><img style="width: 150px; height:30px;" alt="" src="images/energia.jpg" onmouseover="this.src = 'images/energia_ne.jpg'" onmouseout="this.src = 'images/energia.jpg'" /></a>
  51. <a href="woda.php"><img style="width: 150px; height:30px;" alt="" src="images/woda.jpg" onmouseover="this.src = 'images/woda_ne.jpg'" onmouseout="this.src = 'images/woda.jpg'" /></a>
  52. <a href="webcam.php"><img style="width: 150px; height:30px;" alt="" src="images/webcam.jpg" onmouseover="this.src = 'images/webcam_ne.jpg'" onmouseout="this.src = 'images/webcam.jpg'" /></a>
  53. <br />
  54. <br />
  55. <a href="salon.php"><img style="width: 150px; height: 30px;" alt="" src="images/salon.jpg" onmouseover="this.src = 'images/salon_ne.jpg'" onmouseout="this.src = 'images/salon.jpg'" /></a>
  56. <a href="sypialnia_media.php"><img style="width:150px; height: 30px;" alt="" src="images/sypialnia.jpg" onmouseover="this.src = 'images/sypialnia_ne.jpg'"onmouseout="this.src = 'images/sypialnia.jpg'" /></a>
  57. <a href="boys.php"><img style="width: 150px; height: 30px;" alt="" src="images/boys.jpg" onmouseover="this.src = 'images/boys_ne.jpg'" onmouseout="this.src = 'images/boys.jpg'" /></a>
  58. <a href="kuchnia.php"><img style="width: 150px; height: 30px;" alt="" src="images/kuchnia.jpg" onmouseover="this.src = 'images/kuchnia_ne.jpg'" onmouseout="this.src = 'images/kuchnia.jpg'" /></a>
  59. <a href="hol.php"><img style="width: 150px; height: 30px;" alt="" src="images/hol.jpg" onmouseover="this.src = 'images/hol_ne.jpg'" onmouseout="this.src = 'images/hol.jpg'" /></a>
  60. <a href="lazienka.php"><img style="width: 150px; height: 30px;" alt="" src="images/lazienka.jpg" onmouseover="this.src = 'images/lazienka_ne.jpg'" onmouseout="this.src = 'images/lazienka.jpg'" /></a>
  61. <br />
  62. <br />
  63. </center>
  64. </div>
  65. <div id="exContent">
  66. <div id="exLeftColumn">
  67. <br />
  68. <br />
  69. <a href="sypialnia_media.php"><img style="width: 150px; height: 30px;" alt="" src="images/media.jpg" onmouseover="this.src= 'images/media_ne.jpg'" onmouseout="this.src = 'images/media.jpg'" /></a>
  70. <br />
  71. <br />
  72. <br />
  73. <a href="sypialnia_swiatlo.php"><img style="width: 150px; height: 30px;" alt="" src="images/swiatlo.jpg" onmouseover="this.src= 'images/swiatlo_ne.jpg'" onmouseout="this.src = 'images/swiatlo.jpg'" /></a>
  74. <br />
  75. <br />
  76. <br />
  77. <a href="sypialnia_gniazdka.php"><img style="width: 150px; height: 30px;" alt="" src="images/gniazdka.jpg" onmouseover="this.src = 'images/gniazdka_ne.jpg'" onmouseout="this.src = 'images/gniazdka.jpg'" /></a>
  78. <br />
  79. <br />
  80. <br />
  81. <a herf="sypialnia_okna.php"><img style="width: 150px; height: 30px;" alt="" src="images/okna.jpg" onmouseover="this.src = 'images/okna_ne.jpg'" onmouseout="this.src = 'images/okna.jpg'" /></a>
  82. </center>
  83. </div>
  84. <div id="exRightColumn"></div>
  85. <div class="exClear"></div>
  86. </div>
  87. </div>
  88. </body>
  89. </html>

Z góry dziękuję za pomoc.

Już sobie poradziłem wink.gif