aboutsummaryrefslogtreecommitdiffstats
path: root/delete.php
blob: 26ced0c59b6994f5e04da5913406a6ee93e44bb4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
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>