diff options
author | William Harrington <kb0iic@berzerkula.org> | 2018-03-12 15:51:42 -0500 |
---|---|---|
committer | William Harrington <kb0iic@berzerkula.org> | 2018-03-12 15:51:42 -0500 |
commit | 6c7a859fcf9691023c418366a62ece2f19cf4c9f (patch) | |
tree | 051200b735f41c29fd81a18f982987e152e1f0a8 /delete.php |
Initial commit for project.
Diffstat (limited to 'delete.php')
-rw-r--r-- | delete.php | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/delete.php b/delete.php new file mode 100644 index 0000000..26ced0c --- /dev/null +++ b/delete.php @@ -0,0 +1,77 @@ +<?php +session_start(); +?> +<!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>Delete ID</title> +</head> +<body> +<?php +//Debug +//echo 'Session: ' . session_id() . ' Count: ' . $_SESSION['counter'] . '<br>'; +//var_dump($_SESSION); +?> +<p><fieldset> +<legend><span>Delete Record</span></legend> +<br> +<?php +include('/home/kb0iic/config.inc'); + +if(!empty($_GET['id'])) +{ + $id=$_GET['id']; + if(isset($_POST['submit'])) + { + $sql = 'DELETE PKG, PKG_CFG, PKG_BLD, PKG_NST, PKG_SET, PKG_NOT, PKG_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 = PKG.id AND PKG.id=:id ;'; + + try { + $stmt = $pdo->prepare($sql); + $stmt->execute(['id' => $id]); + } catch (PDOException $e) { + echo '<font color="D00"><pre>Have a big problem</pre></font>'; + throw $e; + } + header("location:list.php"); + } + + $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 '<font color="D00"><pre>Have a big problem</pre></font>'; + 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" readonly> + <br> + <label for="name">Name: </label><input type="text" name="name" value="<?php echo $row['name']; ?>" id="name" readonly> + <br> + <label for="version">Version: </label><input type="text" name="version" value="<?php echo $row['version']; ?>" id="version" readonly> + <br><br> + <label for="configure">Configure: </label><textarea readonly name="configure" rows="2" cols="80"><?php echo htmlspecialchars($row['configure']); ?></textarea><br><br> + <label for="configure">Build: </label><textarea readonly name="build" rows="2" cols="80"><?php echo htmlspecialchars($row['build']); ?></textarea><br><br> + <label for="install">Install: </label><textarea readonly name="install" rows="2" cols="80"><?php echo htmlspecialchars($row['install']); ?></textarea><br><br> + <label for="setup">Setup: </label><textarea readonly name="setup" rows="2" cols="80"><?php echo htmlspecialchars($row['setup']); ?></textarea><br><br> + <label for="notes">Notes: </label><textarea readonly name="notes" rows="2" cols="80"><?php echo htmlspecialchars($row['notes']); ?></textarea><br><br> + <label for="url">Url: </label><textarea readonly name="url" rows="2" cols="80"><?php echo htmlspecialchars($row['url']); ?></textarea><br><br> + <br> + <br> + <input type="submit" name="submit" id="isub" value="Delete" /> + </form> +<?php +} else { + echo '<font color="#D00"><pre>No ID given to delete!</pre></font>'; +} +?> +</fieldset> +</body> +</html> |