//tahaks uhte rida koige uuemaid andmeid kus id on $_GET["edit.php"] $Note1 = getEditData($_GET["edit_id"]); var_dump($Note1); } else { //ei olnud adressireal echo "Viga"; //die - edasi lehte ei laeta //die(); //suuname kasutaja table.php lehele header("Location: table.php"); } if (isset($_POST["update_note"])) { //vajutas salvesta nuppu //number_plate ja color tulevad vormist //aga id aadresirealt updateNote($_POST["id"], $_POST["title"], $_POST["note"]); } ?> <h2>Muuda märkuse</h2> <form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?> " method="post" > <input type="hidden" name="id" value="<?$_GET["edit_id"];?>"> <label for="title" >Pealkiri</label><br> <input id="title" name="title" type="text" value="<?php echo $Note1->title; ?> "><br><br> <label for="note">Märkus</label><br>
if (isset($_POST["notesRequest_Type"])) { if ($_POST["notesRequest_Type"] == "page") { if (ctype_digit($_POST["notesRequest_LastGroupNo"]) && ctype_digit($_POST["noteRequest_Page"])) { getNotesPage($conn, $_POST["notesRequest_LastGroupNo"], $_POST["noteRequest_Page"]); } } else { if ($_POST["notesRequest_Type"] == "remove") { if (ctype_digit($_POST["noteNo"])) { removeNote($conn, $_POST["noteNo"]); } } else { if ($_POST["notesRequest_Type"] == "elementno") { if (ctype_digit($_POST["notesRequest_Elements"])) { getNotesElementNo($conn, $_POST["notesRequest_Elements"]); } } else { if ($_POST["notesRequest_Type"] == "checkupdate") { checkUpdates($conn, $_POST["notesRequest_CheckNotes"]); } else { if ($_POST["notesRequest_Type"] == "add") { insertNote($conn); } else { if ($_POST["notesRequest_Type"] == "update") { updateNote($conn); } } } } } } }
} function cleanInput($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } if (isset($_GET["delete"])) { deleteNote($_GET["delete"]); } if (isset($_GET["addnew"])) { createNote($_SESSION["logged_in_user_username"], $_GET["title"], $_GET["text"]); } if (isset($_GET["update"])) { updateNote($_GET["id"], $_SESSION["logged_in_user_username"], $_GET["title"], $_GET["text"]); } // muutujad väärtuste jaoks $title = ""; $text = ""; $title_error = ""; $text_error = ""; if (isset($_GET["title"])) { if (empty($_GET["title"])) { $title_error = "See väli on kohustuslik!"; } else { $title = cleanInput($_GET["title"]); } if (empty($_GET["text"])) { $text_error = "See väli on kohustuslik!"; } else {
// used to endorse or promote products derived from this software without // specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED // WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO // EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. require "_database.php"; require "_functions.php"; $id = validateUserCookie(); $client = $_GET['client']; $version = $_GET['version']; $content = file_get_contents('php://input'); $rslt = updateNote($id, $client, $version, $content); if ($rslt['conflict']) { $version = $conflict['version']; $existing = $conflict['content']; } else { $version = $rslt['version']; } if (!$rslt['conflict']) { print "{$version}"; } else { print "{$version}\n{$existing}"; }
<?php include_once "globals.php"; if (!$in) { die("<meta http-equiv=Refresh content='1; url=everlogin.php?username={$username}&title={$title}'>"); } if (isset($_POST["update"])) { $enotes = $_POST["edata"]; $title = $_POST["title"]; updateNote($title, $enotes); } else { if (!isset($_GET["target"])) { if (isset($_POST["title"])) { $_SESSION["title"] = $title; } if (!isset($_GET["title"])) { $title = $_SESSION["title"]; } else { $title = $_GET["title"]; } } $enotes = getNote($title); } ?> <html> <head> <title>Simple Evernote - evernote for dummies</title> </head> <body> <div style="width: 100%; height: 95%"> <form style = "display: inline" method='post' action="evernote.php?title=<?php
case "protectView": $password = $app['request']->get('password'); protectView($url, $password, $pdo); return true; case "protectEdit": $password = $app['request']->get('password'); protectEdit($url, $password, $pdo); return true; case "changeUrl": $new_url = $app['request']->get('new_url'); changeUrl($url, $new_url, $pdo); return true; case "save": if (!isEditProtected($url, $pdo)) { $content = $app['request']->get('content'); updateNote($url, $content, $pdo); return True; } else { if (isset($app['session']) and $app['session']->get('id') == $url and $app['session']->get('edit')) { $content = $app['request']->get('content'); updateNote($url, $content, $pdo); return True; } else { return False; // sinon on arrete } } default: $app->abort(403, "wallah le problème"); } });
require("_database.php"); require("_functions.php"); $id = $_GET['id']; $version = $_GET['version']; $content = file_get_contents('php://input'); $success = false; if (!$id) { $rslt = insertNote($content); $id = $rslt['id']; $version = $rslt['version']; $success = true; } else { $conflict = updateNote($id, $version, $content); if ($conflict) { $version = $conflict; } else { $version += 1; } } setNoteID($id); if (!$conflict) { print "OK\n$id\n$version"; } else { print "CONFLICT\n$id\n$version"; }