public function get($con) { $sql_query = sql_getEmployee($con, $this->id); if ($sql_query->execute()) { $sql_query->store_result(); $result = sql_get_assoc($sql_query); foreach ($result as $row) { $this->name = $row['USER_NAME']; $this->un = $row['USER_UN']; $sql_query = sql_getEmployeesLists($con, $this->id, date('Y-m-d')); if ($sql_query->execute()) { $sql_query->store_result(); $result = sql_get_assoc($sql_query); foreach ($result as $row) { $list = new CheckList(); $list->id = $row['LIST_ID']; $list->name = $row['LIST_NAME']; array_push($this->lists, $list); } } } } else { die('There was an error running the query [' . $con->error . ']'); } }
public function get($con) { $sql_query = sql_getChecklist($con, $this->id); if ($sql_query->execute()) { $sql_query->store_result(); $result = sql_get_assoc($sql_query); foreach ($result as $row) { $this->name = $row['LIST_NAME']; $this->numassigned = $row['LIST_NUMASSIGNED']; $this->employees = $row['LIST_EMPLOYEES']; $sql_query = sql_getChecklistItems($con, $this); if ($sql_query->execute()) { $sql_query->store_result(); $result = sql_get_assoc($sql_query); foreach ($result as $row) { $item = new ChecklistItem(); $item->id = $row['LISTITEM_ID']; $item->desc = $row['LISTITEM_DESC']; if (isset($this->userid)) { $item->done = $row['LISTITEM_DONE']; } array_push($this->items, $item); } } else { die('There was an error running the query [' . $con->error . ']'); } } } else { die('There was an error running the query [' . $con->error . ']'); } }
public function get($con) { $con->query("SET SQL_BIG_SELECTS = 1;"); $sql_query = sql_getFileGallery($con, $this->userid, $this->corrid); if ($sql_query->execute()) { $sql_query->store_result(); $result = sql_get_assoc($sql_query); foreach ($result as $row) { $ADK_GALLERY_ITEM = new GalleryItem(); $ADK_GALLERY_ITEM->id = $row['ADK_FILE_ID']; $ADK_GALLERY_ITEM->name = $row['ADK_FILE_NAME']; $ADK_GALLERY_ITEM->savename = $row['ADK_FILE_SAVENAME']; $ADK_GALLERY_ITEM->desc = $row['ADK_FILE_DESC']; $ADK_GALLERY_ITEM->size = $row['ADK_FILE_SIZE']; $ADK_GALLERY_ITEM->type = $row['ADK_FILE_TYPE']; $ADK_GALLERY_ITEM->peaks = $row['ADK_FILE_PEAKS'] ? $row['ADK_FILE_PEAKS'] : 'Private Message'; $ADK_GALLERY_ITEM->username = $row['ADK_USER_USERNAME']; array_push($this->files, $ADK_GALLERY_ITEM); switch ($ADK_GALLERY_ITEM->getType()) { case 'photo': array_push($this->photos, $ADK_GALLERY_ITEM); break; case 'video': array_push($this->videos, $ADK_GALLERY_ITEM); break; case 'doc': array_push($this->docs, $ADK_GALLERY_ITEM); } } } else { die('There was an error running the query [' . $con->error . ']'); } }
public function get($con) { $sql_query = sql_getEmployees($con); if ($sql_query->execute()) { $sql_query->store_result(); $result = sql_get_assoc($sql_query); foreach ($result as $row) { $employee = new Employee(); $employee->id = $row['USER_ID']; $employee->name = $row['USER_NAME']; $employee->un = $row['USER_UN']; $sql_query = sql_getEmployeesLists($con, $employee->id); if ($sql_query->execute()) { $sql_query->store_result(); $result = sql_get_assoc($sql_query); foreach ($result as $row) { $list = new Checklist(); $list->id = $row['LIST_ID']; $list->name = $row['LIST_NAME']; $list->date = $this->date; $list->userid = $employee->id; $sql_query = sql_getChecklistItems($con, $list); if ($sql_query->execute()) { $sql_query->store_result(); $result = sql_get_assoc($sql_query); foreach ($result as $row) { $item = new ChecklistItem(); $item->id = $row['LISTITEM_ID']; $item->desc = $row['LISTITEM_DESC']; $item->done = $row['LISTITEM_DONE']; array_push($list->items, $item); } } else { die('There was an error running the query [' . $con->error . ']'); } array_push($employee->lists, $list); } } else { die('There was an error running the query [' . $con->error . ']'); } $completedToday = true; foreach ($employee->lists as $list) { foreach ($list->items as $item) { if (!$item->done) { $completedToday = false; } } } $employee->completedtoday = $completedToday ? 'Yep' : 'Nope'; array_push($this->employees, $employee); } } else { die('There was an error running the query [' . $con->error . ']'); } }
public function get($con) { $sql_query = sql_getHikes($con, $this->userid); if ($sql_query->execute()) { $sql_query->store_result(); $result = sql_get_assoc($sql_query); foreach ($result as $row) { $ADK_HIKE = new Hike(); $ADK_HIKE->id = intval($row['ADK_HIKE_ID']); $ADK_HIKE->notes = $row['ADK_HIKE_NOTES']; $ADK_HIKE->datetime = $row['ADK_HIKE_DTE'] === null ? '--' : date("m/d/Y", strtotime($row['ADK_HIKE_DTE'])); $ADK_HIKE->ts = $row['ADK_HIKE_TS'] === null ? '--' : date("m/d/Y h:ia", strtotime($row['ADK_HIKE_TS'])); $ADK_HIKE->numpeaks = $row['ADK_HIKE_NUMPEAKS']; //peaks $peakNames = []; $sql_query = sql_getHikesPeaks($con, $ADK_HIKE->id); if ($sql_query->execute()) { $sql_query->store_result(); $result = sql_get_assoc($sql_query); foreach ($result as $row) { $ADK_PEAK = new Peak(); $ADK_PEAK->id = intval($row['ADK_PEAK_ID']); $ADK_PEAK->name = $row['ADK_PEAK_NAME']; $ADK_PEAK->height = $row['ADK_PEAK_HEIGHT']; $ADK_PEAK->datetime = $row['ADK_PEAK_DTE'] === null ? '--' : date("m/d/Y", strtotime($row['ADK_PEAK_DTE'])); array_push($peakNames, $ADK_PEAK->name); array_push($ADK_HIKE->peaks, $ADK_PEAK); } } else { die('There was an error running the query [' . $con->error . ']'); } $ADK_HIKE->label = join(', ', $peakNames); //files $sql_query = sql_getHikesFiles($con, $ADK_HIKE->id); if ($sql_query->execute()) { $sql_query->store_result(); $result = sql_get_assoc($sql_query); foreach ($result as $row) { $ADK_FILE = new File(); $ADK_FILE->id = intval($row['ADK_FILE_ID']); $ADK_FILE->name = $row['ADK_FILE_NAME']; $ADK_FILE->desc = $row['ADK_FILE_DESC']; $ADK_FILE->size = intval($row['ADK_FILE_SIZE']); $ADK_FILE->type = $row['ADK_FILE_TYPE']; array_push($ADK_HIKE->files, $ADK_FILE); } } array_push($this->hikes, $ADK_HIKE); } } else { die('There was an error running the query [' . $con->error . ']'); } }
public function get($con) { $sql_query = sql_getUser($con, $this->id); if ($sql_query->execute()) { $sql_query->store_result(); $result = sql_get_assoc($sql_query); foreach ($result as $row) { $this->grp = intval($row['USER_GRP']); $this->name = $row['USER_NAME']; $this->un = $row['USER_UN']; } } else { die('There was an error running the query [' . $con->error . ']'); } }
public function get($con) { $sql_query = sql_getTemplate($con, $this->id); if ($sql_query->execute()) { $sql_query->store_result(); $result = sql_get_assoc($sql_query); foreach ($result as $row) { $this->userid = intval($row['ADK_USER_ID']); $this->name = $row['ADK_MSG_TMPL_NAME']; $this->content = $row['ADK_MSG_TMPL_CONTENT']; $this->datetime = $row['ADK_MSG_TMPL_DTE']; } } else { die('There was an error running the query [' . $con->error . ']'); } }
public function get($con) { $sql_query = sql_getHikersPeaks($con, $this->userid); if ($sql_query->execute()) { $sql_query->store_result(); $result = sql_get_assoc($sql_query); foreach ($result as $row) { $ADK_HIKERS_PEAK = new HikersPeak(); $ADK_HIKERS_PEAK->peakname = $row['ADK_PEAK_NAME']; $ADK_HIKERS_PEAK->datetime = $row['ADK_HIKE_DTE']; array_push($this->hikerspeaks, $ADK_HIKERS_PEAK); } } else { die('There was an error running the query [' . $con->error . ']'); } }
public function get($con) { $sql_query = sql_getPeaks($con); if ($sql_query->execute()) { $sql_query->store_result(); $result = sql_get_assoc($sql_query); foreach ($result as $row) { $peak = new Peak(); $peak->id = intval($row['ADK_PEAK_ID']); $peak->name = $row['ADK_PEAK_NAME']; $peak->height = $row['ADK_PEAK_HEIGHT']; array_push($this->peaks, $peak); } } else { die('There was an error running the query [' . $con->error . ']'); } }
public function get($con) { $sql_query = sql_getHiker($con, $this->id); if ($sql_query->execute()) { $sql_query->store_result(); $result = sql_get_assoc($sql_query); foreach ($result as $row) { $this->corrid = $row['ADK_HIKER_CORR_ID']; $this->corrname = $row['ADK_HIKER_CORR_NAME']; $this->photoid = intval($row['ADK_HIKER_PHOTO_ID']); $this->username = $row['ADK_USER_USERNAME']; $this->name = $row['ADK_USER_NAME']; $this->email = $row['ADK_USER_EMAIL']; $this->phone = $row['ADK_HIKER_PHONE']; $this->age = $row['ADK_HIKER_AGE'] != 0 ? $row['ADK_HIKER_AGE'] : ''; $this->sex = $row['ADK_HIKER_SEX']; $this->address1 = $row['ADK_HIKER_ADDRESS1']; $this->address2 = $row['ADK_HIKER_ADDRESS2']; $this->city = $row['ADK_HIKER_CITY']; $this->state = $row['ADK_HIKER_STATE']; $this->zip = preg_replace('/(\\d{5})(\\d{4})/i', '-', $row['ADK_HIKER_ZIP']); $this->country = $row['ADK_HIKER_COUNTRY']; $this->info = $row['ADK_HIKER_PERSONALINFO']; $this->numclimbed = intval($row['ADK_HIKER_NUMCLIMBED']); $this->numpeaks = intval($row['ADK_HIKER_NUMPEAKS']); $this->percent = round($this->numpeaks / 46 * 100); $this->lastactive = $row['ADK_HIKER_LASTACTIVE_DTE']; $this->datetime = $row['ADK_HIKER_DTE']; } } else { die('There was an error running the query [' . $con->error . ']'); } }
public function get($con) { $sql_query = sql_getCorrespondent($con, $this->id); if ($sql_query->execute()) { $sql_query->store_result(); $result = sql_get_assoc($sql_query); foreach ($result as $row) { $this->id = intval($row['ADK_USER_ID']); $this->photoid = intval($row['ADK_CORR_PHOTO_ID']); $this->username = $row['ADK_USER_USERNAME']; $this->name = $row['ADK_USER_NAME']; $this->email = $row['ADK_USER_EMAIL']; $this->info = $row['ADK_CORR_PERSONALINFO']; $this->numhikers = $row['ADK_CORR_NUMHIKERS']; } } else { die('There was an error running the query [' . $con->error . ']'); } }
public function get($con) { $sql_query = sql_getUser($con, $this->id); if ($sql_query->execute()) { $sql_query->store_result(); $result = sql_get_assoc($sql_query); foreach ($result as $row) { $this->username = $row['ADK_USER_USERNAME']; $this->name = $row['ADK_USER_NAME']; $this->email = $row['ADK_USER_EMAIL']; } } else { die('There was an error running the query [' . $con->error . ']'); } }
public function get($con) { $sql_query = sql_getApplicant($con, $this->id); if ($sql_query->execute()) { $sql_query->store_result(); $result = sql_get_assoc($sql_query); foreach ($result as $row) { $this->username = $row['ADK_APPLICANT_USERNAME']; $this->name = $row['ADK_APPLICANT_NAME']; $this->email = $row['ADK_APPLICANT_EMAIL']; $this->phone = $row['ADK_APPLICANT_PHONE']; $this->age = $row['ADK_APPLICANT_AGE'] != 0 ? $row['ADK_APPLICANT_AGE'] : ''; $this->sex = $row['ADK_APPLICANT_SEX']; $this->address1 = $row['ADK_APPLICANT_ADDRESS1']; $this->address2 = $row['ADK_APPLICANT_ADDRESS2']; $this->city = $row['ADK_APPLICANT_CITY']; $this->state = $row['ADK_APPLICANT_STATE']; $this->zip = preg_replace('/(\\d{5})(\\d{4})/i', '-', $row['ADK_APPLICANT_ZIP']); $this->country = $row['ADK_APPLICANT_COUNTRY']; $this->info = $row['ADK_APPLICANT_PERSONALINFO']; $this->reqcorr = $row['ADK_APPLICANT_REQ_CORR']; $this->peaklist = ltrim($row['ADK_APPLICANT_PEAKLIST']); $sql_query = sql_getApplicantsPeaks($con, $this->id); if ($sql_query->execute()) { $sql_query->store_result(); $result = sql_get_assoc($sql_query); foreach ($result as $row) { $ADK_PEAK = new Peak(); $ADK_PEAK->id = intval($row['ADK_PEAK_ID']); $ADK_PEAK->name = $row['ADK_PEAK_NAME']; $ADK_PEAK->height = $row['ADK_PEAK_HEIGHT']; array_push($this->peaks, $ADK_PEAK); } } else { die('There was an error running the query [' . $con->error . ']'); } } } else { die('There was an error running the query [' . $con->error . ']'); } }
public function get($con) { $sql_query = sql_getMessage($con, $this); if ($sql_query->execute()) { $sql_query->store_result(); $result = sql_get_assoc($sql_query); foreach ($result as $row) { $this->fromid = intval($row['ADK_MESSAGE_FROM_USER_ID']); $this->fromname = $row['ADK_MESSAGE_FROM_NAME']; $this->fromusername = $row['ADK_MESSAGE_FROM_USERNAME']; $this->toid = intval($row['ADK_MESSAGE_TO_USER_ID']); $this->toname = $row['ADK_MESSAGE_TO_NAME']; $this->tousername = $row['ADK_MESSAGE_TO_USERNAME']; $this->title = $row['ADK_MESSAGE_TITLE']; $this->content = $row['ADK_MESSAGE_CONTENT']; $this->date = date("n/j/Y", strtotime($row['ADK_MESSAGE_DTE'])); $this->time = date('g:ia', strtotime($row['ADK_MESSAGE_DTE'])); $this->isread = $row['ADK_MESSAGE_READ'] == 1; $this->isfromhiker = intval($row['isFromHiker']); $this->isdraft = intval($row['ADK_MESSAGE_DRAFT']); $sql_query = sql_getMessageFiles($con, $this->id); if ($sql_query->execute()) { $sql_query->store_result(); $result = sql_get_assoc($sql_query); foreach ($result as $row) { $ADK_FILE = new File(); $ADK_FILE->id = intval($row['ADK_FILE_ID']); $ADK_FILE->name = $row['ADK_FILE_NAME']; $ADK_FILE->desc = $row['ADK_FILE_DESC']; $ADK_FILE->size = intval($row['ADK_FILE_SIZE']); array_push($this->files, $ADK_FILE); } } else { die('There was an error running the query [' . $con->error . ']'); } } } else { die('There was an error running the query [' . $con->error . ']'); } }
} if (empty($_POST['password'])) { header("Location: index?e=pw"); exit; } $ADK_USER_USERNAME = $_POST['username']; $ADK_USER_PASSWORD = md5($_POST['password']); $page = $_POST['page']; if ($page === 'index' || $page === 'login') { $page = ''; } $con = connect_db(); $sql_query = sql_login_check($con, $ADK_USER_USERNAME, $ADK_USER_PASSWORD); if ($sql_query->execute()) { $sql_query->store_result(); $result = sql_get_assoc($sql_query); foreach ($result as $row) { $ADK_USER = new User(); $ADK_USER->id = $row['ADK_USER_ID']; $ADK_USER->username = $row['ADK_USER_USERNAME']; $ADK_USER->usernameusergroupid = $row['ADK_USERGROUP_ID']; $ADK_USER->name = $row['ADK_USER_NAME']; $ADK_USER->email = $row['ADK_USER_EMAIL']; $ADK_USER->usergroupcde = $row['ADK_USERGROUP_CDE']; } } else { die('There was an error running the query [' . $con->error . ']'); } $con->close(); //If no user, exit if (!isset($ADK_USER)) {
public function get($con, $returnContent, $getThumb) { $sql_query = sql_getFile($con, $this->id); if ($sql_query->execute()) { $sql_query->store_result(); $result = sql_get_assoc($sql_query); foreach ($result as $row) { $this->id = $row['ADK_FILE_ID']; $this->name = $row['ADK_FILE_NAME']; $this->savename = $row['ADK_FILE_SAVENAME']; $this->size = $row['ADK_FILE_SIZE']; $this->type = $row['ADK_FILE_TYPE']; } } else { die('There was an error running the query [' . $con->error . ']'); } if ($returnContent && $this->savename != '') { if ($getThumb) { $file = '../uploads/thumb/' . $this->savename[0] . '/' . $this->savename[1] . '/' . $this->savename; } else { $file = '../uploads/' . $this->savename[0] . '/' . $this->savename[1] . '/' . $this->savename; } $fp = fopen($file, 'r'); if ($getThumb) { $this->size = filesize($file); } $this->content = fread($fp, $this->size); fclose($fp); } }