Advertisement
Guest User

Untitled

a guest
Sep 19th, 2016
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.56 KB | None | 0 0
  1. <?php
  2. $host = "xxx";
  3. $username = "xxx";
  4. $password = "xxx";
  5. $database = "xxx";
  6.  
  7. $connection = mysqli_connect($host, $username,
  8. $password, $database) or die("response[0]");
  9.  
  10. // Query the database to get latest weather report
  11. $reportQuery = "SELECT * FROM stationdata ORDER BY reportid DESC LIMIT 1";
  12. $executeReport = mysqli_query($connection, $reportQuery);
  13.  
  14. $reportArray = mysqli_fetch_array($executeReport);
  15. ?>
  16.  
  17. <html>
  18. <head>
  19. <title>Remote Latest Data Warwick</title>
  20.  
  21. <style>
  22. * {
  23. font-family: "Segoe UI", "-apple-system", "Helvetica Neue";
  24. }
  25.  
  26. .headerContainer {
  27. width: 100%;
  28. height: 88;
  29. top: 0;
  30. position: fixed;
  31. background: black;
  32. }
  33. .headerRight {
  34. width: 560;
  35. height: 78;
  36. float: right;
  37. }
  38.  
  39. .textMo {
  40. margin-top: 16;
  41. margin-left: 25;
  42. float: left;
  43. font-size: 38;
  44. color: white;
  45. }
  46. .textRld {
  47. margin-top: 8;
  48. margin-right: 15;
  49. float: right;
  50. font-size: 40;
  51. color: white;
  52. }
  53. .textLoc {
  54. margin-right: 70;
  55. float: right;
  56. font-size: 13;
  57. color: white;
  58. }
  59.  
  60. .greenBar {
  61. width: 100%;
  62. height: 7;
  63. top: 78;
  64. position: fixed;
  65. background: #cbff31;
  66. }
  67.  
  68.  
  69. .mainContainer {
  70. max-width: 1216;
  71. margin: 0 auto;
  72. margin-top: 100;
  73. margin-bottom: 80;
  74. position: center;
  75. padding-right: 10;
  76. padding-left: 10;
  77. }
  78.  
  79. .groupTitle {
  80. margin-bottom: 0;
  81. font-size: 30;
  82. line-height: 1;
  83. }
  84. .dataTable {
  85. width: 100%;
  86. margin-top: 12;
  87. }
  88. .fieldTitle {
  89. max-width: 1070;
  90. margin-bottom: 10;
  91. margin-left: 30;
  92. color: grey;
  93. }
  94. .titleWidth {
  95. width: 90%;
  96. }
  97. .fieldValue {
  98. width: 100;
  99. margin-bottom: 10;
  100. }
  101.  
  102.  
  103. .footerContainer {
  104. width: 100%;
  105. height: 39;
  106. margin-bottom: 0 auto;
  107. bottom: 0;
  108. position: fixed;
  109. background: black;
  110. }
  111. .footerFieldContainer {
  112. max-width: 1216;
  113. height: 39;
  114. margin: 0 auto;
  115. padding-top: 2;
  116. padding-right: 10;
  117. padding-left: 10;
  118. position: center;
  119. }
  120.  
  121. .footerFieldLabel {
  122. margin-top: 0;
  123. padding-top: 7;
  124. margin-right: 10;
  125. float: left;
  126. color: #cbff31;
  127. font-size: 15;
  128. box-sizing: border-box;
  129. }
  130. .footerFieldBorder {
  131. width: 91;
  132. height: 31;
  133. margin-top: 2;
  134. padding-top: 2;
  135. float: left;
  136. background: black;
  137. color: black;
  138. border: 2 solid #575757;
  139. border-radius: 5;
  140. box-sizing: border-box;
  141. }
  142. .footerFieldText {
  143. width: 100%;
  144. float: right;
  145. color: white;
  146. text-align: center;
  147. font-size: 19;
  148. }
  149. </style>
  150.  
  151. <script>
  152. function onLoad() {
  153. startTime();
  154. }
  155.  
  156. function checkTime(i) {
  157. if (i < 10) {
  158. i = "0" + i;
  159. }
  160. return i;
  161. }
  162. function startTime() {
  163. var today = new Date();
  164.  
  165. var dd = checkTime(today.getDate());
  166. var yyyy = today.getFullYear();
  167.  
  168. var monthNames = ["Jan", "Feb", "Mar", "Apr", "May",
  169. "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
  170. var MM = monthNames[today.getMonth()];
  171.  
  172. var hh = today.getHours();
  173. var mm = checkTime(today.getMinutes());
  174. var ss = checkTime(today.getSeconds());
  175.  
  176. var formatted = dd + " of " + MM + " " + yyyy + " at " + hh + ":" + mm + ":" + ss;
  177.  
  178. document.getElementById('currentTime').innerHTML = formatted;
  179. timer = setTimeout(function () { startTime() }, 500);
  180. }
  181. </script>
  182. </head>
  183.  
  184. <body onload="onLoad()" style="margin: 0">
  185.  
  186. <!-- MAIN: Page header -->
  187. <div class="headerContainer">
  188. <p class="textMo">Weather Station</p>
  189.  
  190. <div class="headerRight">
  191. <b class="textRld">Remote Latest Data Warwick</b>
  192. <i class="textLoc">Latitude: xx.x, Longitude xx.x</i>
  193. </div>
  194.  
  195. <div class="greenBar"/>
  196. </div>
  197.  
  198.  
  199. <!-- MAIN: Data fields -->
  200. <div class="mainContainer">
  201.  
  202. <div>
  203. View Graphs of Data
  204. </div>
  205.  
  206. <!-- GROUP: Ambient Temperature -->
  207. <div style="margin-bottom: -15">
  208. <p class="groupTitle">Ambient Temperature</p>
  209. <hr style="border-color: black"/>
  210.  
  211. <table class="dataTable">
  212. <tr>
  213. <td class="titleWidth">
  214. <p class="fieldTitle">Dry Thermometer:</p>
  215. </td>
  216. <td>
  217. <p class="fieldValue">
  218. <?php
  219. echo number_format((float)$reportArray[2], 1, '.', '') . "°C";
  220. ?>
  221. </p>
  222. </td>
  223. </tr>
  224.  
  225. <tr>
  226. <td class="titleWidth">
  227. <p class="fieldTitle">Thermometer Exposed to the Elements:</p>
  228. </td>
  229. <td>
  230. <p class="fieldValue">
  231. <?php
  232. echo number_format((float)$reportArray[3], 1, '.', '') . "°C";
  233. ?>
  234. </p>
  235. </td>
  236. </tr>
  237.  
  238. <tr>
  239. <td class="titleWidth">
  240. <p class="fieldTitle">Wet Thermometer:</p>
  241. </td>
  242. <td>
  243. <p class="fieldValue">no sensor</p>
  244. </td>
  245. </tr>
  246.  
  247. </table>
  248. </div>
  249.  
  250. <!-- GROUP: Soil Temperature -->
  251. <div style="margin-bottom: -15">
  252. <p class="groupTitle">Soil Temperature</p>
  253. <hr style="border-color: black"/>
  254.  
  255. <table class="dataTable">
  256. <tr>
  257. <td class="titleWidth">
  258. <p class="fieldTitle">10 Centimetre Soil:</p>
  259. </td>
  260. <td>
  261. <p class="fieldValue">
  262. <?php
  263. echo number_format((float)$reportArray[4], 1, '.', '') . "°C";
  264. ?>
  265. </p>
  266. </td>
  267. </tr>
  268.  
  269. <tr>
  270. <td class="titleWidth">
  271. <p class="fieldTitle">30 Centimetre Soil:</p>
  272. </td>
  273. <td>
  274. <p class="fieldValue">
  275. <?php
  276. echo number_format((float)$reportArray[5], 1, '.', '') . "°C";
  277. ?>
  278. </p>
  279. </td>
  280. </tr>
  281.  
  282. <tr>
  283. <td class="titleWidth">
  284. <p class="fieldTitle">1 Metre Soil:</p>
  285. </td>
  286. <td>
  287. <p class="fieldValue">
  288. <?php
  289. echo number_format((float)$reportArray[6], 1, '.', '') . "°C";
  290. ?>
  291. </p>
  292. </td>
  293. </tr>
  294.  
  295. </table>
  296. </div>
  297.  
  298. <!-- GROUP: Surface Temperatures -->
  299. <div style="margin-bottom: -15">
  300. <p class="groupTitle">Surface Temperatures</p>
  301. <hr style="border-color: black"/>
  302.  
  303. <table class="dataTable">
  304. <tr>
  305. <td class="titleWidth">
  306. <p class="fieldTitle">Grass:</p>
  307. </td>
  308. <td>
  309. <p class="fieldValue">no sensor</p>
  310. </td>
  311. </tr>
  312.  
  313. <tr>
  314. <td class="titleWidth">
  315. <p class="fieldTitle">Concrete:</p>
  316. </td>
  317. <td>
  318. <p class="fieldValue">no sensor</p>
  319. </td>
  320. </tr>
  321.  
  322. </table>
  323. </div>
  324.  
  325. <!-- GROUP: Temperature Extremes -->
  326. <div style="margin-bottom: -15">
  327. <p class="groupTitle">Temperature Extremes</p>
  328. <hr style="border-color: black"/>
  329.  
  330. <table class="dataTable">
  331. <tr>
  332. <td class="titleWidth">
  333. <p class="fieldTitle">24Hr Minimum:</p>
  334. </td>
  335. <td>
  336. <p class="fieldValue">no sensor</p>
  337. </td>
  338. </tr>
  339.  
  340. <tr>
  341. <td class="titleWidth">
  342. <p class="fieldTitle">At Time:</p>
  343. </td>
  344. <td>
  345. <p class="fieldValue">no sensor</p>
  346. </td>
  347. </tr>
  348.  
  349. <tr>
  350. <td class="titleWidth">
  351. <p class="fieldTitle">24Hr Maximum:</p>
  352. </td>
  353. <td>
  354. <p class="fieldValue">no sensor</p>
  355. </td>
  356. </tr>
  357.  
  358. <tr>
  359. <td class="titleWidth">
  360. <p class="fieldTitle">At Time:</p>
  361. </td>
  362. <td>
  363. <p class="fieldValue">no sensor</p>
  364. </td>
  365. </tr>
  366.  
  367. </table>
  368. </div>
  369.  
  370. <!-- GROUP: Moisture -->
  371. <div style="margin-bottom: -15">
  372. <p class="groupTitle">Moisture</p>
  373. <hr style="border-color: black"/>
  374.  
  375. <table class="dataTable">
  376. <tr>
  377. <td class="titleWidth">
  378. <p class="fieldTitle">Dew Point:</p>
  379. </td>
  380. <td>
  381. <p class="fieldValue">no sensor</p>
  382. </td>
  383. </tr>
  384.  
  385. <tr>
  386. <td class="titleWidth">
  387. <p class="fieldTitle">Relative Humidity Sensor:</p>
  388. </td>
  389. <td>
  390. <p class="fieldValue">no sensor</p>
  391. </td>
  392. </tr>
  393.  
  394. <tr>
  395. <td class="titleWidth">
  396. <p class="fieldTitle">Calculated Relative Humidity:</p>
  397. </td>
  398. <td>
  399. <p class="fieldValue">no sensor</p>
  400. </td>
  401. </tr>
  402.  
  403. <tr>
  404. <td class="titleWidth">
  405. <p class="fieldTitle">Dew Point Derived From:</p>
  406. </td>
  407. <td>
  408. <p class="fieldValue">no sensor</p>
  409. </td>
  410. </tr>
  411.  
  412. </table>
  413. </div>
  414.  
  415. <!-- GROUP: Two Minute Wind -->
  416. <div style="margin-bottom: -15">
  417. <p class="groupTitle">Two Minute Wind</p>
  418. <hr style="border-color: black"/>
  419.  
  420. <table class="dataTable">
  421. <tr>
  422. <td class="titleWidth">
  423. <p class="fieldTitle">Speed:</p>
  424. </td>
  425. <td>
  426. <p class="fieldValue">no sensor</p>
  427. </td>
  428. </tr>
  429.  
  430. <tr>
  431. <td class="titleWidth">
  432. <p class="fieldTitle">Direction:</p>
  433. </td>
  434. <td>
  435. <p class="fieldValue">no sensor</p>
  436. </td>
  437. </tr>
  438.  
  439. </table>
  440. </div>
  441.  
  442. <!-- GROUP: Ten Minute Wind -->
  443. <div style="margin-bottom: -15">
  444. <p class="groupTitle">Ten Minute Wind</p>
  445. <hr style="border-color: black"/>
  446.  
  447. <table class="dataTable">
  448. <tr>
  449. <td class="titleWidth">
  450. <p class="fieldTitle">Speed:</p>
  451. </td>
  452. <td>
  453. <p class="fieldValue">no sensor</p>
  454. </td>
  455. </tr>
  456.  
  457. <tr>
  458. <td class="titleWidth">
  459. <p class="fieldTitle">Direction:</p>
  460. </td>
  461. <td>
  462. <p class="fieldValue">no sensor</p>
  463. </td>
  464. </tr>
  465.  
  466. <tr>
  467. <td class="titleWidth">
  468. <p class="fieldTitle">Gust:</p>
  469. </td>
  470. <td>
  471. <p class="fieldValue">no sensor</p>
  472. </td>
  473. </tr>
  474.  
  475. </table>
  476. </div>
  477.  
  478. <!-- GROUP: Pressure -->
  479. <div style="margin-bottom: -15">
  480. <p class="groupTitle">Pressure</p>
  481. <hr style="border-color: black"/>
  482.  
  483. <table class="dataTable">
  484. <tr>
  485. <td class="titleWidth">
  486. <p class="fieldTitle">As Read:</p>
  487. </td>
  488. <td>
  489. <p class="fieldValue">no sensor</p>
  490. </td>
  491. </tr>
  492.  
  493. </table>
  494. </div>
  495.  
  496. <!-- GROUP: Derived Pressures -->
  497. <div style="margin-bottom: -15">
  498. <p class="groupTitle">Derived Pressures</p>
  499. <hr style="border-color: black"/>
  500.  
  501. <table class="dataTable">
  502. <tr>
  503. <td class="titleWidth">
  504. <p class="fieldTitle">QFF:</p>
  505. </td>
  506. <td>
  507. <p class="fieldValue">no sensor</p>
  508. </td>
  509. </tr>
  510.  
  511. <tr>
  512. <td class="titleWidth">
  513. <p class="fieldTitle">QFE:</p>
  514. </td>
  515. <td>
  516. <p class="fieldValue">no sensor</p>
  517. </td>
  518. </tr>
  519.  
  520. <tr>
  521. <td class="titleWidth">
  522. <p class="fieldTitle">QNH:</p>
  523. </td>
  524. <td>
  525. <p class="fieldValue">no sensor</p>
  526. </td>
  527. </tr>
  528.  
  529. <tr>
  530. <td class="titleWidth">
  531. <p class="fieldTitle">QFE Inches Hg:</p>
  532. </td>
  533. <td>
  534. <p class="fieldValue">no sensor</p>
  535. </td>
  536. </tr>
  537.  
  538. <tr>
  539. <td class="titleWidth">
  540. <p class="fieldTitle">QNH Inches Hg:</p>
  541. </td>
  542. <td>
  543. <p class="fieldValue">no sensor</p>
  544. </td>
  545. </tr>
  546.  
  547. </table>
  548. </div>
  549.  
  550. <!-- GROUP: Rainfall -->
  551. <div style="margin-bottom: -15">
  552. <p class="groupTitle">Rainfall</p>
  553. <hr style="border-color: black"/>
  554.  
  555. <table class="dataTable">
  556. <tr>
  557. <td class="titleWidth">
  558. <p class="fieldTitle">Total This Hour:</p>
  559. </td>
  560. <td>
  561. <p class="fieldValue">no sensor</p>
  562. </td>
  563. </tr>
  564.  
  565. <tr>
  566. <td class="titleWidth">
  567. <p class="fieldTitle">Current Rate:</p>
  568. </td>
  569. <td>
  570. <p class="fieldValue">no sensor</p>
  571. </td>
  572. </tr>
  573.  
  574. <tr>
  575. <td class="titleWidth">
  576. <p class="fieldTitle">Total Since 08:40:</p>
  577. </td>
  578. <td>
  579. <p class="fieldValue">no sensor</p>
  580. </td>
  581. </tr>
  582.  
  583. </table>
  584. </div>
  585.  
  586. <!-- GROUP: Visibility -->
  587. <div style="margin-bottom: -15">
  588. <p class="groupTitle">Visibility</p>
  589. <hr style="border-color: black"/>
  590.  
  591. <table class="dataTable">
  592. <tr>
  593. <td class="titleWidth">
  594. <p class="fieldTitle">Horizontal:</p>
  595. </td>
  596. <td>
  597. <p class="fieldValue">no sensor</p>
  598. </td>
  599. </tr>
  600.  
  601. </table>
  602. </div>
  603.  
  604. <!-- GROUP: Radiation -->
  605. <div style="margin-bottom: -15">
  606. <p class="groupTitle">Radiation</p>
  607. <hr style="border-color: black"/>
  608.  
  609. <table class="dataTable">
  610. <tr>
  611. <td class="titleWidth">
  612. <p class="fieldTitle">Sunshine Hours:</p>
  613. </td>
  614. <td>
  615. <p class="fieldValue">no sensor</p>
  616. </td>
  617. </tr>
  618.  
  619. <tr>
  620. <td class="titleWidth">
  621. <p class="fieldTitle">S/W Radiation Hours:</p>
  622. </td>
  623. <td>
  624. <p class="fieldValue">no sensor</p>
  625. </td>
  626. </tr>
  627.  
  628. </table>
  629. </div>
  630.  
  631. <!-- GROUP: Present Weather -->
  632. <div style="margin-bottom: -15">
  633. <p class="groupTitle">Present Weather</p>
  634. <hr style="border-color: black"/>
  635.  
  636. <table class="dataTable">
  637. <tr>
  638. <td class="titleWidth">
  639. <p class="fieldTitle">Wx(4680) Auto Present:</p>
  640. </td>
  641. <td>
  642. <p class="fieldValue">no sensor</p>
  643. </td>
  644. </tr>
  645.  
  646. <tr>
  647. <td class="titleWidth">
  648. <p class="fieldTitle">Auto Snow Depth:</p>
  649. </td>
  650. <td>
  651. <p class="fieldValue">no sensor</p>
  652. </td>
  653. </tr>
  654.  
  655. </table>
  656. </div>
  657. </div>
  658.  
  659.  
  660. <!-- MAIN: Page footer -->
  661. <div class="footerContainer">
  662. <div class="footerFieldContainer">
  663.  
  664. <p class="footerFieldLabel">Current Time:</p>
  665. <div class="footerFieldBorder" style="width: 273">
  666. <b class="footerFieldText" id="currentTime">16 of Sep 2016 at 12:02:35</b>
  667. </div>
  668.  
  669. <p class="footerFieldLabel" style="margin-left: 15">Time of Data:</p>
  670. <div class="footerFieldBorder" style="width: 70">
  671. <b class="footerFieldText">
  672. <?php
  673. $date = date("H:i", strtotime($reportArray[1]));
  674. echo $date;
  675. ?>
  676. </b>
  677. </div>
  678.  
  679.  
  680. <div style="float: right">
  681. <p class="footerFieldLabel">Approximate Number of Seconds to Update:</p>
  682.  
  683. <div class="footerFieldBorder" style="width: 40">
  684. <b class="footerFieldText">59</b>
  685. </div>
  686. </div>
  687.  
  688. </div>
  689. </div>
  690.  
  691. </body>
  692. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement