blob: b64d1c87738e57036be275bd2506ec268fb08906 [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
gobrienad11d892007-12-19 08:33:25 +000027
droyfd2bab22007-11-27 21:08:43 +000028if($SUBMIT == "Login") {
29 if($USERNAME != "" && $PASSWORD != ""){
30 $User = new User();
31 if(!$User->load($USERNAME, $PASSWORD)) {
32 $GLOBALS['g_ERRSTRS'][0] = "Authentication failed. Please verify your username and/or password are correct.";
33 }
34 else {
35 # create session
36 $Session = new Session();
37 $Session->create($User->userid, $REMEMBER);
38 SetSessionVar('User', $User);
gobrien755df672008-01-18 01:01:33 +000039 exitTo("translate.php");
droyfd2bab22007-11-27 21:08:43 +000040 }
41 }
42 else {
43 $GLOBALS['g_ERRSTRS'][0] = "Your username and password must not be empty.";
44 }
45}
droyb93e4a22007-11-28 16:08:51 +000046if($SUBMIT == "Logout") {
47 $Session = new Session();
48 $Session->destroy();
49 $GLOBALS['g_ERRSTRS'][0] = "You have successfully logged out. You can login again using the form below.";
50}
droy43456e42007-11-27 18:55:10 +000051
52# TODO: finish the intro text
53
54
droyfd2bab22007-11-27 21:08:43 +000055include("head.php");
56
droy43456e42007-11-27 18:55:10 +000057include("content/en_login.php");
droyfd2bab22007-11-27 21:08:43 +000058
droy43456e42007-11-27 18:55:10 +000059include("foot.php");
60?>