[3526] | 1 | <?php |
---|
| 2 | include("../inc/inc.Settings.php"); |
---|
| 3 | include("../inc/inc.Utils.php"); |
---|
| 4 | include("../inc/inc.Language.php"); |
---|
| 5 | include("../inc/inc.OutUtils.php"); |
---|
| 6 | include("../inc/inc.DBAccess.php"); |
---|
| 7 | |
---|
| 8 | |
---|
| 9 | $login = sanitizeString($login); |
---|
| 10 | |
---|
| 11 | if($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"; |
---|
| 16 | if (!$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')"; |
---|
| 31 | if (!$db->getResult($queryStr)) |
---|
| 32 | die ("Error while adding Session to phpgw_mydms_Sessions: " . $db->getErrorMsg()); |
---|
| 33 | |
---|
| 34 | //Setzen des Sitzungs-Cookies |
---|
| 35 | setcookie("mydms_session", $id, 0, $settings->_httpRoot); |
---|
| 36 | |
---|
| 37 | //Weiterleiten zur Startseite |
---|
| 38 | header("Location: ../out/out.ViewFolder.php?folderid=1"); |
---|
| 39 | print "Login successful"; |
---|
| 40 | |
---|
| 41 | ?> |
---|