Last change
on this file since 100 was
60,
checked in by fpvanagthoven, 14 years ago
|
You now get redirected to mainmenu, when you're already logged in and go to index.php
|
File size:
1.7 KB
|
Line | |
---|
1 | <?php |
---|
2 | require 'classes/master.php'; //should be at top of every page |
---|
3 | |
---|
4 | if (isset($_POST['register'])) { |
---|
5 | if ($_POST['username'] != null && $_POST['password'] != null) { |
---|
6 | $userDBI = new UserDatabaseInterface(); |
---|
7 | $user_exists = $userDBI->checkUserName($_POST['username']); |
---|
8 | if (!$user_exists) { |
---|
9 | $userDBI->addNewUser($_POST); |
---|
10 | } |
---|
11 | else |
---|
12 | echo "Username already exists, try something else"; |
---|
13 | } |
---|
14 | else |
---|
15 | echo "please fill in a username and password"; |
---|
16 | } |
---|
17 | |
---|
18 | if (isset($_SESSION['username'])) |
---|
19 | redirect('mainmenu.php'); |
---|
20 | ?> |
---|
21 | |
---|
22 | <!DOCTYPE html> |
---|
23 | <html> |
---|
24 | <head> |
---|
25 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
---|
26 | <title>Facilitator</title> |
---|
27 | <?php new StyleSheet(); ?> |
---|
28 | <script type="text/javascript" src="js/menu.js"></script> |
---|
29 | </head> |
---|
30 | <body> |
---|
31 | <div id="header"> |
---|
32 | <?php new Logo(); ?> |
---|
33 | </div> |
---|
34 | |
---|
35 | <div id="wrapper"> |
---|
36 | |
---|
37 | <div id="content"> |
---|
38 | <div class="menu"> |
---|
39 | <form action="mainmenu.php" method="POST"> |
---|
40 | <h3>Username</h3> |
---|
41 | <input type="text" name="username"><br /> |
---|
42 | <h3>Password</h3> |
---|
43 | <input type="password" name="password"><br/><br/><br/> |
---|
44 | <input type="submit" name="login" class="surveyButton bigSurveyButton" value="Log in"> |
---|
45 | </form> |
---|
46 | <form action="register.php" method="POST"> |
---|
47 | <input type="submit" name="register" class="surveyButton bigSurveyButton" value="Register"> |
---|
48 | </form> |
---|
49 | </div> |
---|
50 | </div> |
---|
51 | </div> |
---|
52 | </body> |
---|
53 | </html> |
---|
Note: See
TracBrowser
for help on using the repository browser.