<?php /** * Created by Yogesh on 11/22/2015. * */ require_once "../model/MetaController.php"; if ($_SERVER['REQUEST_METHOD'] == "post" || $_SERVER['REQUEST_METHOD'] == "POST") { if (array_key_exists("v", $_POST)) { $version = decodeInput($_POST['v']); $metaController = new MetaController(); $dataList = $metaController->getRecentMapMeta($version); if ($dataList) { print_r(json_encode($dataList)); exit; } else { echo "no updates"; exit; } } else { echo "error"; exit; } } else { echo "error"; exit; } function decodeInput($data) { $data = trim($data); $data = stripslashes($data);
<?php include "../header.php"; require_once "../model/objects/Contribution.php"; require_once "../model/ContributionController.php"; $contributionController = new ContributionController(); $searchKey = ""; if (array_key_exists("search", $_REQUEST)) { $searchKey = decodeInput($_REQUEST['search']); } $status = ""; if (array_key_exists("mark", $_REQUEST)) { $status = decodeInput($_REQUEST['mark']); } ?> <!-- Content Wrapper. Contains page content --> <div class="content-wrapper"> <!-- Content Header (Page header) --> <section class="content-header"> <h1> Contributions </h1> </section> <?php if ($searchKey != "") { $dataList = $contributionController->search($searchKey, $offset, $rowsPerPage); } else { if ($status == "") { $dataList = $contributionController->getAll($offset, $rowsPerPage); } else { $dataList = $contributionController->getByStatus($status, $offset, $rowsPerPage);
$poi = new POI(); /* these request data eed to be properly verified before we process with any data*/ $p = decodeInput($_REQUEST['p']); $pSplit = explode("_", $p); if (count($pSplit) != 2) { redirectIndex(); } else { $prefix = strtolower($pSplit[0]); $postfix = $pSplit[1]; if ($prefix == "u" || $prefix == "p") { if ($prefix == "u") { if (array_key_exists('n', $_GET)) { $name = decodeInput($_REQUEST['n']); //it is a user created location $lat = decodeInput($_REQUEST['lat']); $long = decodeInput($_REQUEST['long']); if (!is_numeric($lat) || !is_numeric($long)) { redirectIndex(); } else { $location = $lat . "," . $long; $category = new Category(); $category->setSubCategory("custom"); $poi->init($name, "Nepal", $location, $category, "NA", "NA", "NA", "", new User()); } } else { redirectIndex(); } } else { if ($prefix == "p") { if (is_numeric($postfix)) { $poiController = new PoiController();
include_once "../model/PoiController.php"; include_once "../model/ContributionController.php"; include_once "../model/UsersController.php"; $userId = $_SESSION['userId']; if ($_SERVER['REQUEST_METHOD'] == 'POST' || $_SERVER['REQUEST_METHOD'] == 'post') { /* get all the post data from */ $poiName = decodeInput($_POST['poiName']); $poiAddress = decodeInput($_POST['poiAddress']); $poiCategory = decodeInput($_POST['poiCategory']); $poiPhone = decodeInput($_POST['poiPhone']); $poiEmail = decodeInput($_POST['poiEmail']); $poiWebsite = decodeInput($_POST['poiWebsite']); $poiLatitude = decodeInput($_POST['poiLat']); $poiLongitude = decodeInput($_POST['poiLong']); $poiPosition = $poiLatitude . "," . $poiLongitude; $poiContribution = decodeInput($_POST['poiContribution']); $userController = new UsersController(); $poiController = new PoiController(); $categoryController = new CategoryController(); $contributionController = new ContributionController(); /* since we are letting the validation of the data on the client side, we will skip the validation here and just go on with insertion */ /* so first create the poi object, also the required objects to initialize the poi */ $poi = new POI(); $poi->init($poiName, $poiAddress, $poiPosition, $categoryController->find($poiCategory), $poiPhone, $poiEmail, $poiWebsite, "", $userController->find($user->getId())); if ($poiContribution != 0) { if (is_numeric($poiContribution)) { if ($contribution = $contributionController->find($poiContribution)) { $poi->setContribution($contribution); } }
* * If any of these requirements is missing or if any data is not a valid one * Error will re returned by the file */ require_once "../model/ContributionController.php"; require_once "../model/objects/Contribution.php"; if ($_SERVER['REQUEST_METHOD'] == "post" || $_SERVER['REQUEST_METHOD'] == "POST") { if (array_key_exists('name', $_REQUEST) && array_key_exists('email', $_REQUEST) && array_key_exists('pn', $_REQUEST) && array_key_exists('pa', $_REQUEST) && array_key_exists('pc', $_REQUEST) && array_key_exists('pm', $_REQUEST) && array_key_exists('pr', $_REQUEST)) { //only if all data is available $name = decodeInput($_REQUEST['name']); $email = decodeInput($_REQUEST['email']); $poiName = decodeInput($_REQUEST['pn']); $poiAddress = decodeInput($_REQUEST['pa']); $poiMessage = decodeInput($_REQUEST['pm']); $poiCategory = decodeInput($_REQUEST['pc']); $poiRequest = decodeInput($_REQUEST['pr']); $contributionController = new ContributionController(); $contribution = new Contribution(); $contribution->init($name, $email, $poiName, $poiAddress, $poiCategory, $poiMessage, $poiRequest); if ($contributionController->add($contribution)) { sendThankyouMail($contribution); echo "success"; exit; } else { echo "error cannot add"; exit; } } else { echo "error post keys missing"; exit; }
<?php include "../header.php"; require_once "../model/FeedbackController.php"; require_once "../model/objects/Feedback.php"; $feedbackController = new FeedbackController(); $searchKey = ""; if (array_key_exists("search", $_REQUEST)) { $searchKey = decodeInput($_REQUEST['search']); } ?> <!-- Content Wrapper. Contains page content --> <div class="content-wrapper"> <!-- Content Header (Page header) --> <section class="content-header"> <h1> Feedbacks </h1> </section> <?php if ($searchKey != "") { $dataList = $feedbackController->search($searchKey, $offset, $rowsPerPage); } else { $dataList = $feedbackController->getAll($offset, $rowsPerPage); } if ($dataList) { ?> <!-- Main content --> <section class="content"> <div class="row"> <div class="col-xs-12">
require_once "../model/UsersController.php"; if (isset($_COOKIE['userId']) || isset($_SESSION['userId'])) { Route::getBackend("dashboard.php"); exit; } function decodeInput($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } $error = false; if ($_SERVER['REQUEST_METHOD'] == 'POST' || $_SERVER['REQUEST_METHOD'] == 'post') { $username = decodeInput($_POST['username']); $password = decodeInput($_POST['password']); /* we assume that that the data has been verified from the from and the special characters */ $userController = new UsersController(); if ($user = $userController->getUser($username, $password)) { /* user login successful */ /* check if remember flag is on */ $_SESSION['userId'] = $user->getId(); if (array_key_exists('remember_check', $_POST)) { if ($_POST['remember_check'] == "on") { setcookie("userId", $user->getId(), time() + 86400 * 30, "/"); } } //update the users status to active $user->setStatus(1); $userController->update($user); /* finally */
* If any of these requirements is missing or if any data is not a valid one * Error will re returned by the file */ require_once "../model/FeedbackController.php"; require_once "../model/objects/Feedback.php"; if ($_SERVER['REQUEST_METHOD'] == "post" || $_SERVER['REQUEST_METHOD'] == "POST") { if (array_key_exists("name", $_POST) && array_key_exists("email", $_POST) && array_key_exists("title", $_POST) && array_key_exists("message", $_POST) && array_key_exists("rate", $_POST) && array_key_exists("du", $_POST) && array_key_exists("dn", $_POST) && array_key_exists("dv", $_POST)) { //only if all data is available $name = decodeInput($_REQUEST['name']); $email = decodeInput($_REQUEST['email']); $subject = decodeInput($_REQUEST['title']); $message = decodeInput($_REQUEST['message']); $rating = decodeInput($_REQUEST['rate']); $deviceUser = decodeInput($_REQUEST['du']); $deviceName = decodeInput($_REQUEST['dn']); $deviceVersion = decodeInput($_REQUEST['dv']); $feedbackController = new FeedbackController(); $feedback = new Feedback(); $feedback->init($name, $email, $subject, $message, $rating, $deviceUser, $deviceName, $deviceVersion); if ($feedbackController->add($feedback)) { sendThankyouMail($name, $email, $subject); echo "success"; exit; } else { echo "error"; exit; } } else { echo "error"; exit; }