Example #1
0
 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();
 }
Example #2
0
 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;
 }
Example #3
0
 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();
 }
Example #4
0
    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") {
                $sql = "SELECT cli_id FROM clients WHERE uname='{$username}'";
                $rawData = $gremlin->query($sql, true);
                $cliID = $rawData['cli_id'];
                $loggedInUser = $userID;
            }
        }
        #set up needed session vars and redirect into system
        $_SESSION['userID'] = $loggedInUser;
        $_SESSION['loggedIn'] = TRUE;
        $_SESSION['userType'] = $userType;
        header("Location: home.php");
Example #5
0
 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";
         }
     }
 }