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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
<?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>Edit Record</span></legend>
<br>
<?php
include('/home/kb0iic/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>
<?php
} else {
echo '<pre style="color:Red">No ID given to edit!</pre>';
}
?>
</fieldset>
</body>
</html>
|