function selectDB($table) { $sql = "SELECT * "; $sql .= "FROM {$table};"; $db = new DbUtilities(); $employeeCollection = $db->getDataset($sql); return $employeeCollection; }
<?php session_start(); if (!isset($_SESSION["userID"]) or $_SESSION["userID"] == null or $_SESSION["userID"] == "" or $_SESSION["userID"] == "INVALID") { //No session data } else { //logged in! require "../classes/dbutils.php"; $userID = $_SESSION["userID"]; $sql = "SELECT * "; $sql .= "FROM srp63.character WHERE FK_userID = '" . $userID . "';"; $db = new DbUtilities(); $charCollection = $db->getDataset($sql); $charData = '"character" : ' . json_encode($charCollection); echo '{' . $charData . '}'; } ?>
<?php require "../classes/dbutils.php"; $stuff = $_POST["sendThis"]; $sql = "SELECT * "; $sql .= "FROM Applicant;"; //. "WHERE attemptID = '" . $attemptID . "' AND userID = '" . $userID . "';"; $db = new DbUtilities(); $dataCollection = $db->getDataset($sql); $appData = '"applicant" : ' . json_encode($dataCollection);
Posts </td> </tr> <?php $threadArray = array(); $postArray = array(); $threadCount = 0; $postCountArray; $style = 0; $sql = "SELECT * FROM topic"; $db = new DbUtilities(); $collectionList = $db->getDataset($sql); $newSql = "SELECT * FROM topic JOIN thread ON topic.topicID = thread.FK_topicID JOIN post on thread.threadID = post.FK_threadID;"; $db2 = new DbUtilities(); $tCollectionList = $db2->getDataset($newSql); foreach ($tCollectionList as &$row2) { if (!in_array($row['threadID'], $threadArray)) { //returns the index of the first substring found. if no index then return -1 array_push($threadArray, $row['threadID']); $threadCount += 1; } } foreach ($collectionList as &$row) { if ($style == 0) { echo '<tr class="rowStyle1">'; $style = 1; } else { echo '<tr class="rowStyle2">'; $style = 0; }
<?php require "../classes/dbutils.php"; $eventID = $_POST["eventID"]; $sql = "SELECT * FROM message WHERE FK_eventID = '" . $eventID . "';"; $db = new DbUtilities(); $messCollection = $db->getDataset($sql); $messData = '"message" : ' . json_encode($messCollection); echo '{' . $messData . '}';
<?php require "../classes/dbutils.php"; $placeID = $_POST["placeID"]; $sql = "SELECT * FROM point WHERE FK_placeID = '{$placeID}';"; $db = new DbUtilities(); $pointCollection = $db->getDataset($sql); $pointData = '"point" : ' . json_encode($pointCollection); echo '{' . $pointData . '}'; ?>
<?php require "../classes/dbutils.php"; $FK_placeID = $_POST["FK_placeID"]; $sql = "SELECT * "; $sql .= "FROM srp63.places WHERE placeID = '" . $FK_placeID . "';"; $db = new DbUtilities(); $placeCollection = $db->getDataset($sql); $placeData = '"places" : ' . json_encode($placeCollection); echo '{' . $placeData . '}'; ?>
<?php session_start(); include "base.php"; require "classes/dbutils.php"; $email = $_POST["email"]; $password = $_POST["password"]; $hashPass = md5($password); $sql = "SELECT userID,email,displayName,type FROM user WHERE email='{$email}' AND passW='{$hashPass}';"; $db = new DbUtilities(); //$db->getDatasetWithParams($sql, "ss", array($email, $hashPass)); //echo($db->getDataset($sql)); $collectionList = $db->getDataset($sql); if (count($collectionList) > 0) { foreach ($collectionList as &$row) { $_SESSION["userID"] = $row["userID"]; $_SESSION["email"] = $row["email"]; $_SESSION["displayName"] = $row["displayName"]; $_SESSION["type"] = $row["type"]; echo "VALID"; } // print_r($_SESSION); // Change this to redirect to whatever page is the first landing page for the application } else { $_SESSION["userID"] = "INVALID"; $_SESSION["email"] = "INVALID"; $_SESSION["displayName"] = "INVALID"; $_SESSION["type"] = "INVALID"; echo "INVALID"; // Authentication failed - redirect to auth failed page // You need to update that page
echo '</div>'; echo '<div class="col-md-1">'; if ($param6 != "") { echo $row[$param6]; } echo '</div>'; echo '<div class="col-md-1">'; if ($param7 != "") { echo $row[$param7]; } echo '</div>'; echo '</div>'; } } $db = new DbUtilities(); $result = $db->getDataset($sql); ?> </div> </div> <footer><a href="../homework.html">Back</a></footer> </article> <nav class="leftPane"> <!-- For my reference: leave blank or insert navbar --> </nav> <aside class="rightPane"> <!-- For my reference: leave blank or content can go here --> </aside> </div> </body>