source: Dev/trunk/index.php @ 44

Last change on this file since 44 was 44, checked in by basvannuland, 14 years ago

added login functionality. Has not been styled

File size: 1.5 KB
RevLine 
[38]1<?php require 'classes/master.php'; //should be at top of every page   
[10]2
[44]3if(isset($_POST['login']))
4{
5        if($_POST['username'] == '')
6                die("Please log in!");
7        else
8        {
9                $userDBI = new UserDatabaseInterface();
10                $user_exists = $userDBI->checkUserName($_POST['username']);
11                if($user_exists)
12                {       
13                        $correct_password = $userDBI->checkUserPassword($_POST);
14                        if(!$correct_password)
15                                die("The password you entered is not correct!");
16                }       
17                else
18                        die("Unknown user name");
19        }       
20}
21
[38]22/* make an array of survey mock objects */
23$surveys = array();
24
[41]25$surveyDBI = new SurveyDatabaseInterface(null);
26$surveyIDTitles = $surveyDBI->getExistingSurveys();
[38]27
[41]28
29foreach ($surveyIDTitles as $id => $title) {
30    $survey = new Survey($id, $title);
31    array_push($surveys, $survey);
32}
[38]33?>
34
[10]35<!DOCTYPE html>
36<html>
37    <head>
38        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
39        <title>Facilitator</title>
40        <link rel="stylesheet" type="text/css" href="css/style.css" />
[38]41        <script type="text/javascript" src="js/menu.js"></script>
[10]42    </head>
43    <body>
44        <div id="header">
[41]45                <?php new Logo(); ?>
[10]46            </div>
[11]47       
[10]48        <div id="wrapper">
49           
50            <div id="content">
51                <div id="menu">               
[36]52                    <?php
53                    SurveyButton::newSurveyButton();
[38]54                    SurveyButton::loadSurveyButton($surveys);
[36]55                    ?>
[10]56                </div>
57            </div>
58        </div>
59    </body>
60</html>
Note: See TracBrowser for help on using the repository browser.