aboutsummaryrefslogtreecommitdiffstats
path: root/A8_srv_build/add.php
diff options
context:
space:
mode:
Diffstat (limited to 'A8_srv_build/add.php')
-rw-r--r--A8_srv_build/add.php125
1 files changed, 125 insertions, 0 deletions
diff --git a/A8_srv_build/add.php b/A8_srv_build/add.php
new file mode 100644
index 0000000..dcad257
--- /dev/null
+++ b/A8_srv_build/add.php
@@ -0,0 +1,125 @@
+<?php
+session_start();
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html;charset=utf-8">
+<link rel="stylesheet" type="text/css" href="/css/style.css">
+<title></title>
+</head>
+<body>
+<?php
+//Debug
+//echo 'Session: ' . session_id() . ' Count: ' . $_SESSION['counter'] . '<br>';
+//var_dump($_SESSION);
+?>
+<br><fieldset>
+<legend><span>Add Record</span></legend>
+<br>
+<?php
+include('config.inc');
+if(isset($_POST['submit']))
+{
+ if(!empty($_POST['name']))
+ {
+ $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']);
+
+ //PKG TABLE
+ $sqlpkg = 'INSERT INTO PKG (id, seq, name, version) ';
+ $sqlpkg .= 'VALUES (null, :seq, :name, :version);';
+
+ //PKG_CFG TABLE
+ $sqlcfg = 'INSERT INTO PKG_CFG (pkg_id, configure) ';
+ $sqlcfg .= 'VALUES (:pkg_id, :configure);';
+
+ //PKG_BLD TABLE
+ $sqlbld = 'INSERT INTO PKG_BLD (pkg_id, build) ';
+ $sqlbld .= 'VALUES (:pkg_id, :build);';
+
+ //PKG_NST TABLE
+ $sqlnst = 'INSERT INTO PKG_NST (pkg_id, install) ';
+ $sqlnst .= 'VALUES (:pkg_id, :install);';
+
+ //PKG_SET TABLE
+ $sqlset = 'INSERT INTO PKG_SET (pkg_id, setup) ';
+ $sqlset .= 'VALUES (:pkg_id, :setup);';
+
+ //PKG_NOT TABLE
+ $sqlnot = 'INSERT INTO PKG_NOT (pkg_id, notes) ';
+ $sqlnot .= 'VALUES (:pkg_id, :notes);';
+
+ //PKG_URL TABLE
+ $sqlurl = 'INSERT INTO PKG_URL (pkg_id, url) ';
+ $sqlurl .= 'VALUES (:pkg_id, :url);';
+
+ try{
+ $pdo->beginTransaction();
+ $stmt = $pdo->prepare($sqlpkg);
+ $stmt->execute(['seq' => $seq, 'name' => $name, 'version' => $version]);
+ $pkgid = $pdo->lastInsertId();
+ //echo "PKGID: '$pkgid' '$seq' '$name' '$version'";
+
+ $stmt = $pdo->prepare($sqlcfg);
+ $stmt->execute(['pkg_id' => $pkgid, 'configure' => $configure]);
+ $stmt = $pdo->prepare($sqlbld);
+ $stmt->execute(['pkg_id' => $pkgid, 'build' => $build]);
+ $stmt = $pdo->prepare($sqlnst);
+ $stmt->execute(['pkg_id' => $pkgid, 'install' => $install]);
+ $stmt = $pdo->prepare($sqlset);
+ $stmt->execute(['pkg_id' => $pkgid, 'setup' => $setup]);
+ $stmt = $pdo->prepare($sqlnot);
+ $stmt->execute(['pkg_id' => $pkgid, 'notes' => $notes]);
+ $stmt = $pdo->prepare($sqlurl);
+ $stmt->execute(['pkg_id' => $pkgid, 'url' => $url]);
+
+ $pdo->commit();
+
+ } catch(Exception $e) {
+ $pdo->rollBack();
+ throw $e;
+ }
+
+ header("location:list.php#$seq");
+
+ } else {
+ echo '<pre style="color:Red">';
+ echo 'Need at least the following attributes: Sequence, Name';
+ echo '</pre>';
+ }
+}
+?>
+<form method="post" action="">
+<label for="seq">Sequence: </label>
+<input type="text" name="seq" value="" id="seq"><br>
+<label>Name: </label>
+<input type="text" name="name" value="" id="name"><br>
+<label>Version: </label>
+<input type="text" name="version" value="" id="version"><br><br>
+<label>Configure: </label>
+<textarea name="configure" rows="2" cols="80"></textarea><br><br>
+<label>Build: </label>
+<textarea name="build" rows="2" cols="80"></textarea><br><br>
+<label>Install: </label>
+<textarea name="install" rows="2" cols="80"></textarea><br><br>
+<label>Setup: </label>
+<textarea name="setup" rows="2" cols="80"></textarea><br><br>
+<label>Notes: </label>
+<textarea name="notes" rows="2" cols="80"></textarea><br><br>
+<label>Url: </label>
+<textarea name="url" rows="2" cols="80"></textarea><br><br>
+<br>
+<br>
+<input type="submit" name="submit" id="isub" value="Add">
+</form>
+</fieldset>
+</body>
+</html>