Last change
on this file since 123 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
|
Rev | Line | |
---|
[47] | 1 | <?php |
---|
| 2 | require 'classes/master.php'; //should be at top of every page |
---|
[10] | 3 | |
---|
[47] | 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"; |
---|
[44] | 16 | } |
---|
[60] | 17 | |
---|
| 18 | if (isset($_SESSION['username'])) |
---|
| 19 | redirect('mainmenu.php'); |
---|
[38] | 20 | ?> |
---|
| 21 | |
---|
[10] | 22 | <!DOCTYPE html> |
---|
| 23 | <html> |
---|
| 24 | <head> |
---|
| 25 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
---|
| 26 | <title>Facilitator</title> |
---|
[59] | 27 | <?php new StyleSheet(); ?> |
---|
[38] | 28 | <script type="text/javascript" src="js/menu.js"></script> |
---|
[10] | 29 | </head> |
---|
| 30 | <body> |
---|
| 31 | <div id="header"> |
---|
[47] | 32 | <?php new Logo(); ?> |
---|
| 33 | </div> |
---|
| 34 | |
---|
[10] | 35 | <div id="wrapper"> |
---|
[47] | 36 | |
---|
[10] | 37 | <div id="content"> |
---|
[58] | 38 | <div class="menu"> |
---|
[47] | 39 | <form action="mainmenu.php" method="POST"> |
---|
[48] | 40 | <h3>Username</h3> |
---|
[47] | 41 | <input type="text" name="username"><br /> |
---|
[48] | 42 | <h3>Password</h3> |
---|
[47] | 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> |
---|
[10] | 49 | </div> |
---|
| 50 | </div> |
---|
| 51 | </div> |
---|
| 52 | </body> |
---|
[47] | 53 | </html> |
---|
Note: See
TracBrowser
for help on using the repository browser.