110
|
1 <?
|
|
2 $sessionType = "user";
|
|
3 require "mconfig.inc.php";
|
|
4 require "msite.inc.php";
|
|
5 require "msession.inc.php";
|
|
6
|
|
7 stSetupCacheControl();
|
|
8
|
|
9 // Initiate SQL database connection
|
|
10 if (!stConnectSQLDB())
|
|
11 die("Could not connect to SQL database.");
|
|
12
|
|
13 // Fetch non-"hardcoded" settings from SQL database
|
|
14 stReloadSettings();
|
|
15
|
|
16
|
|
17 $gotoPage = stGetRequestItem("goto", FALSE);
|
|
18 $password = stGetRequestItem("key", FALSE);
|
|
19
|
|
20 $sql = stPrepareSQL("SELECT id FROM votekeys WHERE key=%s", $password);
|
|
21 if (($votekey_id = stFetchSQLColumn($sql)) !== false)
|
|
22 {
|
|
23 if (!stSessionStart(SESS_USER, $votekey_id, "userTimeout"))
|
|
24 {
|
|
25 error_log("User session AUTH LOGIN failed (session setup)");
|
|
26 $gotoPage = "loginerror";
|
|
27 }
|
|
28 else
|
|
29 stSetSessionItem("mode", stGetRequestItem("mode", "error"));
|
|
30 }
|
|
31 else
|
|
32 {
|
|
33 error_log("User session AUTH LOGIN failed (password)");
|
|
34 $gotoPage = "loginerror";
|
|
35 }
|
|
36
|
|
37 header("Location: ".($gotoPage !== FALSE ? $gotoPage : "news"));
|
|
38 ?> |