diff options
-rw-r--r-- | add.php | 125 | ||||
-rw-r--r-- | config.inc | 18 | ||||
-rw-r--r-- | delete.php | 77 | ||||
-rw-r--r-- | edit.php | 110 | ||||
-rw-r--r-- | list-scroll.php | 85 | ||||
-rw-r--r-- | list.php | 237 | ||||
-rw-r--r-- | openfile.php | 36 | ||||
-rw-r--r-- | sessionvars.php | 61 | ||||
-rw-r--r-- | test.php | 29 |
9 files changed, 778 insertions, 0 deletions
@@ -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('/home/kb0iic/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> diff --git a/config.inc b/config.inc new file mode 100644 index 0000000..ffea00e --- /dev/null +++ b/config.inc @@ -0,0 +1,18 @@ +<?php + +//For Databases +$host = 'localhost'; +$db = 'A8_srv_build'; +$user = 'username'; +$pass = 'password'; +$charset = 'utf8'; + +$dsn = "mysql:host=$host;dbname=$db;charset=$charset"; +$opt = [ + PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, + PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, + PDO::ATTR_EMULATE_PREPARES => false, + ]; +$pdo = new PDO($dsn, $user, $pass, $opt); + +?> 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> diff --git a/edit.php b/edit.php new file mode 100644 index 0000000..04b8e47 --- /dev/null +++ b/edit.php @@ -0,0 +1,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> diff --git a/list-scroll.php b/list-scroll.php new file mode 100644 index 0000000..c69ed20 --- /dev/null +++ b/list-scroll.php @@ -0,0 +1,85 @@ +<!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"> +<link rel="stylesheet" type="text/css" href="../css/table.css"> +<title></title> +</head> +<body> +<a href="add.php" class="stb">Add Record</a><br><br><br> +<?php + +include '/home/kb0iic/config.inc'; + +$name = '$_POST[Pkgname]'; +//$name = 'linux-headers'; + +$sql = 'SELECT id, seq, name, version, configure, build, install, notes, url FROM PKG, PKG_CFG, PKG_BLD, PKG_NST, 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_NOT.pkg_id = PKG.id AND PKG_URL.pkg_id = PKG.id'; + +try { + $stmt = $pdo->prepare($sql); + $stmt->execute(); +} catch (PDOException $e) { + if ($e->getCode() == 1062) { + // Take some action if there is a key constraint violation, + // i.e. duplicate name + print $e->getMessage(); + } else { + echo "<pre>Have a big problem</pre>"; + throw $e; + } +} + +if ($stmt->rowCount() > 0) { + + // Data received + + // Start Table + $html_table = '<div id="constrainer"><div class="scrolltable">'; + + // Table Header + $html_table .= '<table class="header">'; + $html_table .= '<thead><th>SEQ</th><th>NAME</th><th>VERSION</th>'; + $html_table .= '<th>CONFIGURE</th><th>BUILD</th><th>INSTALL</th>'; + $html_table .= '<th>NOTES</th><th>URL</th><th>EDIT</th></thead>'; + $html_table .= '</table>'; + + // Body + $html_table .= '<div class="body"><table><tbody>'; + + // Table Rows + while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { + $html_table .= '<tr>'; + $html_table .= '<td><a name="'.$row['seq'].'">'.$row['seq'].'</a></td>'; + $html_table .= '<td>'.$row['name'].'</td>'; + $html_table .= '<td>'.$row['version'].'</td>'; + $html_table .= '<td>'.nl2br($row['configure']).'</td>'; + $html_table .= '<td>'.nl2br($row['build']).'</td>'; + $html_table .= '<td>'.nl2br($row['install']).'</td>'; + $html_table .= '<td>'.nl2br($row['notes']).'</td>'; + $html_table .= '<td>'.nl2br($row['url']).'</td>'; + $html_table .= "<td><a href='edit.php?id=".$row['id']."'class=\"stb\">Edit</a></td>"; + $html_table .= '</tr>'; + } + + // End Table + $html_table .= '</tbody></table></div></div></div>'; + +} else { + // No Data received + echo "<pre>Nothing!</pre>"; +} + +$html_table .= '</table>'; +echo $html_table; + +?> +<!--- w3c tag --> +<p align="right"> +<a href="http://validator.w3.org/check?uri=referer"><img +src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional" height="31" width="88"></a> +</p> +<!-- end w3c tag --> +</body> +</html> diff --git a/list.php b/list.php new file mode 100644 index 0000000..1750a34 --- /dev/null +++ b/list.php @@ -0,0 +1,237 @@ +<?php +session_start(); +?> +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<?php +if( isset( $_SESSION['counter'] )) { + $_SESSION['counter'] += 1; +} else { + $_SESSION['counter'] = 1; +} + +$cn = $_SESSION['cn']; +$bl = $_SESSION['bl']; +$ns = $_SESSION['ns']; +$se = $_SESSION['se']; +$no = $_SESSION['no']; +$ur = $_SESSION['ur']; +?> + + <html> + <head> + <meta http-equiv="content-type" content="text/html;charset=utf-8"> + <link rel="stylesheet" type="text/css" href="/css/style.css"> + <link rel="stylesheet" type="text/css" href="/css/table.css"> + <title></title> + </head> + <body> +<?php +//DEBUG +//echo 'Session: ' . session_id() . '<br>'; +//echo '$_SESSION' . var_dump($_SESSION) . '<br>'; +//echo '$_POST' . var_dump($_POST) . '<br>'; +?> + + <a href="add.php" class="stb">Add Record</a><br><br> + <form action="sessionvars.php" method="post"> + Select columns: + <input type="checkbox" name="cn" value="Configure" + <?php echo isSet($cn)?" checked":"";?>>Configure + <input type="checkbox" name="bl" value="Build" + <?php echo isSet($bl)?" checked":"";?>>Build + <input type="checkbox" name="ns" value="Install" + <?php echo isSet($ns)?" checked":"";?>>Install + <input type="checkbox" name="se" value="Setup" + <?php echo isSet($se)?" checked":"";?>>Setup + <input type="checkbox" name="no" value="Notes" + <?php echo isSet($no)?" checked":"";?>>Notes + <input type="checkbox" name="ur" value="URL" + <?php echo isSet($ur)?" checked":"";?>>URL + <input type="submit" name="submit" value="Submit"> + </form> + +<?php +include '/home/kb0iic/config.inc'; + +$sqlselect = 'SELECT id, seq, name, version'; +$sqlfrom = ' FROM PKG'; +$sqlwhere = ''; + +#if columns are selected +if($cn || $bl || $ns || $se || $no || $ur) { + $sqlwhere = ' WHERE'; +} +$sqlorder = ' ORDER BY seq ASC'; + +#if configure is checked +if($cn) { + $sqlselect .= ', configure'; + $sqlfrom .= ', PKG_CFG'; + $sqlwhere .= ' PKG_CFG.pkg_id = PKG.id'; + if($bl || $ns || $se || $no || $ur) { + + $sqlwhere .= ' AND'; + } +} + +#if build is checked +if($bl) { + $sqlselect .= ', build'; + $sqlfrom .= ', PKG_BLD'; + $sqlwhere .= ' PKG_BLD.pkg_id = PKG.id'; + if($ns || $se || $no || $ur) { + + $sqlwhere .= ' AND'; + } + +} + +#if install is checked +if($ns) { + $sqlselect .= ', install'; + $sqlfrom .= ', PKG_NST'; + $sqlwhere .= ' PKG_NST.pkg_id = PKG.id'; + if($se || $no || $ur) { + + $sqlwhere .= ' AND'; + } + +} + +#if setup is checked +if($se) { + $sqlselect .= ', setup'; + $sqlfrom .= ', PKG_SET'; + $sqlwhere .= ' PKG_SET.pkg_id = PKG.id'; + if($no || $ur) { + + $sqlwhere .= ' AND'; + } + +} + +#if notes is checked +if($no) { + $sqlselect .= ', notes'; + $sqlfrom .= ', PKG_NOT'; + $sqlwhere .= ' PKG_NOT.pkg_id = PKG.id'; + if($ur) { + + $sqlwhere .= ' AND'; + } + +} + +#if url is checked +if($ur) { + $sqlselect .= ', url'; + $sqlfrom .= ', PKG_URL'; + $sqlwhere .= ' PKG_URL.pkg_id = PKG.id'; +} + +$sql = $sqlselect . $sqlfrom . $sqlwhere . $sqlorder; +try { + $stmt = $pdo->prepare($sql); + $stmt->execute(); +} catch (PDOException $e) { + echo '<pre style="color:Red">Have a big problem</pre>'; + throw $e; + echo "$e->getMessage()"; +} + +if ($stmt->rowCount() > 0) { + + // Data received + + + // Begin Table + $html_table = '<table class="bdb"><caption>A8-3800 CLFS Server</caption>'; + + // Table Header + $html_table .= '<thead><tr><th>EDIT</th><th>SEQ</th><th>NAME</th>'; + $html_table .= '<th>VERSION</th>'; + if($cn){$html_table .= '<th>CONFIGURE</th>';} + if($bl){$html_table .= '<th>BUILD</th>';} + if($ns){$html_table .= '<th>INSTALL</th>';} + if($se){$html_table .= '<th>SETUP</th>';} + if($no){$html_table .= '<th>NOTES</th>';} + if($ur){$html_table .= '<th>URL</th>';} + $html_table .= '<th>DELETE</th></tr></thead>'; + + // Table Footer + $html_table .= '<tfoot><tr><th>EDIT</th><th>SEQ</th><th>NAME</th>'; + $html_table .= '<th>VERSION</th>'; + if($cn){$html_table .= '<th>CONFIGURE</th>';} + if($bl){$html_table .= '<th>BUILD</th>';} + if($ns){$html_table .= '<th>INSTALL</th>';} + if($se){$html_table .= '<th>SETUP</th>';} + if($no){$html_table .= '<th>NOTES</th>';} + if($ur){$html_table .= '<th>URL</th>';} + $html_table .= '<th>DELETE</th></tr></tfoot>'; + + // Table Body + $html_table .= '<tbody>'; + + // Table Rows + while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { + $rowid = $row['id']; + $rowseq = $row['seq']; + $rownm = $row['name']; + $rowver = $row['version']; + if($cn) { + $rowcfg = nl2br(str_replace(' ', ' ', $row['configure'])); + } + if($bl) { + $rowbld = nl2br(str_replace(' ', ' ', $row['build'])); + } + if($ns) { + $rownst = nl2br(str_replace(' ', ' ', $row['install'])); + } + if($se) { + $rowset = nl2br(str_replace(' ', ' ', $row['setup'])); + } + if($no) { + $rownot = nl2br(str_replace(' ', ' ', $row['notes'])); + } + if($ur) { + $rowurl = nl2br(str_replace(' ', ' ', $row['url'])); + } + $html_table .= '<tr>'; + $html_table .= "<td><a href='edit.php?id=".$rowid."'class=\"stb\">Edit</a></td>"; + $html_table .= '<td><a name="'.$rowseq.'">'.$rowseq.'</a></td>'; + $html_table .= '<td><a href="openfile.php?name='.$rownm.'" title="installed-files"/'.$rownm.'" title="Installed files list" target="_blank">'.($rownm).'</a></td>'; + $html_table .= '<td>'.($rowver).'</td>'; + if($cn){$html_table .= '<td>'.($rowcfg).'</td>';} + if($bl){$html_table .= '<td>'.($rowbld).'</td>';} + if($ns){$html_table .= '<td>'.($rownst).'</td>';} + if($se){$html_table .= '<td>'.($rowset).'</td>';} + if($no){$html_table .= '<td>'.($rownot).'</td>';} + if($ur){$html_table .= '<td>'.($rowurl).'</td>';} + $html_table .= "<td><a href='delete.php?id=".$rowid."'class=\"stb\">Delete</a></td>"; + + $html_table .= '</tr>'; + } + + // End Table Body + $html_table .= '</tbody>'; + + // End Table + $html_table .= '</table>'; + + //Output Table + echo $html_table; + +} else { + // No Data received + echo '<font color="#D00"><pre>No data found!</pre></font>'; +} +?> + + <!--- w3c tag --> + <p align="right"> + <a href="http://validator.w3.org/check?uri=referer"><img + src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional" height="31" width="88"></a> + </p> + <!-- end w3c tag --> + </body> + </html> diff --git a/openfile.php b/openfile.php new file mode 100644 index 0000000..1d7d9c1 --- /dev/null +++ b/openfile.php @@ -0,0 +1,36 @@ +<?php +session_start(); + +include('/home/kb0iic/config.inc'); +$name = $_GET['name']; +?> +<!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>File List</title> +</head> +<body> +<p><fieldset> +<legend><span>Installed File List for +<?php echo $name ?> +</span></legend> +<br> +<?php +if(!empty($name)) { + //echo '<pre style="color:green">Name found</pre>'; + $myfile = fopen("/sources/installed-files/$name", "r") + or die("Unable to open file!"); + echo "<textarea readonly name='txtbox' rows='24'>"; + echo fread($myfile,filesize("/sources/installed-files/$name")); + echo "</textarea>"; + fclose($myfile); +} else { + echo '<pre style="color:Red">No NAME given to list installed files!</pre>'; +} +?> +</fieldset> +</body> +</html> diff --git a/sessionvars.php b/sessionvars.php new file mode 100644 index 0000000..8a17b9b --- /dev/null +++ b/sessionvars.php @@ -0,0 +1,61 @@ +<?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"> +<link rel="stylesheet" type="text/css" href="/css/table.css"> +<title></title> +</head> +<body> +<?php +var_dump($_GET); +if( isset($_POST['cn']) ) +{ + $_SESSION['cn'] = $_POST['cn']; +} else { + unset($_SESSION['cn']); +} + +if( isset($_POST['bl']) ) +{ + $_SESSION['bl'] = $_POST['bl']; +} else { + unset($_SESSION['bl']); +} + +if( isset($_POST['ns']) ) +{ + $_SESSION['ns'] = $_POST['ns']; +} else { + unset($_SESSION['ns']); +} + +if( isset($_POST['se']) ) +{ + $_SESSION['se'] = $_POST['se']; +} else { + unset($_SESSION['se']); +} + +if( isset($_POST['no']) ) +{ + $_SESSION['no'] = $_POST['no']; +} else { + unset($_SESSION['no']); +} + +if( isset($_POST['ur']) ) +{ + $_SESSION['ur'] = $_POST['ur']; +} else { + unset($_SESSION['ur']); +} + +header("location:list.php"); +exit(); +?> +</body> +</html> diff --git a/test.php b/test.php new file mode 100644 index 0000000..354a94f --- /dev/null +++ b/test.php @@ -0,0 +1,29 @@ +<!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"> +<link rel="stylesheet" type="text/css" href="/css/table.css"> +<title></title> +</head> +<body> +<a href="add.php" class="stb">Add Record</a><br><br><br> +<?php +include '/home/kb0iic/config.inc'; + +$name = '$_POST[Pkgname]'; + +$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 = PKG.id ORDER BY seq ASC'; + + $stmt = $pdo->prepare($sql); + $stmt->execute(); +echo 'test'; +?> +<!--- w3c tag --> +<p align="right"> +<a href="http://validator.w3.org/check?uri=referer"><img +src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional" height="31" width="88"></a> +</p> +<!-- end w3c tag --> +</body> +</html> |