Mercurial > hg > fapweb
annotate usrlogin.php @ 304:7181350076c1
Change how user login errors are handled.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 26 Nov 2013 06:27:06 +0200 |
parents | 8df523e6326a |
children | 6610311ac48e |
rev | line source |
---|---|
110 | 1 <? |
155
5b92f130ba87
Add copyright header blurbs.
Matti Hamalainen <ccr@tnsp.org>
parents:
129
diff
changeset
|
2 // |
5b92f130ba87
Add copyright header blurbs.
Matti Hamalainen <ccr@tnsp.org>
parents:
129
diff
changeset
|
3 // FAPWeb Simple Demoparty System |
5b92f130ba87
Add copyright header blurbs.
Matti Hamalainen <ccr@tnsp.org>
parents:
129
diff
changeset
|
4 // Administration interface session login handler |
5b92f130ba87
Add copyright header blurbs.
Matti Hamalainen <ccr@tnsp.org>
parents:
129
diff
changeset
|
5 // (C) Copyright 2012-2013 Tecnic Software productions (TNSP) |
5b92f130ba87
Add copyright header blurbs.
Matti Hamalainen <ccr@tnsp.org>
parents:
129
diff
changeset
|
6 // |
110 | 7 $sessionType = "user"; |
175
8df523e6326a
User require_once instead of require.
Matti Hamalainen <ccr@tnsp.org>
parents:
156
diff
changeset
|
8 require_once "mconfig.inc.php"; |
8df523e6326a
User require_once instead of require.
Matti Hamalainen <ccr@tnsp.org>
parents:
156
diff
changeset
|
9 require_once "msite.inc.php"; |
8df523e6326a
User require_once instead of require.
Matti Hamalainen <ccr@tnsp.org>
parents:
156
diff
changeset
|
10 require_once "msession.inc.php"; |
110 | 11 |
156 | 12 // |
13 // Initialize | |
14 // | |
110 | 15 stSetupCacheControl(); |
16 | |
17 if (!stConnectSQLDB()) | |
18 die("Could not connect to SQL database."); | |
19 | |
20 stReloadSettings(); | |
21 | |
22 | |
156 | 23 // |
24 // Authenticate | |
25 // | |
110 | 26 $gotoPage = stGetRequestItem("goto", FALSE); |
27 $password = stGetRequestItem("key", FALSE); | |
28 | |
29 $sql = stPrepareSQL("SELECT id FROM votekeys WHERE key=%s", $password); | |
30 if (($votekey_id = stFetchSQLColumn($sql)) !== false) | |
31 { | |
129 | 32 if (!stSessionStart(SESS_USER, $password, "userTimeout")) |
110 | 33 { |
34 error_log("User session AUTH LOGIN failed (session setup)"); | |
304
7181350076c1
Change how user login errors are handled.
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
35 $gotoPage = "vote?error=2"; |
110 | 36 } |
37 else | |
38 stSetSessionItem("mode", stGetRequestItem("mode", "error")); | |
39 } | |
40 else | |
41 { | |
42 error_log("User session AUTH LOGIN failed (password)"); | |
304
7181350076c1
Change how user login errors are handled.
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
43 $gotoPage = "vote?error=1"; |
110 | 44 } |
45 | |
123
5837b9333964
Add new "about" page, and setting for default page.
Matti Hamalainen <ccr@tnsp.org>
parents:
110
diff
changeset
|
46 header("Location: ".($gotoPage !== FALSE ? $gotoPage : stGetSetting("defaultPage"))); |
110 | 47 ?> |