Example #1
0
<?php

session_start();
require './lib/Template.class.php';
$tem = new Template();
if (isset($_SESSION["logIn"]) && $_SESSION["logIn"] === "true") {
    try {
        $db = new PDO('mysql:dbname=skriptprog;host=127.0.0.1', 'root', '');
    } catch (Exception $e) {
        echo $e->getMessage();
        //TODO
    }
    $statement = $db->prepare("SELECT score From user WHERE name = :name");
    $statement->bindParam(":name", $_SESSION["name"]);
    $statement->execute();
    $points = $statement->fetch(0)[0];
    $tem->assign("Info", "");
    $tem->assign("name", $_SESSION["name"]);
    $tem->assign("punkte", $points);
    $tem->assign("title", "Profile");
    $tem->assign("content", $tem->returnContent("./templates/profile.tpl"));
    $tem->display("./templates/mainTemplate.tpl");
} else {
    $tem->assign("Info", "Bitte loggen Sie sich ein");
    $tem->display("./templates/startpage.tpl");
}
Example #2
0
<?php

require 'lib/Template.class.php';
session_start();
$tem = new Template();
if (isset($_SESSION["logIn"]) && $_SESSION["logIn"] === "true") {
    $id = rand(1, 16);
    $tem->assign('teeext', $id);
    $tem->assign('title', 'QUIZ');
    $tem->assign('content', $tem->returnContent('templates/quiz.tpl'));
    $tem->display('templates/mainTemplate.tpl');
} else {
    $tem->assign("Info", "Bitte loggen Sie sich ein");
    $tem->display("./templates/startpage.tpl");
}
Example #3
0
<?php

require './lib/Template.class.php';
session_start();
$tem = new Template();
if (isset($_SESSION["logIn"]) && $_SESSION["logIn"] === "true") {
    $tem->assign('title', 'Ranking');
    $tem->assign('content', $tem->returnContent('templates/ranking.tpl'));
    $tem->display('templates/mainTemplate.tpl');
} else {
    $tem->assign("Info", "Bitte loggen Sie sich ein");
    $tem->display("./templates/startpage.tpl");
}
Example #4
0
<?php

require 'lib/Database.class.php';
require 'lib/Template.class.php';
session_start();
$tem = new Template();
if (isset($_SESSION["logIn"]) && $_SESSION["logIn"] === "true") {
    $dbh = Database::getInstance();
    $sth = $dbh->prepare('SELECT `score` FROM `user` WHERE `name` = :name');
    $sth->bindParam(':name', $_SESSION['name']);
    $sth->execute();
    $counter = (int) $_GET['count'];
    if ($counter > $sth->fetch(0)[0]) {
        $sth = $dbh->prepare('UPDATE `user` SET `score` = :score WHERE `name` = :name');
        $sth->bindParam(':score', $counter);
        $sth->bindParam(':name', $_SESSION['name']);
        $sth->execute();
    }
    $tem->assign('teeext', $counter);
    $tem->assign('title', 'QUIZ');
    $tem->assign('content', $tem->returnContent('templates/loose.tpl'));
    $tem->display('templates/mainTemplate.tpl');
} else {
    $tem->assign("Info", "Bitte loggen Sie sich ein");
    $tem->display("./templates/startpage.tpl");
}