From 6c7a859fcf9691023c418366a62ece2f19cf4c9f Mon Sep 17 00:00:00 2001 From: William Harrington Date: Mon, 12 Mar 2018 15:51:42 -0500 Subject: Initial commit for project. --- add.php | 125 ++++++++++++++++++++++++++++++ config.inc | 18 +++++ delete.php | 77 ++++++++++++++++++ edit.php | 110 ++++++++++++++++++++++++++ list-scroll.php | 85 ++++++++++++++++++++ list.php | 237 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ openfile.php | 36 +++++++++ sessionvars.php | 61 +++++++++++++++ test.php | 29 +++++++ 9 files changed, 778 insertions(+) create mode 100644 add.php create mode 100644 config.inc create mode 100644 delete.php create mode 100644 edit.php create mode 100644 list-scroll.php create mode 100644 list.php create mode 100644 openfile.php create mode 100644 sessionvars.php create mode 100644 test.php diff --git a/add.php b/add.php new file mode 100644 index 0000000..6ede522 --- /dev/null +++ b/add.php @@ -0,0 +1,125 @@ + + + + + + + + + +'; +//var_dump($_SESSION); +?> +
+Add Record +
+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 '
';
+		echo 'Need at least the following attributes: Sequence, Name';
+		echo '
'; + } +} +?> +
+ +
+ +
+ +

+ +

+ +

+ +

+ +

+ +

+ +

+
+
+ +
+
+ + diff --git a/config.inc b/config.inc new file mode 100644 index 0000000..ffea00e --- /dev/null +++ b/config.inc @@ -0,0 +1,18 @@ + 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 @@ + + + + + + + +Delete ID + + +'; +//var_dump($_SESSION); +?> +

+Delete Record +
+prepare($sql); + $stmt->execute(['id' => $id]); + } catch (PDOException $e) { + echo '
Have a big problem
'; + 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 '
Have a big problem
'; + throw $e; + } + + $row = $stmt->fetch(PDO::FETCH_ASSOC) +?> +
+ +
+ +
+ +

+

+

+

+

+

+

+
+
+ +
+
No ID given to delete!
'; +} +?> +
+ + diff --git a/edit.php b/edit.php new file mode 100644 index 0000000..04b8e47 --- /dev/null +++ b/edit.php @@ -0,0 +1,110 @@ + + + + + + + +Edit ID + + +'; +//var_dump($_SESSION); +?> +

+Edit Record +
+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 '
Have a big problem
'; + 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 '
Have a big problem
'; + throw $e; + } + + $row = $stmt->fetch(PDO::FETCH_ASSOC) +?> +
+ +
+ +
+ +

+ +

+ +

+ +

+ +

+ +

+ +

+
+
+ +
+No ID given to edit!'; +} +?> +
+ + 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 @@ + + + + + + + + + +Add Record


+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 "
Have a big problem
"; + throw $e; + } +} + +if ($stmt->rowCount() > 0) { + + // Data received + + // Start Table + $html_table = '
'; + + // Table Header + $html_table .= ''; + $html_table .= ''; + $html_table .= ''; + $html_table .= ''; + $html_table .= '
SEQNAMEVERSIONCONFIGUREBUILDINSTALLNOTESURLEDIT
'; + + // Body + $html_table .= '
'; + + // Table Rows + while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { + $html_table .= ''; + $html_table .= ''; + $html_table .= ''; + $html_table .= ''; + $html_table .= ''; + $html_table .= ''; + $html_table .= ''; + $html_table .= ''; + $html_table .= ''; + $html_table .= ""; + $html_table .= ''; + } + + // End Table + $html_table .= '
'.$row['seq'].''.$row['name'].''.$row['version'].''.nl2br($row['configure']).''.nl2br($row['build']).''.nl2br($row['install']).''.nl2br($row['notes']).''.nl2br($row['url']).'Edit
'; + +} else { + // No Data received + echo "
Nothing!
"; +} + +$html_table .= ''; +echo $html_table; + +?> + +

+Valid HTML 4.01 Transitional +

+ + + diff --git a/list.php b/list.php new file mode 100644 index 0000000..1750a34 --- /dev/null +++ b/list.php @@ -0,0 +1,237 @@ + + + + + + + + + + + + +'; +//echo '$_SESSION' . var_dump($_SESSION) . '
'; +//echo '$_POST' . var_dump($_POST) . '
'; +?> + + Add Record

+
+ Select columns: + >Configure + >Build + >Install + >Setup + >Notes + >URL + +
+ +prepare($sql); + $stmt->execute(); +} catch (PDOException $e) { + echo '
Have a big problem
'; + throw $e; + echo "$e->getMessage()"; +} + +if ($stmt->rowCount() > 0) { + + // Data received + + + // Begin Table + $html_table = ''; + + // Table Header + $html_table .= ''; + $html_table .= ''; + if($cn){$html_table .= '';} + if($bl){$html_table .= '';} + if($ns){$html_table .= '';} + if($se){$html_table .= '';} + if($no){$html_table .= '';} + if($ur){$html_table .= '';} + $html_table .= ''; + + // Table Footer + $html_table .= ''; + $html_table .= ''; + if($cn){$html_table .= '';} + if($bl){$html_table .= '';} + if($ns){$html_table .= '';} + if($se){$html_table .= '';} + if($no){$html_table .= '';} + if($ur){$html_table .= '';} + $html_table .= ''; + + // Table Body + $html_table .= ''; + + // 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 .= ''; + $html_table .= ""; + $html_table .= ''; + $html_table .= ''; + $html_table .= ''; + if($cn){$html_table .= '';} + if($bl){$html_table .= '';} + if($ns){$html_table .= '';} + if($se){$html_table .= '';} + if($no){$html_table .= '';} + if($ur){$html_table .= '';} + $html_table .= ""; + + $html_table .= ''; + } + + // End Table Body + $html_table .= ''; + + // End Table + $html_table .= '
A8-3800 CLFS Server
EDITSEQNAMEVERSIONCONFIGUREBUILDINSTALLSETUPNOTESURLDELETE
EDITSEQNAMEVERSIONCONFIGUREBUILDINSTALLSETUPNOTESURLDELETE
Edit'.$rowseq.''.($rownm).''.($rowver).''.($rowcfg).''.($rowbld).''.($rownst).''.($rowset).''.($rownot).''.($rowurl).'Delete
'; + + //Output Table + echo $html_table; + +} else { + // No Data received + echo '
No data found!
'; +} +?> + + +

+ Valid HTML 4.01 Transitional +

+ + + diff --git a/openfile.php b/openfile.php new file mode 100644 index 0000000..1d7d9c1 --- /dev/null +++ b/openfile.php @@ -0,0 +1,36 @@ + + + + + + + +File List + + +

+Installed File List for + + +
+Name found'; + $myfile = fopen("/sources/installed-files/$name", "r") + or die("Unable to open file!"); + echo ""; + fclose($myfile); +} else { + echo '
No NAME given to list installed files!
'; +} +?> +
+ + diff --git a/sessionvars.php b/sessionvars.php new file mode 100644 index 0000000..8a17b9b --- /dev/null +++ b/sessionvars.php @@ -0,0 +1,61 @@ + + + + + + + + + + + + + diff --git a/test.php b/test.php new file mode 100644 index 0000000..354a94f --- /dev/null +++ b/test.php @@ -0,0 +1,29 @@ + + + + + + + + + +Add Record


+prepare($sql); + $stmt->execute(); +echo 'test'; +?> + +

+Valid HTML 4.01 Transitional +

+ + + -- cgit v1.2.3-54-g00ecf