<? include("../include.php"); $db = ConnectDb(); $PHP_SELF = "manage_sensors.php"; if ($HTTP_POST_VARS['submit'] == "Update Locations") { foreach($HTTP_POST_VARS as $key => $value) { if (preg_match ("/(^SensorLocation)([0-9]*)$/i", $key, $match)) { $result = pg_query("Select sensor_name from sensors where sensor_id = '$match[2]';"); $row = pg_fetch_array($result); pg_query("UPDATE sensors set location = $value where sensor_name = '".$row['sensor_name']."';"); } } header("Location: $PHP_SELF"); exit(0); } include("manage_header.php"); if ($HTTP_GET_VARS['del_sensor'] != "") { $result = pg_query("select * from sensors where sensor_name = '".$HTTP_GET_VARS['del_sensor']."';"); while ($r = @pg_fetch_array($result)) { echo("Please wait while deleting records from tables...<BR>\n"); $sql = "delete from bd_rx_log where sensor_id = ".$r['sensor_id'];
function AvgDay($day, $month) { ConnectDb(write, andrixTNG1wire); $query = "SELECT AVG(value) FROM 1wireEnergy where day='{$day}' AND month='{$month}'"; $result = mysql_query($query); $avgvalue = mysql_result($result, 0, "AVG(value)"); return $avgvalue; }
<?php session_start(); include "Includes/includes.php"; echo "<html>\n\n<head>\n\n\n<title>ANDRIX CENTER- Allt för hemmet</title>\n</head>\n\n<br><br><br><br><br>\n<body bgcolor=\"#CCFF99\">\n\n<div align=\"center\">\n\t<table border=\"0\" width=\"60%\">\n\t\t<tr>\n\t\t\t<td width=\"90%\"><font face=\"Arial Black\" style=\"font-size: 42pt\">ANDRIX \n\t\t\tCENTER</font><font size=\"7\" face=\"Arial Black\"> </font>\n\t\t\t<font face=\"Arial Black\" size=\"1\">THE NEXT GENERATION<br>\n\t\t\t</font>\n\t\t\t<font face=\"Arial Black\">Allt för det smarta hemmet...</font><BR>\n\t\t\t</td>\n\t\t</tr>\n\t</table>\n</div>\n<br><br><br>\n\n<div align=\"center\">\n\t<table border=\"0\" width=\"60%\">\n\t\t<tr>\n\t\t\t<td width=\"90%\">\n\t\t\t<form method=\"POST\" action=\"logincheck.php?status=login\">\n\t\t\t\t\n\t\t\t\t<p align=\"right\"><font face=\"Arial Black\" size=\"2\"> </font>\n\t\t\t\t<table border=\"0\" width=\"100%\">\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t<p align=\"right\"><font face=\"Arial Black\" size=\"2\">Användarnamn :</font></td>\n\t\t\t\t\t\t<td width=\"183\">\n\t\t\t\t\t\t\n\t\t\t\t\t\t<p align=\"center\"> <input type=\"text\" name=\"usern\" size=\"20\"></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t<p align=\"right\"><font face=\"Arial Black\" size=\"2\">Lösenord : </font> </td>\n\t\t\t\t\t\t<td width=\"183\">\n\t\t\t\t\t\t<p align=\"center\"> <input type=\"password\" name=\"passw\" size=\"20\"></td>"; $ip = GetIP(); ConnectDb(write, andrixTNG); $result = mysql_query("SELECT * FROM BlockIP where ip='{$ip}'"); if (mysql_num_rows($result) == 1) { echo "IP NUMMRET NI KOMMER FRÅN ÄR SPÄRRAT!!!"; } echo "</tr>\n\t\t\t\t</table><p align=\"right\"><br>\n\t\t\t\t<input type=\"submit\" value=\"Login\" name=\"Logga in\"></p>\n\t\t\t</form></td>\n\t\t</tr>\n\t</table>\n</div>\n<center><font face=\"Arial\" size=\"1\">...</font></center>\n</body>\n\n</html>";
<?php include "Includes/jpgraph/jpgraph.php"; include "Includes/jpgraph/jpgraph_line.php"; include "Includes/includes.php"; ConnectDb(write, andrixTNG1wire); $dag = date("d"); $manad = date("m"); $year = date("Y"); $timme = date("H"); $minut = date("i"); $nexttimme = $timme + 1; if ($nexttimme > 23) { $nexttimme = '00'; } $result7 = mysql_query("SELECT * FROM 1wireEnergy WHERE day='{$dag}' and hour='{$timme}' order by id ASC"); $result8 = mysql_query("SELECT AVG(value) FROM 1wireEnergy WHERE day='{$dag}' AND hour='{$timme}'"); $num7 = mysql_numrows($result7); $ydata = array(); $zdata = array(); $c = 0; while ($c < $num7) { $value = mysql_result($result7, $c, "value"); $avgvalue = mysql_result($result8, 0, "AVG(value)"); $ydata[$c] = $value; $zdata[$c] = $avgvalue; $c++; } $namn = "Energi förbrukning " . $year . "-" . $manad . "-" . $dag . " " . $timme . ":00"; $file = "/var/www/sys/Graphs/{$year}/{$manad}/{$dag}/{$timme}/energi_" . $year . "-" . $manad . "-" . $dag . "-" . $timme . ":00.png"; drawdiagram($ydata, $zdata, $namn, $file);
<?php require '../modules/db.php'; $sql = 'SELECT * FROM `hotels_source` WHERE `hotels_id` =' . $_GET['Hid']; $tik = mysqli_query(ConnectDb(), $sql); while ($row = $tik->fetch_assoc()) { $src_id = $row['source_id']; } var_dump($_SESSION); exit; ?> <div class="ht-ac-page-passengers ht-ac-page-box"> <h2 class="ht-ac-page-passengers-h2">Passengers List</h2> <table class="passenger-info-table"> <tbody><tr> <th></th> <th class="passenger-info-title">Title</th> <th>First Name</th> <th>Last Name</th> <th>Date Of Birth</th> <th>Options</th> </tr> <form> <tr> <td><?php echo 'room_name'; ?> </td> <td> <input type="hidden" name="room[]" value="1"> <input type="hidden" name="protector[]" value="1">
<?php require_once "database.php"; session_start(); function whoami() { //name is similar to unix command if (!isset($_SESSION['user'])) { return NULL; } else { return $_SESSION['user']; } } function ToDate($time) { return date('d/m/Y H:i;s', $time); } $USERNAME = whoami(); //$USERNAME = "******"; //hard login, temporary user, to be removed ConnectDb(); function GetId($username) { $query = "SELECT id FROM USERS WHERE username = '******'"; $result = query($query); $row = mysqli_fetch_array($result); return $row[0]; } $USERID = GetId($USERNAME);
<?php require_once 'lib/functions.php'; if (isset($_POST['user'])) { $user = $_POST['user']; } else { header("Location: login.html"); die('User fehlt!'); } if (isset($_POST['pw'])) { $password = $_POST['pw']; } else { header("Location: login.html"); die('Passwort fehlt!'); } $_SESSION['host'] = 'localhost'; $_SESSION['user'] = $user; $_SESSION['pw'] = $password; $_SESSION['loginTime'] = time(); $_SESSION['lastAction'] = time(); try { $connection = ConnectDb(); } catch (Exception $e) { header("Location: login.html"); } $_SESSION['auth'] = 'true'; if ($_POST['true'] != 'true') { header("Location: index.php"); }
function get_avail($country, $city, $category = '', $hotel = '', $type = '', $checkin, $checkout, $room, $adults) { $numDays = date_diff(date_create_from_format('Y/n/d', $checkout), date_create_from_format('Y/n/d', $checkin)); $numDays = $numDays->d; $numRooms = $room; $adls = array(); foreach ($adults as $ad) { array_push($adls, $ad); } $adlts = implode(',', $adls); $days = array(); for ($i = 0; $i < $numDays; $i++) { $d = date_create_from_format('Y/n/d', $checkin); date_add($d, DateInterval::createFromDateString($i . ' days')); array_push($days, $d->format('Y-n-d')); } $str_where = ' where en=1 and capa_adult in(' . $adlts . ') and '; $ck = 1; foreach ($days as $day) { if ($ck == 1) { $str_where .= "(SELECT `has_avail_ondate`(room_type_id,'{$day}') AS `has_avail_ondate{$ck}`)"; } else { $str_where .= " AND (SELECT `has_avail_ondate`(room_type_id,'{$day}') AS `has_avail_ondate{$ck}`)"; } $ck++; } $str = "select hotel_avail.price,hotel_avail.currency_id,hotels.star as `start`,hotel_avail.source_id,hotel_avail.id,hotel_avail.room_type_id,hotel_avail.avi_date,hotel_avail.price,hotels.en_name,hotels.star,hotels.id as hotelId ,hot_room_type.name as room_name,capa_adult,capa_child,capa_extra FROM `hotel_avail` " . " inner join `hotels` on hotels.id=hotel_avail.hotels_id " . " inner join `hot_room_type` on hotel_avail.room_type_id=hot_room_type.id " . $str_where; if ($hotel && !$type) { $str .= ' and hotels_id=' . $hotel; } if ($hotel && $type) { $str .= ' and room_type_id=' . $type; } if ($category) { //$str.=' and room_type_id='.$type; } //echo '<pre>'; //var_dump($str);exit; $result = mysqli_query(ConnectDb(), $str); //var_dump($result);exit; $temp = array(); $hotels = array(); while ($row = $result->fetch_assoc()) { // $room=array(); // $room['name']=$row[room_name]; // $room['id']=$row[room_type_id]; // $room['price']=$row[price]; // $room['star']=$row[star]; // $room['currency_id']=$row[currency_id]; // $hotels[$row[hotelId]]['rooms'][$row[room_type_id]][]=$room; // $hotels[$row[hotelId]]['en_name']=$row['en_name']; $rr = array(); $rr['hid'] = $row[hotelId]; array_push($temp, $row[hotelId]); $rr['tid'] = $row[room_type_id]; $rr['prc'] = $row[price]; $rr[currency_id] = $row[currency_id]; $hotels[] = $rr; } $strhtl = implode(',', $temp); $select = "select hotels.*,hot_room_type.id as `tid`,hot_room_type.name as `tname` from hotels " . " inner join `hot_room_type` on hotels.id=hot_room_type.hotels_id " . " where city_id={$city}"; //var_dump($select);exit; $result = mysqli_query(ConnectDb(), $select); $all_hotels = array(); while ($row = $result->fetch_assoc()) { $room = array(); $room['name'] = $row['tname']; $room['id'] = $row['tid']; $room['price'] = '---'; $room['avial'] = 0; $room['capa'] = $row['capa_adult']; foreach ($hotels as $htl) { if ($htl['hid'] == $row[id] && $htl['tid'] == $row['tid']) { $room['avial'] = 1; $room['price'] = $htl[prc]; $room['currency_id'] = $htl[currency_id]; break; } } $all_hotels[$row[id]]['star'] = $row[star]; $all_hotels[$row[id]]['rooms'][] = $room; $all_hotels[$row[id]]['en_name'] = $row['en_name']; $all_hotels[$row[id]]['id'] = $row['id']; } //echo '<pre>'; //print_r($all_hotels);exit; return $all_hotels; }