public function __construct($regionID) { $gremlin = new Gremlin(); #load region's info from ID $sql = "SELECT * FROM regions WHERE reg_id='{$regionID}'"; $rawData = $gremlin->query($sql); extract($rawData); $this->regionID = $regionID; $this->companyID = $cmp_id; $this->name = $name; $this->city = $city; $this->state = $state; loadSites(); }
public function __construct($siteID) { $gremlin = new Gremlin(); #load sites's info from ID $sql = "SELECT * FROM sites WHERE site_id='{$siteID}'"; $rawData = $gremlin->query($sql); extract($rawData); $this->siteID = $siteID; $this->active = $actice; $this->name = $name; $this->address = $address; $this->city = $city; $this->state = $state; $this->zip = $zip; $this->fax = $fax; }
public function __construct($trayID) { $gremlin = new Gremlin(); #load tray's info from ID $sql = "SELECT * FROM trays WHERE tray_id='{$trayID}'"; $rawData = $gremlin->query($sql); extract($rawData); $this->trayID = $trayID; $this->name = $name; $this->companyID = $cmp_id; $this->teamID = $team_id; $this->atNow = $atnow; $this->userID = $usr_id; $this->siteID = $site_id; $this->storageID = $stor_id; $this->loanTeam = $loan_team; loadTags(); loadContents(); }
<?php # homeList.php # List view for the Athena homepage include_once "includes.php"; session_start(); $gremlin = new Gremlin(); $userID = $_SESSION['userID']; $userType = $_SESSION['userType']; $user = $gremlin->spawnPage($userID, $userType); $page = ""; $page .= $gremlin->buildMenu("{$user->uname}" . "'s Home - List", "homeList"); $script = "<script src='js/home.js'></script>"; $colTabRow = "<div class='colTabRow'>"; #open colTabRow $tabRow = "<div class='tabRowHeader'><h3>Calendar</h3></div>"; #tabRow $tabRow .= "<div id='tab1Button' onclick='tab1Toggle()' class='tabSelected'>All Events</div><div id='tab2Button' class='tabUnselected' onclick='tab2Toggle()'>My Events</div>"; $tabRow .= "</div>"; #end colTabRow $colTabRow .= $tabRow; #menu bar with date selection stuff $dateMenuBar = "<div class='dateMenuBar'>"; #open dateMenuBar #this is where we figure out what date to show and display it in the date box $timeOffset = 0; # To calculate week range: # 1. find Sunday's date relative to now. # 2. calculate number of weeks offset based in GET parameter # 3. add number of weeks to Sunday if (isset($_GET['offset'])) {
<?php #Index.php #Main site login page include_once "includes.php"; $error = ""; #check for login session_start(); //session_destroy(); if (!empty($_SESSION)) { header("Location: home.php"); die; } if (isset($_POST['userName'])) { $gremlin = new Gremlin(); $username = $_POST['userName']; $rawPW = $_POST['pwd']; #check inputted password $userType = User::checkPassword($username, $rawPW); if ($userType != "not found") { #login successful //session_start(); #find user's ID if ($userType == "user") { $sql = "SELECT usr_id FROM users WHERE uname='{$username}'"; echo $sql; $rawData = $gremlin->query($sql, true); $userID = $rawData['usr_id']; $loggedInUser = $userID; } else { if ($userType == "client") {
<?php #home.php #this is the main screen for logged-in users #includes calendar screen and, menu bar, notifications, colTabRow, 2 tabs, 2 col[3:1] # #Col 1: 2 tabs { "All Events", "My Events" } # | # |-"All Events": List of all events relating to user's team. # | # |-"My Events": List of all tray events relating directly to user. # #Col 2: Notifications include_once "includes.php"; session_start(); $gremlin = new Gremlin(); $userID = $_SESSION['userID']; $userType = $_SESSION['userType']; $user = $gremlin->spawnPage($userID, $userType); $page = ""; $page .= $gremlin->buildMenu("{$user->uname}" . "'s Home"); #build colTabRow $colTabRow = "<div class='colTabRow'>"; #open colTabRow ########START DUMMY $dmyTabRow = "<div class='tabRowHeader'><h3>Calendar</h3></div>"; #dmyTabRow $dmyTabRow .= "<div id='tab1Button' class='selected'>All Events</div><div id='tab2Button' class='unselected'>My Events</div>"; $dmyTabRow .= "</div>"; #end dmyTabRow $colTabRow .= $dmyTabRow;
public static function checkPassword($username, $rawPW) { $gremlin = new Gremlin(); #salting password $pass = "******"; #all passwords should be encoded through md5() $pass = md5($pass); #first, look to see if person logging in is a user, and check their permissions $sql = "SELECT usr_id FROM users WHERE uname='{$username}' AND pwd='{$pass}'"; $rawResult = $gremlin->query($sql, true); if (!empty($rawResult)) { #user found! return "user"; } else { #user not found, check to see if it's a client $sql = "SELECT usr_id FROM clients WHERE uname='{$username}' AND pwd='{$pass}'"; $rawResult = $gremlin->query($sql, true); if (!empty($rawResult)) { #client found! return "client"; } else { #invalid username/password return "not found"; } } }
<?php #home.php #this is the main screen for logged-in users #includes calendar screen and, menu bar, notifications, colTabRow, 2 tabs, 2 col[3:1] # #Col 1: 2 tabs { "All Events", "My Events" } # | # |-"All Events": List of all events relating to user's team. # | # |-"My Events": List of all tray events relating directly to user. # #Col 2: Notifications include_once "includes.php"; session_start(); $gremlin = new Gremlin(); $userID = $_SESSION['userID']; $userType = $_SESSION['userType']; $user = $gremlin->spawnPage($userID, $userType); $page = ""; $page .= $gremlin->buildMenu("{$user->uname}" . "'s Home", "home"); $script = "<script src='js/home.js'></script>"; #build colTabRow $colTabRow = "<div class='colTabRow'>"; #open colTabRow $tabRow = "<div class='tabRowHeader'><h3>Calendar</h3></div>"; #tabRow $tabRow .= "<div id='tab1Button' onclick='tab1Toggle()' class='tabSelected'>All Events</div><div id='tab2Button' class='tabUnselected' onclick='tab2Toggle()'>My Events</div>"; $tabRow .= "</div>"; #end colTabRow $colTabRow .= $tabRow;