aboutsummaryrefslogtreecommitdiffstats
path: root/A8_srv_build/delete.php
blob: cfa52a3dca06d048c4e8f01f571c8fbfcbfc35bb (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
<?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);
?>

<pre>
<?php
include('config.inc');

print_r($_POST['delid']);

if (!empty($_POST['delid'])) {
	$delid = isset($_POST['delid']) ? $delid = $_POST['delid'] : null;
	$nc = count($delid);
	for ($i=0;$i<$nc;$i++)
	{
		$did = $delid[$i];
		echo "Removing $did\n";
$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' => $did]);
	} catch (PDOException $e) {
		echo '<font color="D00"><pre>Have a big problem</pre></font>';
		throw $e;
	}

	}
} else {
	echo "No rows selected to delete!";
}
?>
</pre>
<form action="list.php" method="POST">
<input type="submit" name="select" value="OK">
</form>
</body>
</html>