function CheckUpdateUser() { $UserValues = ['Username', 'Password', 'Name', 'Email', 'Phone', 'Role']; if (CheckList($UserValues)) { $usr = GetList($UserValues); UpdateUser($usr[0], $usr[1], $usr[2], $usr[3], $usr[4], $usr[5]); header('Location: Admin.php'); } }
function CheckLogin() { $loginValues = ['Username', 'Password']; if (!CheckList($loginValues)) { return; } $login = GetList($loginValues); return VerifyLogin($login[0], $login[1]); }
function CreateAccountValues() { $AccountValues = ['Username', 'Password', 'Name', 'Phone', 'Email']; if (!CheckList($AccountValues)) { return false; } $account_values = GetList($AccountValues); CreateAccount($account_values[0], $account_values[1], $account_values[2], $account_values[3], $account_values[4], $account_values[5]); return true; }
function SearchHouses() { global $conn; $searchvals = ['Search', 'Bedrooms', 'Toilets', 'Garages', 'MaxPrice']; if (CheckList($searchvals)) { $vals = GetList($searchvals); $query = $conn->prepare("Select * FROM Houses Where Address LIKE CONCAT('%',:address, '%') AND Beds >= :beds AND Toilets >= :toilets AND Garages >= :garages AND Price <= :price"); $query->bindValue(':address', $vals[0]); $query->bindValue(':beds', $vals[1]); $query->bindValue(':toilets', $vals[2]); $query->bindValue(':garages', $vals[3]); $query->bindValue(':price', $vals[4]); $query->execute(); $res = $query->fetchAll(); $houses = array(); foreach ($res as $house) { $houses[] = new House($house); } return $houses; } return NULL; }
<?php session_start(); include_once "Sql.php"; include_once "Accounts.php"; include_once "HousesSQL.php"; $bookingValues = ['DateString', 'HouseID']; if (!CheckList($bookingValues)) { return; } if (!empty($_SESSION['Username'])) { echo "did something"; $Values = GetList($bookingValues); BookOpenHouse($Values[0], $_SESSION['Username'], $Values[1]); } function ShowBookings($Username) { $bookings = GetBookings($Username); echo "<div class='HouseList'>"; foreach ($bookings as $booking) { $date = $booking["Time"]; echo "<h1> {$date} </h1>"; PrintHouseByID($booking["HouseID"]); } echo "</div>"; } function GetBookings($Username) { $select = "Select * from Bookings Where UserID = '{$Username}'"; return GetResult($select); }
} } $data['aaData'][] = $row; } } break; case 'add_prod': $user_id = $_COOKIE['USERID']; $object_id = $_REQUEST['obj_id']; $car_number = strtoupper($_REQUEST['car_number']); $prod_id = $_REQUEST['id']; $prod_quantity = $_REQUEST['quantity']; $price_type = $_REQUEST['price']; $price = GetProductPrice($prod_id); $list = json_decode(stripslashes($_REQUEST['list'])); $check = CheckList($list); $s_price = getProdSelfCost($prod_id); $status = CheckObjectStatus($object_id); if (!$status) { $trans_id = AddTransaction($user_id, $object_id); if (IsEmptyList($prod_id)) { // tu carieli masivia $rec_self_price = GetRecipieSelfCostEmptyList($prod_id); $rec_price = GetRecipieCostEmptyList($prod_id); $t_id = AddProdRecipie($user_id, GetTransactionId($object_id), $prod_id, $prod_quantity, $rec_self_price, $rec_price); //$tr_id = mysql_insert_id(); AddHiddenRecProducing($user_id, $t_id, $prod_id); } else { if (!$check) { //tu receptia $ingredient_exists = CheckIngredientsExists($list, $object_id, $prod_quantity);
if (CheckList($UserValues)) { $booking = GetList($UserValues); $enq = $booking[0]; DeleteEnquiry($enq); header("Location: index.php"); } } //Cancel Application (user) if ($Action == "CancelApp") { $UserValues = ['AppID']; if (CheckList($UserValues)) { $booking = GetList($UserValues); $app = $booking[0]; DeleteApplication($app); header("Location: Profile.php"); } } //Become property manager (Staff) if ($Action == "ManageProperty") { $UserValues = ['HouseID']; if (CheckList($UserValues)) { $booking = GetList($UserValues); $houseid = $booking[0]; if (CheckManager(Username(), $houseid)) { UnmanageProperty(Username(), $houseid); } else { ManageProperty(Username(), $houseid); } header("Location: HouseDisplay.php?HouseID={$houseid}"); } }