TAG 0
This commit is contained in:
parent
3ef6faaf8f
commit
0fbd3f2279
18 changed files with 1104 additions and 241 deletions
49
action.php
Normal file
49
action.php
Normal file
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: jedi
|
||||
* Date: 12/27/18
|
||||
* Time: 6:52 AM
|
||||
*/
|
||||
|
||||
include "backend.php";
|
||||
|
||||
function hasval($var){
|
||||
return isset($var) && !empty($var);
|
||||
}
|
||||
|
||||
switch($_GET["action"]) {
|
||||
case "insert":
|
||||
if (hasval($_POST["was"]) && hasval($_POST["wann"]) && hasval($_POST["wo"])) {
|
||||
/* Prepared statement, stage 1: prepare */
|
||||
if (!($stmt = $mysqli->prepare("INSERT INTO items(was, wann, wo) VALUES (?, ?, ?)"))) {
|
||||
echo "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error;
|
||||
}
|
||||
if (!$stmt->bind_param("sss", $_POST["was"], $_POST["wann"], $_POST["wo"])) {
|
||||
echo "Binding parameters failed: (" . $stmt->errno . ") " . $stmt->error;
|
||||
}
|
||||
if (!$stmt->execute()) {
|
||||
echo "Execute failed: (" . $stmt->errno . ") " . $stmt->error;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case "lost":
|
||||
if (hasval($_POST["was"]) && hasval($_POST["wann"]) && hasval($_POST["wo"]) && hasval($_POST["contact"])) {
|
||||
/* Prepared statement, stage 1: prepare */
|
||||
if (!($stmt = $mysqli->prepare("INSERT INTO lost(was, wann, wo, contact) VALUES (?, ?, ?, ?)"))) {
|
||||
echo "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error;
|
||||
}
|
||||
if (!$stmt->bind_param("ssss", $_POST["was"], $_POST["wann"], $_POST["wo"], $_POST["contact"])) {
|
||||
echo "Binding parameters failed: (" . $stmt->errno . ") " . $stmt->error;
|
||||
}
|
||||
if (!$stmt->execute()) {
|
||||
echo "Execute failed: (" . $stmt->errno . ") " . $stmt->error;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
header('Location: '.$_SERVER['HTTP_REFERER']);
|
||||
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue