Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
57f4b48e2e
|
|||
|
a6059d5831
|
|||
|
0481dc380e
|
|||
|
|
506b49f11d | ||
|
|
3a767083df |
@@ -7,7 +7,7 @@ if(!isset($_SESSION["loggedin"]) || $_SESSION["loggedin"] !== true){
|
||||
exit;
|
||||
}
|
||||
require_once "../assets/php/config.php";
|
||||
if(isset( $_POST ['sysID'], $_POST ['ServiceTag'], $_POST ['location'], $_POST ['WinKey'], $_POST ['EthMac'])){
|
||||
if(isset( $_POST ['sysID'],$_POST['sysType'], $_POST ['ServiceTag'], $_POST ['location'], $_POST ['WinKey'], $_POST ['EthMac'])){
|
||||
// Escape user inputs for security
|
||||
$sysID = mysqli_real_escape_string($link, $_POST['sysTypeID'].$_POST['sysID']);
|
||||
$sysType = mysqli_real_escape_string($link, $_POST['sysType']);
|
||||
@@ -180,9 +180,8 @@ mysqli_close($link);
|
||||
</div>
|
||||
<div class="form-wrapper md-elevation-8 p-4">
|
||||
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" method="post">
|
||||
<!-- Prepended text-->
|
||||
|
||||
<div class='control-group'>
|
||||
<!-- Prepended text-->
|
||||
<div class='control-group'>
|
||||
<label class="col-md-8 control-label" >System ID <span style="color:red">*</span></label>
|
||||
<div class='controls'>
|
||||
<div class="col-md-4">
|
||||
@@ -210,20 +209,16 @@ mysqli_close($link);
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /PREPEND EXAMPLE -->
|
||||
|
||||
<!-- Text input-->
|
||||
<div class="form-group">
|
||||
<label class="col-md-4 control-label" for="ServiceTag">System type <span style="color:red">*</span></label>
|
||||
</div>
|
||||
<!-- Text input-->
|
||||
<div class="form-group">
|
||||
<label class="col-md-4 control-label" for="sysType">System type <span style="color:red">*</span></label>
|
||||
<div class="col-md-4">
|
||||
<input id="ServiceTag" name="ServiceTag" type="text" placeholder="" class="form-control input-md" required="">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Select Basic -->
|
||||
<div class="form-group">
|
||||
</div>
|
||||
<!-- Select Basic -->
|
||||
<div class="form-group">
|
||||
<label class="col-md-4 control-label" for="location">Location <span style="color:red">*</span></label>
|
||||
<div class="col-md-4">
|
||||
<select id="location" name="location" class="form-control">
|
||||
@@ -232,29 +227,33 @@ mysqli_close($link);
|
||||
<option value="Nijmegen">Nijmegen</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Text input-->
|
||||
<div class="form-group">
|
||||
<label class="col-md-4 control-label" for="WinKey">Windows key <span style="color:red">*</span></label>
|
||||
<div class="col-md-4">
|
||||
<input id="WinKey" name="WinKey" type="WinKey" placeholder="" class="form-control input-md" required="">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Text input-->
|
||||
<div class="form-group">
|
||||
<!-- Text input-->
|
||||
<div class="form-group">
|
||||
<label class="col-md-4 control-label" for="EthMac">Mac addres <span style="color:red">*</span></label>
|
||||
<div class="col-md-4">
|
||||
<input id="EthMac" name="EthMac" type="text" placeholder="" class="form-control input-md" required="">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Text input-->
|
||||
<div class="form-group">
|
||||
<label class="col-md-4 control-label" for="WinKey">Windows key <span style="color:red">*</span></label>
|
||||
<div class="col-md-4">
|
||||
<input id="WinKey" name="WinKey" type="WinKey" placeholder="" class="form-control input-md" required="">
|
||||
</div>
|
||||
</div>
|
||||
<!-- Text input-->
|
||||
<div class="form-group">
|
||||
<label class="col-md-4 control-label" for="sysType">Service Tag/Serial nr<span style="color:red">*</span></label>
|
||||
<div class="col-md-4">
|
||||
<input id="sysType" name="sysType" type="text" placeholder="" class="form-control input-md" required="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<input type="submit" class="btn btn-secondary" value="Add">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<!-- / CONTENT -->
|
||||
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
require_once "../assets/php/config.php";
|
||||
error_log("Loading Page", 0);
|
||||
// Define variables and initialize with empty values
|
||||
$sysID = $sysType = $location = $EthMac = $Winkey = "";
|
||||
$sysID_err = $sysType_err = $location_err = $EthMac_err = $Winkey_err = "";
|
||||
$sysID = $sysType = $location = $EthMac = $Winkey = $ServiceTag = "";
|
||||
$sysID_err = $sysType_err = $location_err = $EthMac_err = $Winkey_err = $ServiceTag_err = "";
|
||||
// Processing form data when form is submitted
|
||||
if(isset($_POST["id"]) && !empty($_POST["id"])){
|
||||
// Get hidden input value
|
||||
@@ -46,14 +46,21 @@ if(isset($_POST["id"]) && !empty($_POST["id"])){
|
||||
} else{
|
||||
$Winkey = $input_Winkey;
|
||||
}
|
||||
|
||||
$input_ServiceTag = trim($_POST["ServiceTag"]);
|
||||
if(empty($input_ServiceTag)){
|
||||
$ServiceTag_err = "Please enter a Servicetag/Serial nr";
|
||||
} else{
|
||||
$ServiceTag = $input_ServiceTag;
|
||||
}
|
||||
// Check input errors before inserting in database
|
||||
if(empty($sysID_err) && empty($location_err) && empty($requestype_err) && empty($request_by_err) && empty($reason_err)){
|
||||
// Prepare an update statement
|
||||
$sql = "UPDATE systems SET sysID=?,sysType=?,location=?,EthMac=?, WinKey=? WHERE id=?";
|
||||
$sql = "UPDATE systems SET sysID=?,sysType=?,location=?,EthMac=?, WinKey=?, ServiceTag=? WHERE id=?";
|
||||
|
||||
if($stmt = mysqli_prepare($link, $sql)){
|
||||
// Bind variables to the prepared statement as parameters
|
||||
mysqli_stmt_bind_param($stmt, "sssssi", $param_sysID, $param_systype, $param_location, $param_EthMac, $param_Winkey, $param_id);
|
||||
mysqli_stmt_bind_param($stmt, "ssssssi", $param_sysID, $param_systype, $param_location, $param_EthMac, $param_Winkey, $param_ServiceTag, $param_id);
|
||||
|
||||
// Set parameters
|
||||
$param_sysID = $sysID;
|
||||
@@ -61,6 +68,7 @@ if(isset($_POST["id"]) && !empty($_POST["id"])){
|
||||
$param_location = $location;
|
||||
$param_EthMac = $EthMac;
|
||||
$param_Winkey = $Winkey;
|
||||
$param_ServiceTag = $ServiceTag;
|
||||
$param_id = $id;
|
||||
|
||||
// Attempt to execute the prepared statement
|
||||
@@ -106,6 +114,7 @@ if(isset($_POST["id"]) && !empty($_POST["id"])){
|
||||
$location = $row["location"];
|
||||
$Winkey = $row["WinKey"];
|
||||
$EthMac = $row["EthMac"];
|
||||
$ServiceTag = $row['ServiceTag'];
|
||||
$id = $row['id'];
|
||||
$string = $row["sysMeta"];
|
||||
} else{
|
||||
@@ -356,6 +365,12 @@ $lines = explode("\n", $trimmedString);
|
||||
<input type="text" name="Win_Key" class="form-control" value="<?php echo $Winkey; ?>">
|
||||
<span class="help-block"><?php echo $Winkey_err;?></span>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4 <?php echo (!empty($ServiceTag_err)) ? 'has-error' : ''; ?>">
|
||||
<label>Service Tag/Serial nr</label>
|
||||
<input type="text" name="ServiceTag" class="form-control" value="<?php echo $ServiceTag; ?>">
|
||||
<span class="help-block"><?php echo $ServiceTag_err;?></span>
|
||||
</div>
|
||||
<input type="hidden" name="id" value="<?php echo $id; ?>"/>
|
||||
<input type="submit" class="btn btn-secondary" value="Submit">
|
||||
</form>
|
||||
|
||||
@@ -149,7 +149,7 @@ require_once "../assets/php/cuttext.php";
|
||||
<div class="clearfix" style="padding:20px;">
|
||||
<h2 class="pull-right">Users</h2>
|
||||
<div class="toolbar crud pull-left">
|
||||
<a href="create-system.php" class="btn btn-secondary btn-fab"><i class="icon-plus"></i></a>
|
||||
<a href="create-user.php" class="btn btn-secondary btn-fab"><i class="icon-plus"></i></a>
|
||||
<button type="button" class="btn btn-secondary btn-fab" id="SearchButton"><i class="icon-magnify"></i></button>
|
||||
<input type="search" id="SearchInput" style="display:none;" placeholder="Search">
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user