コード例 #1
0
ファイル: index.php プロジェクト: jonasbjork/sendme
<?php

session_start();
if (!isset($_SESSION['sendMe']['id'])) {
    header("Location: login.php");
}
require 'config.php';
require 'functions.php';
isset($_GET['m']) ? $message = $_GET['m'] : ($message = "");
$smarty->assign('message', $message);
$smarty->assign('userName', $userName);
$smarty->assign('siteMenu', create_menu($userId));
$orattadeAntal = 0;
if (db_check_larare($userId)) {
    $smarty->assign('content', table_att_ratta($userId));
    $smarty->assign('page', "front_teacher");
} else {
    $smarty->assign('rattade', table_elev_rattade($userId));
    $smarty->assign('orattade', table_elev_orattade($userId));
    $smarty->assign('page', "front_student");
}
$smarty->display('main.tpl');
コード例 #2
0
ファイル: courses_teacher.php プロジェクト: jonasbjork/sendme
<?php

session_start();
require_once 'config.php';
require_once 'functions.php';
if (!db_check_larare($_SESSION['sendMe']['id'])) {
    header("Location: index.php");
}
// Skapa en kurs
if (isset($_POST['courseName'])) {
    $kursNamn = db_clean($_POST['courseName']);
    if (db_check_course_name($kursNamn)) {
        $message = "Kursnamnet finns redan!";
    } else {
        // Skapa kursen
        $sql = "INSERT INTO kurs(namn, skapad_av, skapad_datum) VALUES('" . $kursNamn . "','" . $_SESSION['sendMe']['id'] . "','" . time() . "')";
        mysql_query($sql);
        $message = "Kursen skapades";
    }
}
require 'top.php';
?>
<h1>SendMe :: Hantera dina kurser</h1>

<h2>Mina kurser</h2>
<?php 
$sql = "SELECT * FROM kurs WHERE skapad_av='" . $_SESSION['sendMe']['id'] . "' ORDER BY namn";
$q = mysql_query($sql);
print "<table>\n";
while ($r = mysql_fetch_array($q)) {
    printf("<tr><td>%s</td><td>%s</td><td>%s</td><td>Redigera</td><td>Ta bort</td></tr>", $r['id'], $r['namn'], $r['skapad_datum']);
コード例 #3
0
ファイル: functions.php プロジェクト: jonasbjork/sendme
function create_menu($id)
{
    $r = "<div id='siteMenu'>\n";
    $r .= "<ul>\n";
    $r .= "<li><a href='index.php'>Start</a></li>\n";
    $r .= "<li><a href='courses_student.php'>Mina kurser</a></li>\n";
    $r .= "<li><a href='results_student.php'>Mina resultat</a></li>\n";
    $r .= "<li><a href='upload.php'>Ladda upp</a></li>\n";
    $r .= "<li><a href='settings.php'>Mina inställningar</a></li>\n";
    if (db_check_larare($id)) {
        $r .= "<li><a href='courses_teacher.php'>Hantera kurser</a></li>\n";
    }
    $r .= "<li><a href='logout.php'>Logga ut</a></li>\n";
    $r .= "</ul>\n";
    $r .= "</div>\n";
    return $r;
}