/lenasys/0.1

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/lenasys/0.1

« back to all changes in this revision

Viewing changes to trunk/DuggaSys/quizSystem/index.php

  • Committer: Henrik G.
  • Date: 2013-03-26 23:22:55 UTC
  • Revision ID: henrik.gustavsson@his.se-20130326232255-ik6snyatlbkf3zs1
First seed of Lenasys ... Needs to be Organized Further

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
header("X-UA-Compatible: IE=edge,chrome=1");
 
3
session_start();
 
4
 
 
5
function htmlsafe($str){
 
6
        return $str=htmlspecialchars($str,ENT_QUOTES,'UTF-8');
 
7
}
 
8
        
 
9
function generatePassword($length){
 
10
        $arr = str_split('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890'); //Array of characters that may occur in the password
 
11
    shuffle($arr); //Shuffle array
 
12
    $arr = array_slice($arr, 0, $length); //Extract the first $length characters from the shuffled array
 
13
    return implode('', $arr); //Make string of the array and return the result
 
14
}
 
15
 
 
16
function addBackLink($postBacks){
 
17
        echo "<form name='backLink' action='.' method='post'>";
 
18
        foreach($postBacks as $name=>$value){
 
19
                echo "<input type='hidden' name='".$name."' value='".$value."' />";
 
20
        }
 
21
    echo "<a href='#' onclick='document[\"backLink\"].submit();return false;'><-- Back</a>";
 
22
        echo "</form>";
 
23
}
 
24
 
 
25
$pagetitle = "Quiz system";
 
26
$userMsg = "";
 
27
$errorMsg = "";
 
28
 
 
29
include_once "login/checkLogin.php";
 
30
 
 
31
ob_start();
 
32
        
 
33
if (isset($_POST['logoutLink'])) {
 
34
    unset($_SESSION['userName']);
 
35
    unset($_SESSION['userPassword']);
 
36
    unset($_SESSION['userType']);
 
37
    session_destroy();
 
38
} else if (checklogin()) {
 
39
        
 
40
        include "dbconnect.php";
 
41
 
 
42
        //Default page
 
43
        $content="frontpage.html.php";
 
44
 
 
45
        //Include based on menu selection
 
46
        if(isset($_POST['dataLink'])) {
 
47
                include "data/index.php";
 
48
        } else if(isset($_POST['registerStudentsLink']) || isset($_POST['parseSubmit'])) {
 
49
                include "registerStudents/index.php";
 
50
        } else if(isset($_POST['listStudentsLink'])){
 
51
                include "students/index.php";
 
52
        } else if(isset($_POST['listQuizzesLink'])){
 
53
                include "quiz/index.php";
 
54
        } else if(isset($_POST['checkQuizzesLink'])){
 
55
                include "quizChecking/index.php";
 
56
        }else if(isset($_POST['coursesLink'])){
 
57
                include "course/index.php";
 
58
        } else if (isset($_POST['searchString'])) {
 
59
        include "search/index.php";
 
60
    } else {
 
61
                $_POST['aboutPageLink']=true;
 
62
        }
 
63
        ob_end_clean();
 
64
        //Enclosing page frame //checkQuizzesLink
 
65
        include "pageframe.html.php";
 
66
        exit();
 
67
 
68
 
 
69
include "login/index.php";
 
70
exit();
 
71
?>
 
 
b'\\ No newline at end of file'