Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5afd32963f | ||
|
|
121f3ef09f | ||
| 0d26090074 | |||
|
|
6b627b634d | ||
|
|
f0dde45d36 | ||
|
|
35a819611c |
@@ -86,7 +86,8 @@
|
||||
<!-- Prepended text-->
|
||||
|
||||
<div class='control-group'>
|
||||
<label class="col-md-8 control-label" >System ID <span style="color:red">*</span></label>
|
||||
<label class="col-md-8 control-label" ><a title='Het system id staat op het witte label op de PC' data-toggle='tooltip'>System ID <span class='icons icon-question-mark-circle'></span></a> <span style="color:red">*</span></label>
|
||||
|
||||
<div class='controls'>
|
||||
<div class='input-prepend dropdown' id="sysType" name="sysType" data-select='true'>
|
||||
<!-- there must not be a space between the prepend toggle and the input field -->
|
||||
@@ -117,7 +118,7 @@
|
||||
|
||||
<!-- Select Basic -->
|
||||
<div class="form-group">
|
||||
<label class="col-md-8 control-label" ><a title='Het system id staat op het witte label op de PC' data-toggle='tooltip'>System ID <span class='icons icon-question-mark-circle'></span></a> <span style="color:red">*</span></label>
|
||||
<label class="col-md-8 control-label" >Locatie <span style="color:red">*</span></label>
|
||||
<div class="col-md-8">
|
||||
<select id="location" name="location" class="form-control">
|
||||
<option value="Arnhem">Arnhem</option>
|
||||
|
||||
@@ -118,3 +118,47 @@ a#nav-sysinfo-tab{
|
||||
.button1 {
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
.meta {
|
||||
padding: 0px;
|
||||
}
|
||||
th.meta {
|
||||
padding-left: 0px;
|
||||
}
|
||||
.form-group>label {
|
||||
color: black;
|
||||
}
|
||||
.split {
|
||||
padding: 25px 16px;
|
||||
}
|
||||
.line.split {
|
||||
padding: 0px;
|
||||
border: 0px;
|
||||
border-bottom: 1px;
|
||||
border-bottom-color: #949494;
|
||||
border-style: solid;
|
||||
}
|
||||
|
||||
.form-inline {
|
||||
display: flex;
|
||||
flex-flow: row wrap;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.form-inline label {
|
||||
margin: 5px 10px 5px 0;
|
||||
}
|
||||
|
||||
.form-inline input {
|
||||
vertical-align: middle;
|
||||
margin: 0px 10px 0px 0;
|
||||
background-color: #fff;
|
||||
border: 1px solid #ddd;
|
||||
}
|
||||
|
||||
@media (max-width: 800px) {
|
||||
|
||||
.form-inline {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
<?php
|
||||
/* Database credentials. Assuming you are running MySQL
|
||||
server with default setting (user 'root' with no password) */
|
||||
define('DB_SERVER', 'localhost');
|
||||
define('DB_USERNAME', 'devbprieshof_sysd');
|
||||
define('DB_PASSWORD', 'o1X4FzEuGV');
|
||||
define('DB_NAME', 'devbprieshof_sysd');
|
||||
|
||||
/* Attempt to connect to MySQL database */
|
||||
$link = mysqli_connect(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME);
|
||||
|
||||
// Check connection
|
||||
if($link === false){
|
||||
die("ERROR: Could not connect. " . mysqli_connect_error());
|
||||
}
|
||||
?>
|
||||
@@ -77,8 +77,6 @@ if(isset($_POST["id"]) && !empty($_POST["id"])){
|
||||
mysqli_stmt_close($stmt);
|
||||
}
|
||||
|
||||
// Close connection
|
||||
mysqli_close($link);
|
||||
} else{
|
||||
// Check existence of id parameter before processing further
|
||||
if(isset($_GET["id"]) && !empty(trim($_GET["id"]))){
|
||||
@@ -109,6 +107,7 @@ if(isset($_POST["id"]) && !empty($_POST["id"])){
|
||||
$Winkey = $row["WinKey"];
|
||||
$EthMac = $row["EthMac"];
|
||||
$id = $row['id'];
|
||||
$string = $row["sysMeta"];
|
||||
} else{
|
||||
// URL doesn't contain valid id. Redirect to error page
|
||||
header("location: error.php");
|
||||
@@ -119,18 +118,62 @@ if(isset($_POST["id"]) && !empty($_POST["id"])){
|
||||
echo "Oops! Something went wrong. Please try again later.";
|
||||
}
|
||||
}
|
||||
|
||||
// Close statement
|
||||
mysqli_stmt_close($stmt);
|
||||
|
||||
// Close connection
|
||||
mysqli_close($link);
|
||||
} else{
|
||||
// URL doesn't contain id parameter. Redirect to error page
|
||||
header("location: error.php");
|
||||
exit();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// System meta Functions
|
||||
function updateDB() {
|
||||
global $link, $string, $id, $row;
|
||||
$sql1 = "UPDATE systems SET sysMeta=? WHERE id=?";
|
||||
if($stmt1 = mysqli_prepare($link, $sql1)){
|
||||
// Bind variables to the prepared statement as parameters
|
||||
mysqli_stmt_bind_param($stmt1, "si", $param_string, $param_id);
|
||||
|
||||
// Set parameters
|
||||
$param_string = $string;
|
||||
$param_id = $id;
|
||||
|
||||
// Attempt to execute the prepared statement
|
||||
if(mysqli_stmt_execute($stmt1)){
|
||||
// Records updated successfully. Redirect to landing page
|
||||
} else{
|
||||
echo "Something went wrong. Please try again later.";
|
||||
}
|
||||
}
|
||||
|
||||
// Close statement
|
||||
mysqli_stmt_close($stmt1);
|
||||
header("location: ?id=$id");
|
||||
}
|
||||
|
||||
//Adding entry to sting
|
||||
if(isset($_POST['typedata']))
|
||||
{
|
||||
$string = $string."\n".$_POST['typedata']."*".$_POST['metadata'];
|
||||
updateDB();
|
||||
}
|
||||
|
||||
if(isset($_GET['deldata']))
|
||||
{
|
||||
$string = str_replace("\n".$_GET['deldata'], '', $string);
|
||||
//Removing string witout "\n" incase there is one entry
|
||||
$string = str_replace($_GET['deldata'], '', $string);
|
||||
updateDB();
|
||||
}
|
||||
|
||||
// Close connection
|
||||
mysqli_close($link);
|
||||
|
||||
$trimmedString = trim($string);
|
||||
$lines = explode("\n", $trimmedString);
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
@@ -179,22 +222,9 @@ if(isset($_POST["id"]) && !empty($_POST["id"])){
|
||||
<script type="text/javascript" src="../assets/node_modules/popper.js/dist/umd/popper.min.js"></script>
|
||||
<!-- Bootstrap -->
|
||||
<script type="text/javascript" src="../assets/node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
|
||||
|
||||
|
||||
|
||||
<!-- Data tables -->
|
||||
<script type="text/javascript" src="../assets/node_modules/datatables.net/js/jquery.dataTables.js"></script>
|
||||
<script type="text/javascript" src="../assets/node_modules/datatables-responsive/js/dataTables.responsive.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Bootstrap Select -->
|
||||
<script src="../assets/js/bootstrap-select.js" type="text/javascript"></script>
|
||||
<!-- Fuse Html -->
|
||||
@@ -304,6 +334,7 @@ if(isset($_POST["id"]) && !empty($_POST["id"])){
|
||||
<h2 class="pull-right">system ID: <?php echo $sysID; ?></h2>
|
||||
</div>
|
||||
<div class="form-wrapper md-elevation-8 p-4">
|
||||
<h3>System Information</h3>
|
||||
<form action="<?php echo htmlspecialchars(basename($_SERVER['REQUEST_URI'])); ?>" method="post">
|
||||
<div class="form-group col-md-4 col-md-4 <?php echo (!empty($sysID_err)) ? 'has-error' : ''; ?>">
|
||||
<label>sysID</label>
|
||||
@@ -327,12 +358,48 @@ if(isset($_POST["id"]) && !empty($_POST["id"])){
|
||||
</div>
|
||||
<div class="form-group col-md-4 <?php echo (!empty($Winkey_err)) ? 'has-error' : ''; ?>">
|
||||
<label>Windows Key</label>
|
||||
<input type="text" name="Win_Key" class="form-control" value="<?php echo $Win_Key; ?>">
|
||||
<input type="text" name="Win_Key" class="form-control" value="<?php echo $Winkey; ?>">
|
||||
<span class="help-block"><?php echo $Winkey_err;?></span>
|
||||
</div>
|
||||
<input type="hidden" name="id" value="<?php echo $id; ?>"/>
|
||||
<input type="submit" class="btn btn-secondary" value="Submit">
|
||||
</form>
|
||||
<div class="split"><div class="line split"></div></div>
|
||||
<div class="col-md12">
|
||||
<h3>System Meta</h3>
|
||||
<br>
|
||||
<form class="form-inline" method="post">
|
||||
<label for="meta">Meta Tag:</label>
|
||||
<input id="meta" type="text" name="typedata">
|
||||
<label for="value">Value:</label>
|
||||
<input id="value" type="text" name="metadata"><br>
|
||||
<input type="submit" class="btn btn-secondary" name="submit" value="ADD">
|
||||
</form>
|
||||
<br>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Meta Tag</th>
|
||||
<th>Value</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<?php
|
||||
foreach($lines as $line) {
|
||||
echo "<tr>";
|
||||
$elements = explode("*", $line);
|
||||
foreach($elements as $element) {
|
||||
echo "<td>" . $element . "</td>";
|
||||
}
|
||||
echo "<td><a class='crud' href='?id=". $row["id"] ."&deldata=". $line ."' title='Delete' data-toggle='tooltip'><span class='icons icon-trash'></span></a></td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
|
||||
?>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- / CONTENT -->
|
||||
|
||||
@@ -344,5 +411,4 @@ if(isset($_POST["id"]) && !empty($_POST["id"])){
|
||||
</div>
|
||||
</main>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
@@ -44,7 +44,9 @@ if(isset($_GET["sysID"]) && !empty(trim($_GET["sysID"]))){
|
||||
|
||||
// Close statement
|
||||
mysqli_stmt_close($stmt);
|
||||
|
||||
$string = $row["sysMeta"];
|
||||
$trimmedString = trim($string);
|
||||
$lines = explode("\n", $trimmedString);
|
||||
// Close connection
|
||||
} else{
|
||||
// URL doesn't contain id parameter. Redirect to error page
|
||||
@@ -263,6 +265,27 @@ if(isset($_GET["sysID"]) && !empty(trim($_GET["sysID"]))){
|
||||
<p class="form-control-static">
|
||||
<?php echo $row["WinKey"]; ?></p>
|
||||
</div>
|
||||
<div class="meta col-md-4 viewer form-group">
|
||||
<table class="table">
|
||||
<tr>
|
||||
<thead>
|
||||
<th class="meta">Meta Tag</th>
|
||||
<th class="meta">Value</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<?php
|
||||
foreach($lines as $line) {
|
||||
echo "<tr>";
|
||||
$elements = explode("*", $line);
|
||||
foreach($elements as $element) {
|
||||
echo "<td>" . $element . "</td>";
|
||||
}
|
||||
echo "</tr>";
|
||||
}
|
||||
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="nav-tickets" role="tabpanel" aria-labelledby="nav-tickets-tab">
|
||||
|
||||
@@ -394,8 +417,6 @@ if(isset($_GET["sysID"]) && !empty(trim($_GET["sysID"]))){
|
||||
</div>
|
||||
</div>
|
||||
<!-- / CONTENT -->
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -403,5 +424,4 @@ if(isset($_GET["sysID"]) && !empty(trim($_GET["sysID"]))){
|
||||
</div>
|
||||
</main>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user