function localLogin($userid, $passwd, $authtype) { global $HTMLheader, $phpVer, $authMechs; if (validateLocalAccount($userid, $passwd)) { addLoginLog($userid, $authtype, $authMechs[$authtype]['affiliationid'], 1); //set cookie $cookie = getAuthCookieData("{$userid}@local"); if (version_compare(PHP_VERSION, "5.2", ">=") == true) { setcookie("VCLAUTH", "{$cookie['data']}", 0, "/", COOKIEDOMAIN, 0, 1); } else { setcookie("VCLAUTH", "{$cookie['data']}", 0, "/", COOKIEDOMAIN); } //load main page setcookie("VCLSKIN", "default", time() + SECINDAY * 31, "/", COOKIEDOMAIN); header("Location: " . BASEURL . SCRIPT); dbDisconnect(); exit; } else { addLoginLog($userid, $authtype, $authMechs[$authtype]['affiliationid'], 0); printLoginPageWithSkin($authtype); printHTMLFooter(); dbDisconnect(); exit; } }
$qh = doQuery($query, 101); if ($row = mysql_fetch_assoc($qh)) { $shibauthid = $row['id']; } else { $ts = strtotime($_SERVER['Shib-Authentication-Instant']); $ts = unixToDatetime($ts); $query = "INSERT INTO shibauth " . "(userid, " . "ts, " . "sessid, " . "data) " . "VALUES " . "({$usernid}, " . "'{$ts}', " . "'{$_SERVER['Shib-Session-ID']}', " . "'{$serdata}')"; doQuery($query, 101); $qh = doQuery("SELECT LAST_INSERT_ID() FROM shibauth", 101); if (!($row = mysql_fetch_row($qh))) { # todo } $shibauthid = $row[0]; } # get cookie data $cookie = getAuthCookieData($userid, 600, $shibauthid); # set cookie if (version_compare(PHP_VERSION, "5.2", ">=") == true) { #setcookie("VCLAUTH", "{$cookie['data']}", $cookie['ts'], "/", COOKIEDOMAIN, 1, 1); setcookie("VCLAUTH", "{$cookie['data']}", 0, "/", COOKIEDOMAIN, 0, 1); } else { #setcookie("VCLAUTH", "{$cookie['data']}", $cookie['ts'], "/", COOKIEDOMAIN, 1); setcookie("VCLAUTH", "{$cookie['data']}", 0, "/", COOKIEDOMAIN); } # set skin cookie based on affiliation switch ($affil) { case 'Example1': case 'EXAMPLE2': $skin = strtoupper($affil); setcookie("VCLSKIN", $skin, time() + SECINDAY * 31, "/", COOKIEDOMAIN); break;