blob: b7db398dd01c148faf23444fd49a8d9bae165d57 [file] [log] [blame]
droy43456e42007-11-27 18:55:10 +00001<?php
2/*******************************************************************************
3 * Copyright (c) 2007 Eclipse Foundation and others.
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *
9 * Contributors:
10 * Paul Colton (Aptana)- initial API and implementation
11 * Eclipse Foundation
12*******************************************************************************/
droy43456e42007-11-27 18:55:10 +000013include("global.php");
droy2d5fd192007-11-28 14:42:45 +000014InitPage("");
droy43456e42007-11-27 18:55:10 +000015
droyfd2bab22007-11-27 21:08:43 +000016require_once(BABEL_BASE_DIR . "classes/system/user.class.php");
17require_once(BABEL_BASE_DIR . "classes/system/session.class.php");
18
19$pageTitle = "Babel Login";
20$pageKeywords = "translation,language,nlpack,pack,eclipse,babel";
21
22$USERNAME = $App->getHTTPParameter("username", "POST");
23$PASSWORD = $App->getHTTPParameter("password", "POST");
24$REMEMBER = $App->getHTTPParameter("remember", "POST");
25$SUBMIT = $App->getHTTPParameter("submit", "POST");
26
27if($SUBMIT == "Login") {
28 if($USERNAME != "" && $PASSWORD != ""){
29 $User = new User();
30 if(!$User->load($USERNAME, $PASSWORD)) {
31 $GLOBALS['g_ERRSTRS'][0] = "Authentication failed. Please verify your username and/or password are correct.";
32 }
33 else {
34 # create session
35 $Session = new Session();
36 $Session->create($User->userid, $REMEMBER);
37 SetSessionVar('User', $User);
droy2c4e5502007-11-28 15:37:26 +000038 exitTo("index.php");
droyfd2bab22007-11-27 21:08:43 +000039 }
40 }
41 else {
42 $GLOBALS['g_ERRSTRS'][0] = "Your username and password must not be empty.";
43 }
44}
droyb93e4a22007-11-28 16:08:51 +000045if($SUBMIT == "Logout") {
46 $Session = new Session();
47 $Session->destroy();
48 $GLOBALS['g_ERRSTRS'][0] = "You have successfully logged out. You can login again using the form below.";
49}
droy43456e42007-11-27 18:55:10 +000050
51# TODO: finish the intro text
52
53
droyfd2bab22007-11-27 21:08:43 +000054include("head.php");
55
droy43456e42007-11-27 18:55:10 +000056include("content/en_login.php");
droyfd2bab22007-11-27 21:08:43 +000057
droy43456e42007-11-27 18:55:10 +000058include("foot.php");
59?>