Esempio n. 1
0
<?php

require_once "functions2.php";
$rating = "";
//kas kustutame, ?delete = vastav id mida kustutada on aadressireal
if (isset($_GET["delete"])) {
    echo "Kustutame id" . $_GET["delete"];
    //käivitan funktsiooni, saadan kaasa id
    deleteReview($_GET["delete"]);
}
//salvestan andmebaasi
if (isset($_POST["save"])) {
    updateReview($_POST["id"], $_POST["algus"], $_POST["ots"], $_POST["aeg"], $_POST["autonr"], $_POST["juht"]);
}
$keyword = "";
//aadressireal on keyword
if (isset($_GET["keyword"])) {
    //otsin
    $keyword = $_GET["keyword"];
    $review_array = getReviewData($keyword);
} else {
    //küsin kõik andmed
    //käivitan funktsiooni
    $review_array = getReviewData();
}
?>
<html>
<link rel="stylesheet" type="text/css" href="kujundus.css">
<body>
<h2>Veod</h2>
Esempio n. 2
0
<?php

require_once "edit_functionsk.php";
$rating = "";
$comment = "";
$comment_error = "";
if (isset($_POST["update_review"])) {
    //vajuta Salvesta nuppu
    //numberplate ja color tulevad vormist, aga id aadressirealt
    //aga id varjatud väljast
    updateReview($_POST["id"], $_POST["medicine"], $_POST["rating"], $_POST["comment"]);
}
//aadressireal on=edit_id siis trükin välja selle väärtuse
if (isset($_GET["edit_id"])) {
    echo $_GET["edit_id"];
    //id oli aadressireal
    //tahaks ühte rida kõige uuemaid andmeid, kus id on $_GET["edit_id"]
    $review = getEditData($_GET["edit_id"]);
    var_dump($review);
} else {
    //ei olnud aadressireal
    echo "VIGA";
    header("Location:tablek.php");
}
?>

<h2>Muuda ravimi hinnagut</h2>
<form action="<?php 
echo htmlspecialchars($_SERVER["PHP_SELF"]);
?>
" method="post">
Esempio n. 3
0
<?php

require_once "edit_functions.php";
$grade = "";
$mistakes = "";
$mistakes_error = "";
if (isset($_POST["update_review"])) {
    updateReview($_POST["id"], $_POST["exam"], $_POST["grade"], $_POST["mistakes"]);
}
if (isset($_GET["edit_id"])) {
    echo $_GET["edit_id"];
    $review = getEditData($_GET["edit_id"]);
    var_dump($review);
} else {
    echo "edit_id is not set";
    header("Location:data.php");
}
Esempio n. 4
0
}
if (isset($_GET["logout"])) {
    //aadressireal on olemas muutuja logout
    //kustutame kõik session muutujad ja peatame sessiooni
    session_destroy();
    header("Location: page/login.php");
}
// kas kustutame
// ?delete=vastav id mida kustutada on aadressi real
if (isset($_GET["delete"])) {
    echo "Kustutame id " . $_GET["delete"];
    //käivitan funktsiooni, saadan kaasa id!
    deleteReview($_GET["delete"]);
}
if (isset($_POST["save"])) {
    updateReview($_POST["id"], $_POST["location"], $_POST["date"], $_POST["feedback"], $_POST["grade"]);
}
$keyword = "";
// adressireal on keyword
if (isset($_GET["keyword"])) {
    //otsin
    $keyword = $_GET["keyword"];
    $array_of_reviews = getReviewData($keyword);
} else {
    //küsin kõik andmed
    //käivitan funktsiooni
    $array_of_reviews = getReviewData();
}
?>
<body style="background-color:#0074D9">
<h2 style=color:#F8F8FF>Arvustused</h2>
Esempio n. 5
0
<?php

require_once "edit_functions.php";
$rating = "";
$comment = "";
$comment_error = "";
if (isset($_POST["update_review"])) {
    updateReview($_POST["id"], $_POST["picture"], $_POST["rating"], $_POST["comment"]);
}
if (isset($_GET["edit_id"])) {
    echo $_GET["edit_id"];
    $review = getEditData($_GET["edit_id"]);
    var_dump($review);
} else {
    //ei olnud aadressireal
    echo "VIGA";
    header("Location:table.php");
}
?>

<h2>Muuda pildi arvustust</h2>
<form action="<?php 
echo htmlspecialchars($_SERVER["PHP_SELF"]);
?>
" method="post">
		<input type="hidden" name="id" value="<?php 
echo $_GET["edit_id"];
?>
">
		<label for ="picture">Pildi nimi</label><br>
		<input id="picture" name="picture" type="text" value="<?php 
Esempio n. 6
0
<?php

require_once "edit_functions.php";
$rating = "";
$comment = "";
$comment_error = "";
if (isset($_POST["update_review"])) {
    updateReview($_POST["id"], $_POST["footballer"], $_POST["rating"], $_POST["comment"]);
}
if (isset($_GET["edit_id"])) {
    echo $_GET["edit_id"];
    $review = getEditData($_GET["edit_id"]);
    var_dump($review);
} else {
    echo "VIGA";
    header("Location:table.php");
}
?>

<h2>Muuda jalgpallyri hinnangut</h2>
<form action="<?php 
echo htmlspecialchars($_SERVER["PHP_SELF"]);
?>
" method="post">
		<input type="hidden" name="id" value="<?php 
echo $_GET["edit_id"];
?>
">
		<label for ="footballer">Pildi nimi</label><br>
		<input id="footballer" name="footballer" type="text" value="<?php 
echo $review->footballer;
Esempio n. 7
0
<?php

require_once "MySQL.inc.php";
db_connect();
function updateReview()
{
    global $intReviewId, $strWhichRating;
    if ($intReviewId == "" || $strWhichRating == "") {
        return 0;
    }
    dbn("UPDATE locationreview SET " . $strWhichRating . " = " . $strWhichRating . " + 1 WHERE ReviewId = '" . $intReviewId . "'");
    return 1;
}
header('');
$intReviewId = isset($_REQUEST['ri']) ? db_escape($_REQUEST['ri']) : "";
$strWhichRating = isset($_REQUEST['rr']) ? db_escape($_REQUEST['rr']) : "";
$action = db_escape($_REQUEST['a']);
switch ($action) {
    case "updateReview":
        $update = updateReview();
        $outputArray = array("status" => true, "result" => $update);
        echo json_encode($outputArray);
        break;
    default:
        $outputArray = array("status" => false, "result" => -999);
        echo json_encode($outputArray);
        break;
}
Esempio n. 8
0
<?php

//error_reporting(0);
//Configure DATABASE
require_once 'blip_4815162342_108.php';
$conn = db_connect();
//Start Script
//Input variables from Angular
$review = json_decode(file_get_contents("php://input"));
$locationID = (int) $review->locID;
$userID = (int) $review->userID;
$title = $review->title;
$text = $review->text;
$rating = decbin($review->rating);
$update = updateReview($locationID, $userID, $title, $text, $rating);
function updateReview($locationID, $userID, $title, $text, $rating)
{
    global $conn;
    $updateQuery = mysqli_query($conn, "CALL UpdateReview('{$locationID}', '{$userID}', '{$title}', '{$text}', {$rating})") or die("Query fail: " . mysqli_error($conn));
}
mysqli_close($conn);