stash
This commit is contained in:
parent
943d209fd3
commit
acec8b1120
6 changed files with 75 additions and 23 deletions
27
ajax.php
27
ajax.php
|
@ -5,3 +5,30 @@
|
||||||
* Date: 12/28/18
|
* Date: 12/28/18
|
||||||
* Time: 6:13 PM
|
* Time: 6:13 PM
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
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));
|
||||||
|
|
||||||
|
?>
|
|
@ -76,6 +76,7 @@ function get_stats(){
|
||||||
if ($row = $res->fetch_assoc()) {
|
if ($row = $res->fetch_assoc()) {
|
||||||
$ret["match"] = $row["c"];
|
$ret["match"] = $row["c"];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,12 +26,12 @@
|
||||||
Insert Item into DB
|
Insert Item into DB
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<form method="POST" action="action.php?action=lost">
|
<form id="lost_form" method="POST" action="action.php?action=lost">
|
||||||
<p><input type="text" class="form-control" placeholder="WANN" name="wann" value="<?php echo date("Y-m-d H:i:s");?>"></p>
|
<p><input type="text" class="form-control" placeholder="WANN" name="wann" value="<?php echo date("Y-m-d H:i:s");?>"></p>
|
||||||
<p><input type="text" class="form-control" placeholder="WO" name="wo"></p>
|
<p><input type="text" class="form-control" placeholder="WO" name="wo"></p>
|
||||||
<p><input type="text" class="form-control" placeholder="WAS" name="was"></p>
|
<p><input type="text" class="form-control" placeholder="WAS" name="was"></p>
|
||||||
<p><input type="text" class="form-control" placeholder="KONTAKT" name="contact" autocomplete="off"></p>
|
<p><input type="text" class="form-control" placeholder="KONTAKT" name="contact" autocomplete="off"></p>
|
||||||
<p><input type="submit" class="form-control"></p>
|
<p><button type="submit" class="form-control" onclick="testajax(); return false;">Submit</button></p>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-footer small text-muted">Updated yesterday at 11:59 PM</div>
|
<div class="card-footer small text-muted">Updated yesterday at 11:59 PM</div>
|
||||||
|
@ -40,7 +40,20 @@
|
||||||
</div>
|
</div>
|
||||||
<!-- /.container-fluid -->
|
<!-- /.container-fluid -->
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
function testajax(){
|
||||||
|
$.post( "ajax.php?action=add_lost", $( "#lost_form" ).serialize() ).done(function( data ) {
|
||||||
|
alert( "Data Loaded: " + data );
|
||||||
|
});
|
||||||
|
|
||||||
|
/*$.post( "ajax.php", { name: "John", time: "2pm" } ).done(function( data ) {
|
||||||
|
alert( "Data Loaded: " + data );
|
||||||
|
});*/
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<!-- Bootstrap core JavaScript-->
|
<!-- Bootstrap core JavaScript-->
|
||||||
|
|
|
@ -44,23 +44,23 @@
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<!-- Navbar Search -->
|
<!-- Navbar Search -->
|
||||||
<!--form class="d-none d-md-inline-block form-inline ml-auto mr-0 mr-md-3 my-2 my-md-0">
|
<form class="d-none d-md-inline-block form-inline ml-auto mr-0 mr-md-3 my-2 my-md-0">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input type="text" class="form-control" placeholder="Search for..." aria-label="Search" aria-describedby="basic-addon2">
|
<input type="text" class="form-control" placeholder="Search for..." aria-label="Search" aria-describedby="basic-addon2" disabled>
|
||||||
<div class="input-group-append">
|
<div class="input-group-append">
|
||||||
<button class="btn btn-primary" type="button">
|
<button class="btn btn-primary" type="button" disabled>
|
||||||
<i class="fas fa-search"></i>
|
<i class="fas fa-search"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form-->
|
</form>
|
||||||
|
|
||||||
<!-- Navbar -->
|
<!-- Navbar -->
|
||||||
<ul class="navbar-nav ml-auto ml-md-0">
|
<ul class="navbar-nav ml-auto ml-md-0">
|
||||||
<li class="nav-item dropdown no-arrow mx-1">
|
<li class="nav-item dropdown no-arrow mx-1">
|
||||||
<a class="nav-link dropdown-toggle" href="#" id="alertsDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
<a class="nav-link dropdown-toggle" href="#" id="alertsDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||||
<i class="fas fa-bell fa-fw"></i>
|
<i class="fas fa-bell fa-fw"></i>
|
||||||
<span class="badge badge-danger">9+</span>
|
<!--span class="badge badge-danger">9+</span-->
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="alertsDropdown">
|
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="alertsDropdown">
|
||||||
<a class="dropdown-item" href="#">Action</a>
|
<a class="dropdown-item" href="#">Action</a>
|
||||||
|
@ -72,7 +72,7 @@
|
||||||
<li class="nav-item dropdown no-arrow mx-1">
|
<li class="nav-item dropdown no-arrow mx-1">
|
||||||
<a class="nav-link dropdown-toggle" href="#" id="messagesDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
<a class="nav-link dropdown-toggle" href="#" id="messagesDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||||
<i class="fas fa-envelope fa-fw"></i>
|
<i class="fas fa-envelope fa-fw"></i>
|
||||||
<span class="badge badge-danger">7</span>
|
<!--span class="badge badge-danger">7</span-->
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="messagesDropdown">
|
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="messagesDropdown">
|
||||||
<a class="dropdown-item" href="#">Action</a>
|
<a class="dropdown-item" href="#">Action</a>
|
||||||
|
|
|
@ -6,8 +6,6 @@
|
||||||
* Time: 4:46 AM
|
* Time: 4:46 AM
|
||||||
*/
|
*/
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
|
|
||||||
<!-- Breadcrumbs-->
|
<!-- Breadcrumbs-->
|
||||||
|
@ -15,26 +13,35 @@
|
||||||
<li class="breadcrumb-item">
|
<li class="breadcrumb-item">
|
||||||
<a href="#">Dashboard</a>
|
<a href="#">Dashboard</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="breadcrumb-item">Lost</li>
|
<li class="breadcrumb-item active">Feature Request</li>
|
||||||
<li class="breadcrumb-item active">Add</li>
|
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
|
<div class="alert alert-danger" role="alert">
|
||||||
|
This is a danger alert—check it out!
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Area Chart Example-->
|
<!-- Area Chart Example-->
|
||||||
<div class="card mb-3">
|
<div class="card mb-3">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<i class="fas fa-plus"></i>
|
<i class="fas fa-plus"></i>
|
||||||
Insert Item into DB
|
Add Feature Request
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<form id="lost_form" method="POST" action="action.php?action=lost">
|
<form id="lost_form" method="POST" action="action.php?action=lost">
|
||||||
<p><input type="text" class="form-control" placeholder="WANN" name="wann" value="<?php echo date("Y-m-d H:i:s");?>"></p>
|
<div class="form-group">
|
||||||
<p><input type="text" class="form-control" placeholder="WO" name="wo"></p>
|
<label for="title_field">Title</label>
|
||||||
<p><input type="text" class="form-control" placeholder="WAS" name="was"></p>
|
<input type="text" class="form-control" placeholder="title" name="title" id="title_field">
|
||||||
<p><input type="text" class="form-control" placeholder="KONTAKT" name="contact" autocomplete="off"></p>
|
</div>
|
||||||
<p><button type="submit" class="form-control" onclick="testajax(); return false;">Submit</button></p>
|
<div class="form-group">
|
||||||
|
<label for="desc_field">Description</label>
|
||||||
|
<textarea class="form-control" id="desc_field" name="desc" rows="5"></textarea>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<button type="submit" class="form-control btn btn-primary" placeholder="description" onclick="testajax(); return false;">Submit</button>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-footer small text-muted">Updated yesterday at 11:59 PM</div>
|
<!--div class="card-footer small text-muted">Updated yesterday at 11:59 PM</div-->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -45,7 +52,11 @@
|
||||||
function testajax(){
|
function testajax(){
|
||||||
$.post( "ajax.php?action=add_lost", $( "#lost_form" ).serialize() ).done(function( data ) {
|
$.post( "ajax.php?action=add_lost", $( "#lost_form" ).serialize() ).done(function( data ) {
|
||||||
alert( "Data Loaded: " + data );
|
alert( "Data Loaded: " + data );
|
||||||
});
|
}).fail(function() {
|
||||||
|
alert( "error" );
|
||||||
|
}).always(function() {
|
||||||
|
alert( "finished" );
|
||||||
|
});;
|
||||||
|
|
||||||
/*$.post( "ajax.php", { name: "John", time: "2pm" } ).done(function( data ) {
|
/*$.post( "ajax.php", { name: "John", time: "2pm" } ).done(function( data ) {
|
||||||
alert( "Data Loaded: " + data );
|
alert( "Data Loaded: " + data );
|
||||||
|
|
|
@ -82,10 +82,10 @@
|
||||||
<i class="fas fa-fw fa-table"></i>
|
<i class="fas fa-fw fa-table"></i>
|
||||||
<span>Tables</span></a>
|
<span>Tables</span></a>
|
||||||
</li-->
|
</li-->
|
||||||
<!--li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="/?page=request">
|
<a class="nav-link" href="/?page=request">
|
||||||
<i class="fas fa-fw fa-comments"></i>
|
<i class="fas fa-fw fa-comments"></i>
|
||||||
<span>Feature Requests</span>
|
<span>Feature Requests</span>
|
||||||
</a>
|
</a>
|
||||||
</li-->
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
Loading…
Reference in a new issue