public function ZoekTijd() { require_once "/Classes/databaseHandler.class.php"; $Database = new Database(); require_once "/Classes/calculatetime.php"; $calculatetime = new calculatetime(); $Database->query('SELECT fileName, name FROM wedstrijden WHERE name=?'); $Database->bind(1, $_GET['wedstrijd']); $resultSet = $Database->single(); if (isset($_GET['startnummer']) || isset($_GET['naam'])) { include 'Classes/PHPExcel/IOFactory.php'; $inputFileName = 'excel/' . $resultSet['fileName']; try { $inputFileType = PHPExcel_IOFactory::identify($inputFileName); $objReader = PHPExcel_IOFactory::createReader($inputFileType); $objPHPExcel = $objReader->load($inputFileName); } catch (Exception $e) { die('Er is een fout opgetreden met bestand "' . pathinfo($inputFileName, PATHINFO_BASENAME) . '": ' . $e->getMessage()); } $sheet = $objPHPExcel->getSheet(0); $highestRow = $sheet->getHighestRow(); $highestColumn = $sheet->getHighestColumn(); for ($row = 1; $row <= $highestRow; $row++) { $rowData[] = $sheet->rangeToArray('A' . $row . ':' . $highestColumn . $row, NULL, TRUE, FALSE)[0]; } if (isset($_GET['startnummer']) && $_GET['startnummer'] == !null) { $Startnummer = $_GET['startnummer']; $key = array_search($Startnummer, array_column($rowData, 0)); } if (isset($_GET['naam']) && $_GET['naam'] == !null) { $Naam = $_GET['naam']; $key = array_search($Naam, array_column($rowData, 1)); } $this->Startnummer = $rowData[$key][0]; $this->Naam = $rowData[$key][1]; $this->Woonplaats = $rowData[$key][2]; $this->Geboortedatum = $rowData[$key][3]; $this->Geslacht = $rowData[$key][4]; $this->Wedstrijdnaam = $resultSet['name']; $cell = $sheet->getCellByColumnAndRow(5, $key + 1); $cell_value = PHPExcel_Style_NumberFormat::toFormattedString($cell->getCalculatedValue(), 'hh:mm:ss'); $this->VideoTijd = $calculatetime->GetPlayerTime($cell_value); $_GET['startnummer'] = $this->Startnummer; } }
function getByMuseum($museum_id, $today) { global $api_response; global $api_response_code; try { $database = new Database(); $database->query("SELECT * FROM exhibitions_info WHERE end_date >= :today AND museum_id = :museum_id ORDER BY start_date ASC"); $database->bind(':today', $today); $database->bind(':museum_id', $museum_id); $rows = array(); $rows = $database->resultset(); $database = null; if ($rows == null) { //not found any exhibitions return error $api_response = $api_response_code[5]; } else { $api_response = $api_response_code[1]; } return $rows; } catch (PDOException $e) { $database = null; $api_response = $api_response_code[0]; //die( "Query failed: " . $e->getMessage() ); return null; } }
public function mainP() { $sen = 0; $db = new Database(); foreach ($this->sentences as $sentence) { $highest = 0; $words = array(); $words = explode(" ", $sentence); foreach ($words as $word) { if (!in_array(strtolower($word), $this->stopwords)) { //Fetching the meaning definition of the senses From the WordNet $db->query("SELECT * from words where lemma like :word"); $db->bind("word", $word); $wordid = $db->single()->wordid; $db->query("SELECT * from senses where wordid like :wordid"); $db->bind("wordid", $wordid); $resulta2 = $db->resultset(); foreach ($resulta2 as $row) { $synsetid = $row->synsetid; $sample2[] = $synsetid; $title = $row->wordid . " " . $row->senseid; } $db->query("select * from synsets where synsetid like :sample"); $db->bind("sample", $sample2[0]); $resulta3 = $db->resultset(); unset($sample2[0]); for ($i = 0; $i < count($sample2) + 1; $i++) { ${result_A . $i} = $sample2[$i]; ${lexdomains_var . $i} = $lexdomains[$i]; $db->query("select * from synsets where synsetid like :sample"); $db->bind("sample", ${result_A . $i}); ${result . $i} = $db->resultset(); foreach (${result . $i} as $row) { ${pos . $i} = $row->pos; if (${pos . $i} == "s") { ${pos . $i} = "satellite adj"; } $def = $row->definition; $def = preg_replace('/[^a-zA-Z0-9_ -]/s', '', $def); $definition = array(); $definition = explode(" ", $def); $frequency = $this->frequency($definition); if ($frequency > $highest) { $highest = $frequency; } } } $sample2 = array(); } } $this->frequencies[] = $highest; $this->sentence_count[] = $sen; $sen++; } }
public function renderSearch() { require_once "/Classes/databaseHandler.class.php"; $Database = new Database(); $Database->query('SELECT fileName, name, date FROM wedstrijden'); $resultSet = $Database->single(); print ' </div > <div id = "clickTable" class="container" > <table id = "myTable" class="table" > <thead> <tr> <th> Startnr <i class="fa fa-sort" ></i></th> <th> Wedstrijd <i class="fa fa-sort" ></i></th> <th> Naam <i class="fa fa-sort" ></i></th> <th> Woonplaats <i class="fa fa-sort" ></i></th> <th> Geboortedatum <i class="fa fa-sort" ></i></th> <th> Geslacht</th > <th> Netto tijd <i class="fa fa-sort" ></i></th> <th> Onderdeel <i class="fa fa-sort" ></i> </th> <th> Beeld</th> </tr></thead ><tbody> '; $Database->query('SELECT * FROM tijden WHERE Naam LIKE ?'); if (!isset($_GET['show'])) { $Database->bind(1, "%" . $_POST['naam'] . "%"); $result = $Database->resultset(); if (empty($result)) { echo "Deelnemer niet gevonden."; } foreach ($result as $data) { $Database->query('SELECT fileName, name, date FROM wedstrijden WHERE wedstrijdID=?'); $Database->bind(1, $data['fk_wedstrijdID']); $resultSet = $Database->single(); print ' <tr><td> ' . $data['Startnummer'] . ' </td> '; print '<td> ' . $resultSet['name'] . ' </td> '; print '<td> ' . $data['Naam'] . ' </td> '; print '<td> ' . $data['Woonplaats'] . ' </td> '; print '<td> ' . $data['Geboortedatum'] . ' </td> '; echo "<td>"; if ($data['Geslacht'] == "V") { echo ' <i class="fa fa-female" ></i> '; } else { echo '<i class="fa fa-male" ></i> '; } echo "</td>"; print '<td> ' . $data['NettoTijd'] . ' </td> '; print '<td> ' . $data['Onderdeel'] . ' </td> '; print "<td><a class='fa fa-line-chart' href='?statistieken&startnummer=" . $data['Startnummer'] . "&eventid=" . $data['fk_wedstrijdID'] . "'></a>"; print " <a class='fa fa-video-camera' href='?newplayer&wedstrijd=" . $resultSet['name'] . "&naam=& startnummer=" . $data['Startnummer'] . "'></a>"; print " <a class='fa fa-camera' </a> "; print " <a class='fa fa-certificate' target='_blank' href='https://uitslagensoftware.nl/certificaat_3.php?event_id=2015083000294&S= " . $data['Startnummer'] . "'></a></td></tr>"; } } }
public function regi() { $database = new Database(); $database->query("INSERT INTO users VALUES (Null,'" . $this->Login . "', '" . $this->Password . "', '" . $this->Email . "', now(),now(),'unblock')"); $database->bind(':Id', Null); $database->bind(':Login', $this->Login); $database->bind(':Password', $this->Password); $database->bind(':Email', $this->Email); $database->bind(':blockunblock', 'unblock'); $database->execute(); //$query = "INSERT INTO users VALUES (Null,'".$this->Login."', '".$this->Password."', '".$this->Email."', now(),now(),'unblock')"; return $query; }
function userPostCount($user_id) { $db = new Database(); $db->query("SELECT * FROM topics \n\t\t\t\t\t WHERE user_id=:user_id"); $db->bind('user_id', $user_id); $db->resultSet(); $topic_count = $db->rowCount(); $db->query("SELECT * FROM replies\n\t\t\t\t WHERE user_id=:user_id"); $db->bind('user_id', $user_id); $db->resultSet(); $reply_count = $db->rowCount(); return $topic_count + $reply_count; }
function userPostCount($user_id) { $db = new Database(); //topic count $db->query("SELECT * FROM topics\n\t\t\t\tWHERE user_id = :user_id\n\t\t\t\t"); $db->bind(":user_id", $user_id); $rows = $db->resultset(); $topic_count = $db->rowCount(); //reply count $db->query("SELECT * FROM replies\n\t\t\t\tWHERE user_id = :user_id\n\t\t\t\t"); $db->bind(":user_id", $user_id); $rows = $db->resultset(); $reply_count = $db->rowCount(); return $topic_count + $reply_count; }
/** * User Login * * @param $username * @param $password * @return bool */ public function login($username, $password) { $this->db->query("SELECT * FROM users\n\t\t\t\tWHERE username = :username\n\t\t\t\tAND password = :password"); //Bind Values $this->db->bind(':username', $username); $this->db->bind(':password', $password); $row = $this->db->single(); //Check Rows if ($this->db->rowCount() > 0) { $this->setUserData($row); return true; } else { return false; } }
public function RemoveMatchingProcess($param) { parent::query('DELETE FROM dy_place_to_tag WHERE (pt_place_id = :place_id AND pt_tag_id = :tag_id)'); parent::bind(':place_id', $param['place_id']); parent::bind(':tag_id', $param['tag_id']); parent::execute(); }
public function ListDistrictProcess($param) { parent::query('SELECT * FROM dy_location_district WHERE ds_city_id = :city_id ORDER BY ds_id ASC'); parent::bind(':city_id', $param['city_id']); parent::execute(); return parent::resultset(); }
public function RenderPage() { require_once "/Classes/databaseHandler.class.php"; $Database = new Database(); print ' <title>Run2Day - Bannerbeheer</title> <h1>Bannerbeheer</h1> <table class="table"> <tr> <th>Toegevoegd aan</th> <th>Bestandsnaam</th> <th>Banner tekst</th> <th>Verwijderen</th> </tr> '; $Database->query('SELECT ID, fileName, fk_wedstrijdID, text FROM afbeeldingen'); $result = $Database->resultset(); foreach ($result as $key) { $Database->query('SELECT name FROM wedstrijden WHERE wedstrijdID=?'); $Database->bind(1, $key['fk_wedstrijdID']); $wedstrijd = $Database->single(); print '<tr><td>' . $wedstrijd['name'] . ' </td>'; print '<td>' . $key['fileName'] . ' </td>'; print '<td>' . $key['text'] . ' </td>'; print ' <td><a class="fa fa-trash-o" href="?dashboard&deletebanner=' . $key['ID'] . '"</td></tr>'; } print ' </table> <div class="col-md-4"> <h3>Banner afbeelding toevoegen</h3> <form action="../Classes/submitWedstrijd.php" method="POST" enctype="multipart/form-data"> <label for="usr">Banner toevoegen aan:</label> <select class="form-control" name="wedstrijd" id="wedstrijd">'; $Database->query('SELECT name, wedstrijdID FROM wedstrijden'); $result = $Database->resultset(); foreach ($result as $key) { print ' <option> ' . $key['name'] . '</option>'; } print ' </select> <div class="form-group"> <label for="usr">Banner tekst:</label> <input type="text" class="form-control" id="name" name="name" required> </div> <div class="form-group"> <label for="usr">Afbeelding:</label> <input type="file" name="file" id="file"> </div> <input type="submit" value="Opslaan"> <br><br> </form> </div> </div> </div> '; }
public function DeleteItem($id = 0) { $db = new Database(); $db->query("DELETE FROM menuitem WHERE `Id`=:id"); $db->bind(':id', $id); $db->execute(); header("Location: index.php"); }
public function EditItemsInOrderProcess($param) { parent::query('UPDATE dd_order_detail SET odt_amount = :amount WHERE odt_order_id = :order_id AND odt_product_id = :product_id'); parent::bind(':amount', $param['amount']); parent::bind(':order_id', $param['order_id']); parent::bind(':product_id', $param['product_id']); parent::execute(); }
public function DeletePhotoProcess($param) { parent::query('DELETE FROM dy_image WHERE (im_id = :image_id AND im_member_id = :member_id AND im_post_id = :post_id)'); parent::bind(':member_id', $param['member_id']); parent::bind(':image_id', $param['image_id']); parent::bind(':post_id', $param['post_id']); parent::execute(); }
function commentsCount($post_id) { $db = new Database(); $db->query("SELECT * FROM comments WHERE post_id = :post_id"); $db->bind(':post_id', $post_id); $rows = $db->resultset(); return $db->rowCount(); }
public function CommentAlreadyCheckingProcess($param) { parent::query('SELECT ac_id FROM dy_activity WHERE (ac_member_id = :member_id) AND (ac_action = "new_comment") AND (ac_to_post_id = :post_id)'); parent::bind(':member_id', $param['member_id']); parent::bind(':post_id', $param['post_id']); parent::execute(); return parent::single(); }
/** * Research by subject, min. date, and optionnally category and contact name * Returns a list of documents */ public function searchDocuments($searchDocumentsParams) { $db = new Database(); // LEFT JOIN: the doc may not have been linked to a sender or addressee yet // COALESCE: if the category_id IS NULL replace it with an empty string $sql = "SELECT r.res_id, r.subject, r.doc_date, m.category_id as category, " . "m.exp_contact_id, m.dest_contact_id, m.exp_user_id, " . "m.dest_user_id " . "FROM res_letterbox as r " . "LEFT JOIN mlb_coll_ext as m ON r.res_id = m.res_id " . "WHERE UPPER(r.subject) LIKE UPPER(:subject) AND " . "r.doc_date >= to_date(:mindocdate, 'YYYY-MM-DD') " . "AND COALESCE(m.category_id, '') like :category " . "ORDER BY r.doc_date DESC;"; /********************* Note : in the version 1.5.1 the following lines must be adapted: the "query" method has been modified and the "bind" method has been deleted *********************/ $db->query($sql); // prepared request $db->bind(":subject", "%{$searchDocumentsParams->subject}%"); // the date is managed as a string $db->bind(':mindocdate', $searchDocumentsParams->min_doc_date); if (isset($searchDocumentsParams->category) && !is_null($searchDocumentsParams->category) && $searchDocumentsParams->category != "") { $db->bind(":category", $searchDocumentsParams->category); } else { // match all the categories (even NULL) $db->bind(":category", "%"); } $res = $db->resultset(); // array of objects OR null // add the information about the contact (sender or addressee) $final_res = array(); foreach ($res as $current) { if (!is_null($current['exp_contact_id']) || !is_null($current['dest_contact_id'])) { $this->get_external_contact($db, $current); } else { if (!is_null($current['exp_user_id']) || !is_null($current['dest_user_id'])) { $this->get_internal_contact($db, $current); } else { $current['contact'] = ''; } } // remove the unused data unset($current['exp_contact_id']); unset($current['dest_contact_id']); unset($current['exp_user_id']); unset($current['dest_user_id']); array_push($final_res, $current); } // if the user wants to search by contact name we filter the data return $this->filter_by_contact($final_res, $searchDocumentsParams->contact); }
public function ListAmphurProcess($param) { echo 'province_id: ' . $param['province_id']; parent::query('SELECT * FROM th_amphur WHERE amphur_province_id = :province_id AND amphur_postcode != "00000"'); parent::bind(':province_id', $param['province_id']); parent::execute(); $dataset = parent::resultset(); return $dataset; }
/** * Delete Comments * * @param int $id * @return bool */ public function deleteComment($id) { $this->db->query("DELETE FROM comments \n\t\t\t\tWHERE id = :id"); $this->db->bind(':id', $id); //Execute if ($this->db->execute()) { return true; } else { return false; } }
function userPostCount($user_id) { $db = new Database(); $db->query('SELECT * FROM topics WHERE user_id = :user_id '); $db->bind(':user_id', $user_id); //Assign Rows $rows = $db->resultset(); //Get Count $topic_count = $db->rowCount(); $db->query('SELECT * FROM replies WHERE user_id = :user_id '); $db->bind(':user_id', $user_id); //Assign Rows $rows = $db->resultset(); //Get Count $reply_count = $db->rowCount(); return $topic_count + $reply_count; }
public function CheckingBankTransferProcess($param) { parent::query('SELECT mf_id FROM dd_money_transfer WHERE mf_to_bank = :bank_id'); parent::bind(':bank_id', $param['bank_id']); parent::execute(); $dataset = parent::single(); if (empty($dataset['mf_id'])) { return true; } else { return false; } }
public function __construct($patNum) { //check if patient table already exists $database = new Database(); $database->query('SELECT TableNum, Discharged FROM patients WHERE HosNum = :num'); $database->bind(':num', $patNum); $row = $database->single(); if ($row) { } else { add(); } }
public function UpdateReadProcess($param) { parent::query('SELECT pd_read FROM dd_product WHERE pd_id = :product_id'); parent::bind(':product_id', $param['product_id']); parent::execute(); $data = parent::single(); $read = $data['pd_read'] + 1; parent::query('UPDATE dd_product SET pd_read = :read,pd_visit_time = :visit_time WHERE pd_id = :product_id'); parent::bind(':product_id', $param['product_id']); parent::bind(':read', $read); parent::bind(':visit_time', date('Y-m-d H:i:s')); parent::execute(); }
public function CountNotificationProcess($param) { parent::query('SELECT COUNT(ac_id) FROM dy_activity LEFT JOIN dy_post ON ac_to_post_id = po_id LEFT JOIN dy_member ON ac_member_id = me_id LEFT JOIN dy_comment ON ac_to_comment_id = cm_id WHERE (ac_action = "new_comment" OR ac_action = "thanks_post") AND (po_member_id = :member_id) AND (ac_member_id != :member_id) AND (ac_status = "unread")'); parent::bind(':member_id', $param['member_id']); parent::execute(); $data = parent::single(); return $data['COUNT(ac_id)']; }
function topicCount($category_id) { if ($category_id == null) { $topicCount = new Topic(); return $topicCount->getTotalTopics(); } else { $db = new Database(); $db->query("SELECT * FROM topics WHERE category_id = :category_id"); $db->bind(':category_id', $category_id); $row = $db->resultset(); $count = $db->rowCount(); return $count; } }
public function saveToDB($product_id, $action) { if (!$_SESSION) { session_start(); } if (isset($_SESSION['user_id'])) { $user_id = $_SESSION['user_id']; } else { $user_id = null; } $database = new Database(); $database->query('INSERT INTO activity_statistics ( product_id, action, ip_address, browser, user_id) VALUES (:product_id,:action,:ip_address,:browser,:user_id)'); $database->bind(':product_id', $product_id); $database->bind(':action', $action); $database->bind(':ip_address', $_SERVER['REMOTE_ADDR']); $database->bind(':browser', $_SERVER['HTTP_USER_AGENT']); $database->bind(':user_id', $user_id); if ($database->execute()) { return true; } return false; }
function isLoggedIn() { if (!empty($_SESSION['user_id'])) { $db = new Database(); $db->query("SELECT username,about FROM users WHERE id=:u_id"); $db->bind("u_id", $_SESSION['user_id']); $result = $db->single(); $_SESSION['username'] = $result->username; $_SESSION['details'] = $result->about; return true; } else { return false; } }
public function CreateImageProcess($param) { parent::query('INSERT INTO dd_image(im_product_id,im_member_id,im_caption,im_filename,im_format,im_create_time,im_update_time,im_type,im_status) VALUE(:product_id,:member_id,:caption,:filename,:format,:create_time,:update_time,:type,:status)'); parent::bind(':product_id', $param['product_id']); parent::bind(':member_id', $param['member_id']); parent::bind(':caption', $param['caption']); parent::bind(':filename', $param['filename']); parent::bind(':format', $param['format']); parent::bind(':create_time', date('Y-m-d H:i:s')); parent::bind(':update_time', date('Y-m-d H:i:s')); parent::bind(':type', $param['type']); parent::bind(':status', $param['status']); parent::execute(); return parent::lastInsertId(); }
public function getDetailsByUsername($username) { $database = new Database(); $database->query("SELECT * FROM engineers WHERE sAMAccountName = :username"); $database->bind(":username", $username); $row = $database->single(); // if no results return empty object if ($database->rowCount() == 0) { return null; } // else populate opbject with db results $userObject = new stdClass(); $userObject->sAMAccountName = $row['sAMAccountName']; $userObject->engineerLevel = $row['engineerLevel']; $userObject->idengineers = $row['idengineers']; $userObject->superuser = $row['superuser']; $userObject->helpdesk = $row['helpdesk']; $userObject->localHash = $row['localLoginHash']; return $userObject; }
public function GetPlayerTime($cell_value) { require_once "databaseHandler.class.php"; $Database = new Database(); $Database->query('SELECT videoOffset, first_runner FROM cams WHERE fk_wedstrijdID=?'); $Database->bind(1, $_GET['eventid']); $result = $Database->single(); $result['first_runner'] . '<br>'; $cell_value . '<br>'; $Offset = $this->ConvertToSeconds($result['videoOffset']); //00:00 $FirstRunner = $this->ConvertToSeconds($result['first_runner']) . '<br>'; //00:00 $LoopTijd = $this->ConvertToSeconds($cell_value) . '<br>'; //00:00 $tijd = $LoopTijd - $FirstRunner + $Offset; //secs $tijd . '<br>'; $this->ConvertTimeToVimeo($tijd) . "<br>"; return $this->ConvertTimeToVimeo($tijd); }