示例#1
0
    } else {
        $condition = test_input($_POST["condition"]);
    }
    if (empty($_POST["description"])) {
        $description_error = "see väli on kohustulik";
    } else {
        $description = test_input($_POST["description"]);
    }
    if (empty($_POST["date_visited"])) {
        $date_visited_error = "see väli on kohustulik";
    } else {
        $date_visited = test_input($_POST["date_visited"]);
    }
    if ($location_error = "" && ($color_error = "" && ($description_error = "" && ($date_visited_error = "")))) {
    }
    $message = addPlace($location, $condition, $description, $date_visited);
    if ($message != "") {
        $location = "";
        $condition = "";
        $description = "";
        $date_visited = "";
        echo $message;
    }
}
function test_input($data)
{
    //võtab ära tühikud,enterid jne
    $data = trim($data);
    //võtab ära tagurpidi kaldkriipsud
    $data = stripslashes($data);
    //teeb html-i tekstiks
示例#2
0
     //addUser("gfhgf", "hccgf", "sf", "sads");
     $dateTimeStamp = $_REQUEST['date'] . " " . $_REQUEST['time'] . ":00";
     $seats = $_REQUEST['seats'];
     $notes = $_REQUEST['notes'];
     //Getting Source Geo-Encoding
     $fullSrcAdd = $_REQUEST['fullSrcAdd'];
     $srcLng = $_REQUEST['srcLng'];
     $srcLat = $_REQUEST['srcLat'];
     //Geo-Encoding Destination
     $fullDestAdd = $_REQUEST['fullDestAdd'];
     $srcImgURL = getRandomImageURL();
     $destImgURL = getRandomImageURL();
     $destLng = $_REQUEST['destLng'];
     $destLat = $_REQUEST['destLat'];
     $srcID = addPlace($fullSrcAdd, $srcLat, $srcLng);
     $dstnID = addPlace($fullDestAdd, $destLat, $destLng);
     $added = addTripDetails($dateTimeStamp, $srcID, $dstnID, $seats, $_COOKIE['userID'], $notes);
     setImageURL($srcID, $srcImgURL);
     setImageURL($dstnID, $destImgURL);
     $added = $added ? 'true' : 'false';
     echo $added;
     break;
 case 'get_trip_dateTime':
     $tripID = $_REQUEST['trip_id'];
     $result = getTripDetails($tripID);
     echo $result['TripTimeStamp'];
     break;
 case 'get_trip_source':
     $tripID = $_REQUEST['trip_id'];
     $result = getTripDetails($tripID);
     $placeID = $result['SourceID'];