c3lf-system-3/ajax.php

34 lines
966 B
PHP
Raw Normal View History

2018-12-28 19:05:34 +00:00
<?php
/**
* Created by PhpStorm.
* User: jedi
* Date: 12/28/18
* Time: 6:13 PM
2018-12-29 19:17:54 +00:00
*/
include "backend.php";
function hasval($var){
return isset($var) && !empty($var);
}
switch($_GET["action"]) {
case "add_featurerequest":
if (hasval($_POST["title"]) && hasval($_POST["desc"])) {
/* Prepared statement, stage 1: prepare */
if (!($stmt = $mysqli->prepare("INSERT INTO feature_request(title, desc) 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;
}
echo json_encode(array("get"=>$_GET,"post"=>$_POST));
?>