Exemplo n.º 1
0
 public static function GetSeqNextValue(DataAccess $dataaccess, $table_name, $col_name, $count = 1)
 {
     if ($count == 1) {
         $ds = $dataaccess->GetData("seq", "call p_seq_nextvalue(?, ?, 0, @nextvalue)", array((string) $table_name, (string) $col_name));
         return $ds["seq"]["rows"][0]["nextvalue"];
     } else {
         $ds = $dataaccess->GetData("seq", "call p_seq_batchvalue(?, ?, ?, 0, @nextvalue)", array((string) $table_name, (string) $col_name, (int) $count));
         return $ds["seq"]["rows"][0]["nextvalue"];
     }
 }
Exemplo n.º 2
0
 public static function userExist($user)
 {
     $dataAccess = new DataAccess();
     $data = $dataAccess->getUser($user);
     if (count($data) == 0) {
         return false;
     } else {
         return $data[0];
     }
 }
Exemplo n.º 3
0
 /**
  * execute and get the last insert id
  *
  * @param string $sql statement (INSERT INTO ...)
  *
  * @return int the last insert id or false if there is an error 
  */
 protected function updateAndGetLastId($sql)
 {
     if ($inserted = $this->update($sql)) {
         $inserted = $this->da->lastInsertId();
     }
     return $inserted;
 }
Exemplo n.º 4
0
 public function GetCategories()
 {
     if (!$this->Categories) {
         $this->Categories = DataAccess::GetCategoriesByUserID($this->ID);
     }
     return $this->Categories;
 }
Exemplo n.º 5
0
 public function Execute()
 {
     $viewData = array();
     $errors = array();
     if (Helper::IsLoggedInAdmin() && isset($_GET["loginAsUser"])) {
         // login as a certain user and redirect to his page
         if (Helper::LoginUserByUsername($_GET["loginAsUser"])) {
             Helper::Redirect("index.php?" . Helper::CreateQuerystring(getCurrentUser()));
         }
     }
     $viewData["Users"] = DataAccess::GetAllUsers(!Helper::IsLoggedInAdmin());
     $viewData["LastMapForEachUser"] = DataAccess::GetLastMapsForUsers("date");
     // last x maps
     $numberOfMaps = isset($_GET["lastMaps"]) && is_numeric($_GET["lastMaps"]) ? (int) $_GET["lastMaps"] : (isset($_GET["lastMaps"]) && $_GET["lastMaps"] == "all" ? 999999 : 10);
     $viewData["LastMaps"] = DataAccess::GetMaps(0, 0, 0, 0, null, $numberOfMaps, "createdTime", Helper::GetLoggedInUserID());
     // last x comments
     $numberOfComments = isset($_GET["lastComments"]) && is_numeric($_GET["lastComments"]) ? (int) $_GET["lastComments"] : (isset($_GET["lastComments"]) && $_GET["lastComments"] == "all" ? 999999 : 10);
     $viewData["LastComments"] = DataAccess::GetLastComments($numberOfComments, Helper::GetLoggedInUserID());
     $viewData["OverviewMapData"] = null;
     $categories = DataAccess::GetCategoriesByUserID();
     foreach ($viewData["LastMaps"] as $map) {
         $data = Helper::GetOverviewMapData($map, false, true, true, $categories);
         if ($data != null) {
             $viewData["OverviewMapData"][] = $data;
         }
     }
     if (isset($_GET["error"]) && $_GET["error"] == "email") {
         $errors[] = sprintf(__("ADMIN_EMAIL_ERROR"), ADMIN_EMAIL);
     }
     $viewData["Errors"] = $errors;
     return $viewData;
 }
Exemplo n.º 6
0
 public function GetUser()
 {
     if (!$this->User) {
         $this->User = DataAccess::GetUserByID($this->UserID);
     }
     return $this->User;
 }
Exemplo n.º 7
0
 public function GetCategory()
 {
     if (!$this->Category) {
         $this->Category = DataAccess::GetCategoryByID($this->CategoryID);
     }
     return $this->Category;
 }
Exemplo n.º 8
0
function executeDatabaseScripts()
{
    $allScripts = getScripts();
    $errors = array();
    foreach ($allScripts as $s) {
        // check whether scripts should be run
        if (isset($s["conditionFunction"])) {
            $f = $s["conditionFunction"];
            $runScripts = $f($s["conditionData"]);
        } else {
            $runScripts = true;
        }
        if ($runScripts) {
            foreach ($s["scripts"] as $script) {
                mysql_query($script);
                Helper::WriteToLog($script);
                $error = getMySQLErrorIfAny();
                if ($error) {
                    Helper::WriteToLog($error);
                    $errors[] = $error;
                }
            }
        }
    }
    if (count($errors) == 0) {
        DataAccess::SetSetting("DATABASE_VERSION", DOMA_VERSION);
    }
    return array("errors" => $errors);
}
Exemplo n.º 9
0
 /**
  * Get's a singleton instance of this object.
  *
  * @return object (PDO) singleton instance of this object.
  */
 public static function getInstance()
 {
     if (!self::$instance) {
         self::$instance = new PDO(DB_CONNECTION, DB_USER, DB_PASSWORD);
         self::$instance->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     }
     return self::$instance;
 }
Exemplo n.º 10
0
function getMapCornerPositionsAndRouteCoordinates($id)
{
    $map = new Map();
    $map->Load($id);
    $user = DataAccess::GetUserByID($map->UserID);
    $categories = DataAccess::GetCategoriesByUserID($user->ID);
    return Helper::GetOverviewMapData($map, true, false, false, $categories);
}
Exemplo n.º 11
0
 public function Execute()
 {
     $viewData = array();
     // no user specified - redirect to user list page
     if (!getCurrentUser()) {
         Helper::Redirect("users.php");
     }
     // user is hidden - redirect to user list page
     if (!getCurrentUser()->Visible) {
         Helper::Redirect("users.php");
     }
     // the requested map
     $map = new Map();
     $map->Load($_GET["map"]);
     if (!$map->ID) {
         die("The map has been removed.");
     }
     DataAccess::UnprotectMapIfNeeded($map);
     if (Helper::MapIsProtected($map)) {
         die("The map is protected until " . date("Y-m-d H:i:s", Helper::StringToTime($map->ProtectedUntil, true)) . ".");
     }
     if ($map->UserID != getCurrentUser()->ID) {
         die;
     }
     $viewData["Comments"] = DataAccess::GetCommentsByMapId($map->ID);
     $viewData["Name"] = $map->Name . ' (' . date(__("DATE_FORMAT"), Helper::StringToTime($map->Date, true)) . ')';
     // previous map in archive
     $previous = DataAccess::GetPreviousMap(getCurrentUser()->ID, $map->ID, Helper::GetLoggedInUserID());
     $viewData["PreviousName"] = $previous == null ? null : $previous->Name . ' (' . date(__("DATE_FORMAT"), Helper::StringToTime($previous->Date, true)) . ')';
     // next map in archive
     $next = DataAccess::GetNextMap(getCurrentUser()->ID, $map->ID, Helper::GetLoggedInUserID());
     $viewData["NextName"] = $next == null ? null : $next->Name . ' (' . date(__("DATE_FORMAT"), Helper::StringToTime($next->Date, true)) . ')';
     $size = $map->GetMapImageSize();
     $viewData["ImageWidth"] = $size["Width"];
     $viewData["ImageHeight"] = $size["Height"];
     DataAccess::IncreaseMapViews($map);
     $viewData["Map"] = $map;
     $viewData["BackUrl"] = isset($_SERVER["HTTP_REFERER"]) && basename($_SERVER["HTTP_REFERER"]) == "users.php" ? "users.php" : "index.php?" . Helper::CreateQuerystring(getCurrentUser());
     $viewData["Previous"] = $previous;
     $viewData["Next"] = $next;
     $viewData["ShowComments"] = isset($_GET["showComments"]) && ($_GET["showComments"] = true) || !__("COLLAPSE_VISITOR_COMMENTS");
     $viewData["FirstMapImageName"] = Helper::GetMapImage($map);
     if ($map->BlankMapImage) {
         $viewData["SecondMapImageName"] = Helper::GetBlankMapImage($map);
     }
     $viewData["QuickRouteJpegExtensionData"] = $map->GetQuickRouteJpegExtensionData();
     if (isset($viewData["QuickRouteJpegExtensionData"]) && $viewData["QuickRouteJpegExtensionData"]->IsValid) {
         $categories = DataAccess::GetCategoriesByUserID(getCurrentUser()->ID);
         $viewData["OverviewMapData"][] = Helper::GetOverviewMapData($map, true, false, false, $categories);
         $viewData["GoogleMapsUrl"] = "http://maps.google.com/maps" . "?q=" . urlencode(Helper::GlobalPath("export_kml.php?id=" . $map->ID . "&format=kml")) . "&language=" . Session::GetLanguageCode();
     }
     if (USE_3DRERUN == '1' && DataAccess::GetSetting("LAST_WORLDOFO_CHECK_DOMA_TIME", "0") + RERUN_FREQUENCY * 3600 < time()) {
         $viewData["RerunMaps"] = Helper::GetMapsForRerunRequest();
         $viewData["TotalRerunMaps"] = count(explode(",", $viewData["RerunMaps"]));
         $viewData["ProcessRerun"] = true;
     }
     return $viewData;
 }
Exemplo n.º 12
0
 private function getRoles()
 {
     $rolesUsuario = new Rol();
     $roles = DataAccess::selectWhere($rolesUsuario, $usuario->idUsuario);
     $count = count($roles);
     for ($i = 0; $i < $count; $i++) {
         $rolname = NameRoles::getName($roles['id_rol_roles']);
         $rolUsuario = new Rol($roles);
         $rolesSession[$rolname] = $rolUsuario;
         $menuSession[$rolname] = $rolname;
     }
 }
Exemplo n.º 13
0
function canuse($pid)
{
    $p = new DataAccess();
    $sql = "select pid from problem where pid = {$pid} and submitable = 1";
    $cnt = $p->dosql($sql);
    if ($cnt == 0) {
        return false;
    }
    if ($_SESSION['ID']) {
        $sql = "SELECT * FROM submit WHERE pid = {$pid} AND uid ={$_SESSION['ID']} order by accepted desc limit 1";
        $ac = $p->dosql($sql);
        if ($ac) {
            $e = $p->rtnrlt(0);
            if ($e['accepted']) {
                return false;
            } else {
                true;
            }
        }
    }
    return true;
}
Exemplo n.º 14
0
 protected final function getDependencias($allData = false)
 {
     $dependencia = new Dependencia();
     $dependencias = DataAccess::selectWhere($dependencia);
     if ($allData) {
         return $dependencias;
     }
     $count = count($dependencias);
     for ($index = 0; $index < $count; $index++) {
         //array asociativo idempresa-nombre
         $id_Dependencia[$dependencias[$index]['iddependencia']] = $dependencias[$index]['nombre'];
     }
     return $id_Dependencia;
 }
Exemplo n.º 15
0
 protected final function getLineas($allData = false)
 {
     $linea = new Linea();
     $lineas = DataAccess::selectWhere($linea);
     if ($allData) {
         return $lineas;
     }
     $count = count($lineas);
     for ($index = 0; $index < $count; $index++) {
         //array asociativo idempresa-nombre
         $id_Linea[$lineas[$index]['idlinea']] = $lineas[$index]['nombre'];
     }
     return $id_Linea;
 }
Exemplo n.º 16
0
 protected final function getEmpresas($allData = false)
 {
     $empresa = new Empresa();
     $empresas = DataAccess::selectWhere($empresa);
     if ($allData) {
         return $empresas;
     }
     $count = count($empresas);
     for ($index = 0; $index < $count; $index++) {
         //array asociativo idempresa-nombre
         $id_Empresa[$empresas[$index]['idempresa']] = $empresas[$index]['nombre'];
     }
     return $id_Empresa;
 }
Exemplo n.º 17
0
 public function Execute()
 {
     $viewData = array();
     // load session
     session_start();
     Helper::SetUser(null);
     $errors = array();
     // load strings
     Session::SetLanguageStrings(Helper::GetLanguageStrings());
     // check php version
     if (version_compare(phpversion(), "5.0.0") < 0) {
         $errors[] = sprintf(__("TOO_OLD_PHP_VERSION"), phpversion());
     }
     if (count($errors) == 0) {
         if (Helper::DatabaseVersionIsValid()) {
             $errors[] = __("SITE_ALREADY_CREATED");
         }
         if (count($errors) == 0) {
             $previousDatabaseVersion = DataAccess::GetSetting("DATABASE_VERSION", "0.0");
             // create or update database
             $result = executeDatabaseScripts();
             $errors = $result["errors"];
             // chmod only has effect on linux/unix systems
             @mkdir(Helper::LocalPath(MAP_IMAGE_PATH));
             @chmod(Helper::LocalPath(MAP_IMAGE_PATH), 0777);
             @mkdir(Helper::LocalPath(TEMP_FILE_PATH));
             @chmod(Helper::LocalPath(TEMP_FILE_PATH), 0777);
             if (count($errors) == 0) {
                 if ($previousDatabaseVersion == "0.0") {
                     // created databse
                     Helper::LogUsage("createSite", "version=" . DOMA_VERSION);
                     Helper::LoginAdmin(ADMIN_USERNAME, ADMIN_PASSWORD);
                 } else {
                     // updated database
                     Helper::LogUsage("updateSite", "oldVersion={$previousDatabaseVersion}&newVersion=" . DOMA_VERSION);
                     // redirect to originally requested page
                     $redirectUrl = $_GET["redirectUrl"];
                     if (!isset($redirectUrl)) {
                         $redirectUrl = "users.php";
                     }
                     Helper::Redirect($redirectUrl);
                 }
             }
         }
     }
     $viewData["Errors"] = $errors;
     return $viewData;
 }
Exemplo n.º 18
0
 public function Execute()
 {
     $viewData = array();
     $errors = array();
     $comment = new Comment();
     // no user specified - redirect to user list page
     if (isset($_POST["comment_text"])) {
         $comment->Comment = stripslashes(strip_tags(urldecode($_POST["comment_text"])));
     } else {
         die("No comment text");
     }
     if (isset($_POST["user_name"])) {
         $comment->Name = stripslashes(strip_tags(urldecode($_POST["user_name"])));
     } else {
         die("No user name");
     }
     if (isset($_POST["map_id"]) && is_numeric($_POST["map_id"])) {
         $comment->MapID = $_POST["map_id"];
     } else {
         die("No valid map ID");
     }
     if (isset($_POST["user_email"])) {
         $comment->Email = stripslashes(strip_tags($_POST["user_email"]));
     }
     $comment->UserIP = $_SERVER['REMOTE_ADDR'];
     $comment->DateCreated = date("Y-m-d H:i:s");
     $comment->Save();
     $map = new Map();
     $map->Load($comment->MapID);
     if (__("EMAIL_VISITOR_COMMENTS") && $map->UserID != Helper::GetLoggedInUser()->ID) {
         $user = DataAccess::GetUserByID($map->UserID);
         $fromName = __("DOMA_ADMIN_EMAIL_NAME");
         $subject = __("NEW_COMMENT_EMAIL_SUBJECT");
         $mapAddress = Helper::GlobalPath("show_map.php?user="******"&map=" . $map->ID . "&showComments=true");
         $body = sprintf(__("NEW_COMMENT_EMAIL_BODY"), $map->Name, $mapAddress, $comment->Name, $comment->Email, $comment->Comment);
         $emailSentSuccessfully = Helper::SendEmail($fromName, $user->Email, $subject, $body);
         if (!$emailSentSuccessfully) {
             $errors[] = __("EMAIL_ERROR");
         }
     }
     $viewData["Errors"] = $errors;
     $viewData["Comment"] = $comment;
     $viewData["Map"] = $map;
     return $viewData;
 }
 protected function PrepareAndExecuteQuery($query, $params)
 {
     $stmt = parent::PrepareAndExecuteQuery($query, $params);
     if (!$stmt) {
         // If this was a general error, attempt to reconnect and retry the query
         // UPDATED: Only care about specific general errors
         if ($this->errno == 'HY000' && strpos($this->errorMsg, 'General error: 2006 MySQL server has gone away') !== false) {
             echo "Database Error.  Waiting 1 minute before attempting to Reconnect.\n";
             sleep(60);
             echo "Attempting to reconnect...\n";
             $this->conn = null;
             $this->connect($this->host, $this->user, $this->pass, $this->dbname);
             if (!$this->hasError()) {
                 return parent::PrepareAndExecuteQuery($query, $params);
             }
             echo "Reconnect Failed\n";
             return false;
         }
     }
     return $stmt;
 }
Exemplo n.º 20
0
 protected final function consultarMarcas()
 {
     return DataAccess::selectWhere($this->marca, " ");
 }
Exemplo n.º 21
0
<?php

error_reporting(E_ALL & ~E_NOTICE);
include_once dirname(__FILE__) . "/../config.php";
include_once dirname(__FILE__) . "/definitions.php";
// set character encoding
header('Content-Type: text/html; charset=utf-8');
// load session
session_start();
// create database if it does not exist
if (!Helper::DatabaseVersionIsValid()) {
    Helper::Redirect("create.php?redirectUrl=" . urlencode($_SERVER["REQUEST_URI"]));
}
// extract current user from querystring
if (isset($_GET["user"])) {
    $currentUser = getCurrentUser();
    if (!$currentUser || $currentUser->Username != $_GET["user"] || !Session::GetLanguageStrings() || isset($_GET["lang"]) && Session::GetLanguageCode() != $_GET["lang"]) {
        Helper::SetUser(DataAccess::GetUserByUsername($_GET["user"]));
    }
} else {
    Helper::SetUser(null);
}
Exemplo n.º 22
0
 public static function setConexion(Conexion $conexion)
 {
     self::$dbcon = $conexion->getConexion();
 }
Exemplo n.º 23
0
<?php

require_once "../include/header.php";
$uid = (int) $_SESSION['ID'];
$pid = (int) $_GET['pid'];
$p = new DataAccess();
$sql = "select problem.*,groups.* from problem,groups where pid=" . (int) $_GET[pid] . " and groups.gid=problem.group limit 1";
$cnt = $p->dosql($sql);
$d = $p->rtnrlt(0);
$title = $d['probname'];
gethead(1, "", $pid . ". " . $title);
$LIB->hlighter();
$LIB->mathjax();
$q = new DataAccess();
$r = new DataAccess();
if ($cnt) {
    if ($d[readforce] > $_SESSION[readforce]) {
        异常("没有阅读权限!", 取路径("problem/index.php"));
    }
    if (!$d[submitable] && !有此权限('查看题目') && $d['addid'] != $uid) {
        异常("该题目不可提交!", 取路径("problem/index.php"));
    }
    $subgroup = $LIB->getsubgroup($q, $d['gid']);
    $subgroup[0] = $d['gid'];
    $promise = false;
    if ($uid == $d['addid']) {
        $promise = true;
    }
    foreach ($subgroup as $value) {
        if ($value == (int) $_SESSION['group']) {
            $promise = true;
Exemplo n.º 24
0
<?php

header('Content-Type:text/html;charset=utf-8');
/*
 * 抽象工厂模式【多类型数据库】
 * Author: Kaysen
 */
$dirList = 'User' . DIRECTORY_SEPARATOR . '; ';
$dirList .= 'Department' . DIRECTORY_SEPARATOR;
define('__AUTOLOAD_DIR__', $dirList);
define('ROOT_PATH', dirname(__FILE__));
require_once ROOT_PATH . '/../../Loader.php';
$user = new User();
$dept = new Department();
$IUser = DataAccess::createUser();
$IUser->insert($user);
$IUser->getUser(1);
$IDepar = DataAccess::createDepartment();
$IDepar->insert($dept);
$IDepar->getDepartment(2);
Exemplo n.º 25
0
<?php

require_once "../include/header.php";
gethead(1, "sess", "评测");
if (!$_POST['pid']) {
    异常("你来错地方了!");
}
$LIB->hlighter();
$LIB->func_socket();
$p = new DataAccess();
$sql = "select * from problem where pid={$_POST['pid']}";
$p->dosql($sql);
$d = $p->rtnrlt(0);
if (!$d['submitable'] && !有此权限('查看题目')) {
    异常("不可提交!", 取路径("problem/index.php"));
}
$lang = langstrtonum($_POST['lang']);
$info = array();
$info['pid'] = $_POST['pid'];
$info['sid'] = $_POST['sid'];
$info['uid'] = $_SESSION['ID'];
$info['language'] = $lang;
$info['pname'] = $d['filename'];
$info['datacnt'] = $d['datacnt'];
$info['timelimit'] = $d['timelimit'];
$ptitle = $d['probname'];
$info['memorylimit'] = $d['memorylimit'];
$info['plugin'] = $d['plugin'];
$info['compiledir'] = $SET['dir_source'];
$info['mode'] = "normal";
if ($_POST['testmode'] == '1' && 有此权限('测试题目')) {
Exemplo n.º 26
0
<?php

require_once "../include/header.php";
gethead(1, "sess", "邮件列表");
$uid = $_SESSION['ID'];
$p = new DataAccess();
$q = new DataAccess();
if ($_GET['toid']) {
    $_POST['title'] = "给" . $_GET['toid'] . "的邮件";
}
?>
<div class='center'>
<a class='btn btn-success' href="#sendmail" data-toggle='modal'><i class='icon-envelope icon-white'></i>发送信件</a>
</div>
<div id='sendmail' class='modal hide fade in'>
<form method="post" action="send.php" class='form-horizontal'>
<fieldset>
<div class='modal-header'>
<button class='close' data-dismiss='modal'>×</button>
<h3>发送信件</h3>
</div>
<div class='modal-body'>
<input name="fromid" type="hidden" value="<?php 
echo $uid;
?>
" />
<div class='control-group'>
<label class='control-label' for='title'>邮件主题</label>
<div class='controls'><input type='text' id='title' name="title" value="<?php 
echo $_POST['title'];
?>
Exemplo n.º 27
0
 protected final function consultarEstadoArticulo()
 {
     return DataAccess::selectWhere($this->estadoArticulo, " ");
 }
Exemplo n.º 28
0
$pwd = $_REQUEST['pwdhash'];
if (!$usr) {
    $usr = $_COOKIE['cogs_usr'];
}
if (!$pwd) {
    $pwd = $_COOKIE['cogs_pwd_hash'];
}
$sql = "select * from userinfo where usr='******'";
$cnt = $p->dosql($sql);
if ($cnt == 0) {
    i异常("用户不存在!", 取路径("user/login.php"));
} else {
    $d = $p->rtnrlt(0);
    if ($pwd == $d['pwdhash'] || encode($_REQUEST['password']) == $d['pwdhash']) {
        $LIB->get_userinfo($d['uid']);
        $q = new DataAccess();
        $sql = "UPDATE `userinfo` SET `lastip` = '{$_SERVER['REMOTE_ADDR']}' WHERE `uid` ={$d['uid']}";
        $q->dosql($sql);
        $sql = "insert into login(uid,ua,ip,ltime,version) values({$d['uid']},'" . mysql_real_escape_string($_SERVER['HTTP_USER_AGENT']) . "','{$_SERVER['REMOTE_ADDR']}',NOW(),'" . mysql_real_escape_string($cfg['dir_root']) . "')";
        if ($SET['login_log']) {
            $q->dosql($sql);
        }
        if ($_REQUEST['savepwd']) {
            $tm = time() + 7776000;
            setcookie("cogs_usr", $usr, $tm, "/");
            setcookie("cogs_pwd_hash", $d['pwdhash'], $tm, "/");
        }
        if (!$_REQUEST['from']) {
            $_REQUEST['from'] = base64_encode("/" . $SET['global_root']);
        }
        i提示("用户 {$d['nickname']} 登录成功!{$_REQUEST['savepwd']}", $_REQUEST['from']);
<?php

require_once 'DataAccess.php';
require_once 'includes/functions.php';
$name = $_POST['name'];
//user info
$id = 1;
$userName = "******";
$email = "*****@*****.**";
$description = $_POST['description'];
$stars = $_POST['stars'];
$latitude = $_POST['latitude'];
$longitude = $_POST['longitude'];
$now = getCurrentDateTime();
$sql = "INSERT INTO problems VALUES (null,'{$name}', '{$id}', '{$userName}', '{$email}','{$description}',null, 'fn','{$now}', 0, '{$now}', 'Active','{$stars}','{$latitude}','{$longitude}')";
$data = new DataAccess('photo');
$result = $data->executeQuery($sql);
$pid = mysql_insert_id();
if (!$result) {
    echo mysql_error();
    return;
}
$data->dispose();
return $pid;
Exemplo n.º 30
0
?>
<div class="page-container" data-bind="if: currentView() === 'high-scores'">
<div class="well">
    <h2>High Scores</h2>
    <table class="table table-border">
        <thead>
        <tr>
            <th></th>
            <th>Level</th>
            <th>Score</th>
            <th>Date</th>
        </tr>
        </thead>
        <tbody>
        <?php 
$data_access = new DataAccess();
$highscores_array = $data_access->get_highscores();
foreach ($highscores_array as $row) {
    $date = date_create($row['end']);
    $dateScore = date_format($date, 'l, F jS, Y \\a\\t g:ia');
    echo '<tr>';
    echo '<td><img src="pics/Robot_Character1_Blue.png" height="60"/></td>';
    echo '<td>' . $row['level_id'] . '</td>';
    echo '<td>' . $row['highscore'] . '</td>';
    echo '<td>' . $dateScore . '</td>';
    echo '</tr>';
}
?>
        </tbody>
    </table>
</div>