aboutsummaryrefslogtreecommitdiffstats
path: root/A8_srv_build/edit.php
diff options
context:
space:
mode:
Diffstat (limited to 'A8_srv_build/edit.php')
-rw-r--r--A8_srv_build/edit.php114
1 files changed, 114 insertions, 0 deletions
diff --git a/A8_srv_build/edit.php b/A8_srv_build/edit.php
new file mode 100644
index 0000000..c3fda52
--- /dev/null
+++ b/A8_srv_build/edit.php
@@ -0,0 +1,114 @@
+<?php
+session_start();
+
+if( isset( $_SESSION['counter'] )) {
+ $_SESSION['counter'] += 1;
+} else {
+ $_SESSION['counter'] = 1;
+}
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html;charset=utf-8">
+<link rel="stylesheet" type="text/css" href="/css/table.css">
+<link rel="stylesheet" type="text/css" href="/css/style.css">
+<title>Edit ID</title>
+</head>
+<body>
+<?php
+//Debug
+//echo 'Session: ' . session_id() . ' Count: ' . $_SESSION['counter'] . '<br>';
+//var_dump($_SESSION);
+?>
+<p><fieldset>
+<legend><span>Update Record</span></legend>
+<br>
+<?php
+include('config.inc');
+if(!empty($_GET['id']))
+{
+ $id=$_GET['id'];
+ if(isset($_POST['submit']))
+ {
+ $seq=($_POST['seq']);
+ $name=($_POST['name']);
+ $version=($_POST['version']);
+ $configure=($_POST['configure']);
+ $build=($_POST['build']);
+ $install=($_POST['install']);
+ $setup=($_POST['setup']);
+ $notes=($_POST['notes']);
+ $url=($_POST['url']);
+
+
+ $sql = 'UPDATE PKG, PKG_CFG, PKG_BLD, PKG_NST, PKG_SET, PKG_NOT, ';
+ $sql .= 'PKG_URL SET PKG.seq=:seq, PKG.name=:name, ';
+ $sql .= 'PKG.version=:version, PKG_CFG.configure=:configure, ';
+ $sql .= 'PKG_BLD.build=:build, PKG_NST.install=:install, ';
+ $sql .= 'PKG_SET.setup=:setup, PKG_NOT.notes=:notes, ';
+ $sql .= 'PKG_URL.url=:url WHERE PKG_CFG.pkg_id=PKG.id AND ';
+ $sql .= 'PKG_BLD.pkg_id=PKG.id AND PKG_NST.pkg_id=PKG.id AND ';
+ $sql .= 'PKG_SET.pkg_id=PKG.id AND PKG_NOT.pkg_id=PKG.id AND ';
+ $sql .= 'PKG_URL.pkg_id=PKG.id AND PKG.id=:id';
+
+ try {
+ $stmt = $pdo->prepare($sql);
+ $stmt->execute(['seq' => $seq, 'name' => $name, 'version' => $version, 'configure' => $configure, 'build' => $build, 'install' => $install, 'setup' => $setup, 'notes' => $notes, 'url' => $url, 'id' => $id]);
+ } catch (PDOException $e) {
+ echo '<pre style="color:Red">Have a big problem</pre>';
+ throw $e;
+ }
+ header("location:list.php#$seq");
+ exit();
+ }
+
+
+ $sql = 'SELECT id, seq, name, version, configure, build, install, setup, notes, url FROM PKG, PKG_CFG, PKG_BLD, PKG_NST, PKG_SET, PKG_NOT, PKG_URL WHERE PKG_CFG.pkg_id=PKG.id AND PKG_BLD.pkg_id=PKG.id AND PKG_NST.pkg_id=PKG.id AND PKG_SET.pkg_id = PKG.id AND PKG_NOT.pkg_id=PKG.id AND PKG_URL.pkg_id=id AND PKG.id=:id';
+
+ try {
+
+ $stmt = $pdo->prepare($sql);
+ $stmt->execute(['id' => $id]);
+ } catch (PDOException $e) {
+ echo '<pre style="color:Red">Have a big problem</pre>';
+ throw $e;
+ }
+
+ $row = $stmt->fetch(PDO::FETCH_ASSOC)
+?>
+ <form method="post" action="">
+ <label for="sequence">Sequence: </label>
+<input type="text" name="seq" value="<?php echo $row['seq']; ?>" id="seq"/><br>
+ <label for="name">Name: </label>
+<input type="text" name="name" value="<?php echo $row['name']; ?>" id="name"/><br>
+ <label for="version">Version: </label>
+<input type="text" name="version" value="<?php echo $row['version']; ?>" id="version"/><br><br>
+ <label for="configure">Configure: </label>
+<textarea name="configure" rows="2" cols="80"><?php echo htmlspecialchars($row['configure']); ?></textarea><br><br>
+ <label for="configure">Build: </label>
+<textarea name="build" rows="2" cols="80"><?php echo htmlspecialchars($row['build']); ?></textarea><br><br>
+ <label for="install">Install: </label>
+<textarea name="install" rows="2" cols="80"><?php echo htmlspecialchars($row['install']); ?></textarea><br><br>
+ <label for="setup">Setup: </label>
+<textarea name="setup" rows="2" cols="80"><?php echo htmlspecialchars($row['setup']); ?></textarea><br><br>
+ <label for="notes">Notes: </label>
+<textarea name="notes" rows="2" cols="80"><?php echo htmlspecialchars($row['notes']); ?></textarea><br><br>
+ <label for="url">Url: </label>
+<textarea name="url" rows="2" cols="80"><?php echo htmlspecialchars($row['url']); ?></textarea><br><br>
+ <br>
+ <br>
+ <input type="submit" name="submit" id="isub" value="Update" />
+ </form>
+ <form action="list.php#<?php echo $row['seq']; ?>" method="POST">
+ <input type="submit" name="select" value="OK"/>
+ </form>
+<?php
+} else {
+ echo '<pre style="color:Red">No ID given to edit!</pre>';
+}
+?>
+</fieldset>
+
+</body>
+</html>