source: contrib/Dms/op/op.Login.php @ 3526

Revision 3526, 1.3 KB checked in by afernandes, 13 years ago (diff)

Ticket #1416 - Disponibilizado modulos Timesheet e DMS para a comunidade.

  • Property svn:executable set to *
Line 
1<?php
2include("../inc/inc.Settings.php");
3include("../inc/inc.Utils.php");
4include("../inc/inc.Language.php");
5include("../inc/inc.OutUtils.php");
6include("../inc/inc.DBAccess.php");
7
8
9$login = sanitizeString($login);
10
11if($GLOBALS['phpgw']->auth->authenticate($GLOBALS['phpgw_info']['user']['account_lid'], $GLOBALS['phpgw_info']['user']['passwd'], 'text')) {
12}
13
14
15$queryStr = "DELETE FROM phpgw_mydms_Sessions WHERE " . mktime() . " - lastAccess > 86400";
16if (!$db->getResult($queryStr))
17        die ("Error while removing old sessions from phpgw_mydms_Sessions: " . $db->getErrorMsg());
18
19//Erstellen einer Sitzungs-ID
20
21$id = "" . rand() . mktime() . rand() . "";
22$id = md5($id);
23
24$lang      = sanitizeString($lang);
25$sesstheme = sanitizeString($sesstheme);
26
27$userid = $GLOBALS['phpgw']->accounts->name2id($GLOBALS['phpgw_info']['user']['account_lid']);
28
29//Einfügen eines neuen Datensatzes in phpgw_mydms_Sessions
30$queryStr = "INSERT INTO phpgw_mydms_Sessions (id, userID, lastAccess, theme, language) VALUES ('$id', userid, ".mktime().", '$sesstheme', 'English')";
31if (!$db->getResult($queryStr))
32        die ("Error while adding Session to phpgw_mydms_Sessions: " . $db->getErrorMsg());
33
34//Setzen des Sitzungs-Cookies
35setcookie("mydms_session", $id, 0, $settings->_httpRoot);
36
37//Weiterleiten zur Startseite
38header("Location: ../out/out.ViewFolder.php?folderid=1");
39print "Login successful";
40
41?>
Note: See TracBrowser for help on using the repository browser.