Mercurial > hg > fapweb
annotate usrajax.js.php @ 1085:01783161eeb2
Fix usr and adm ajax and voting.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 25 Jan 2017 22:39:42 +0200 |
parents | 7da8bde9b7be |
children |
rev | line source |
---|---|
1069
5f92fa5e683a
Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
1 <?php |
5f92fa5e683a
Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
2 // |
5f92fa5e683a
Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
3 // FAPWeb - Simple Web-based Demoparty Management System |
5f92fa5e683a
Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
4 // User actions page AJAX javascript module |
1072 | 5 // (C) Copyright 2012-2017 Tecnic Software productions (TNSP) |
1069
5f92fa5e683a
Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
6 // |
5f92fa5e683a
Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
7 $sessionType = "user"; |
1085
01783161eeb2
Fix usr and adm ajax and voting.
Matti Hamalainen <ccr@tnsp.org>
parents:
1072
diff
changeset
|
8 header("Content-Type: application/javascript"); |
1069
5f92fa5e683a
Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
9 require_once "mconfig.inc.php"; |
5f92fa5e683a
Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
10 require_once "msite.inc.php"; |
5f92fa5e683a
Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
11 require_once "msession.inc.php"; |
5f92fa5e683a
Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
12 |
5f92fa5e683a
Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
13 |
1085
01783161eeb2
Fix usr and adm ajax and voting.
Matti Hamalainen <ccr@tnsp.org>
parents:
1072
diff
changeset
|
14 // Initiate SQL database connection |
01783161eeb2
Fix usr and adm ajax and voting.
Matti Hamalainen <ccr@tnsp.org>
parents:
1072
diff
changeset
|
15 if (!stConnectSQLDB()) |
1069
5f92fa5e683a
Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
16 exit; |
5f92fa5e683a
Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
17 |
1085
01783161eeb2
Fix usr and adm ajax and voting.
Matti Hamalainen <ccr@tnsp.org>
parents:
1072
diff
changeset
|
18 // Fetch non-"hardcoded" settings from SQL database |
01783161eeb2
Fix usr and adm ajax and voting.
Matti Hamalainen <ccr@tnsp.org>
parents:
1072
diff
changeset
|
19 stReloadSettings(); |
01783161eeb2
Fix usr and adm ajax and voting.
Matti Hamalainen <ccr@tnsp.org>
parents:
1072
diff
changeset
|
20 |
01783161eeb2
Fix usr and adm ajax and voting.
Matti Hamalainen <ccr@tnsp.org>
parents:
1072
diff
changeset
|
21 stUserSessionAuth(); |
01783161eeb2
Fix usr and adm ajax and voting.
Matti Hamalainen <ccr@tnsp.org>
parents:
1072
diff
changeset
|
22 |
1069
5f92fa5e683a
Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
23 stCommonAJAX("usrajax.php", "usrlogout.php"); |
5f92fa5e683a
Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
24 |
1085
01783161eeb2
Fix usr and adm ajax and voting.
Matti Hamalainen <ccr@tnsp.org>
parents:
1072
diff
changeset
|
25 |
01783161eeb2
Fix usr and adm ajax and voting.
Matti Hamalainen <ccr@tnsp.org>
parents:
1072
diff
changeset
|
26 ?> |
01783161eeb2
Fix usr and adm ajax and voting.
Matti Hamalainen <ccr@tnsp.org>
parents:
1072
diff
changeset
|
27 |
01783161eeb2
Fix usr and adm ajax and voting.
Matti Hamalainen <ccr@tnsp.org>
parents:
1072
diff
changeset
|
28 function updateVote(eid, value) |
01783161eeb2
Fix usr and adm ajax and voting.
Matti Hamalainen <ccr@tnsp.org>
parents:
1072
diff
changeset
|
29 { |
01783161eeb2
Fix usr and adm ajax and voting.
Matti Hamalainen <ccr@tnsp.org>
parents:
1072
diff
changeset
|
30 var msuccess = function(txt) |
01783161eeb2
Fix usr and adm ajax and voting.
Matti Hamalainen <ccr@tnsp.org>
parents:
1072
diff
changeset
|
31 { |
01783161eeb2
Fix usr and adm ajax and voting.
Matti Hamalainen <ccr@tnsp.org>
parents:
1072
diff
changeset
|
32 } |
01783161eeb2
Fix usr and adm ajax and voting.
Matti Hamalainen <ccr@tnsp.org>
parents:
1072
diff
changeset
|
33 |
01783161eeb2
Fix usr and adm ajax and voting.
Matti Hamalainen <ccr@tnsp.org>
parents:
1072
diff
changeset
|
34 var mfail = function(txt) |
01783161eeb2
Fix usr and adm ajax and voting.
Matti Hamalainen <ccr@tnsp.org>
parents:
1072
diff
changeset
|
35 { |
01783161eeb2
Fix usr and adm ajax and voting.
Matti Hamalainen <ccr@tnsp.org>
parents:
1072
diff
changeset
|
36 jsMessageBox("<h1>Ooops, an error occured</h2><p>Something went wrong, votes might not be submitted. :(</p>"); |
01783161eeb2
Fix usr and adm ajax and voting.
Matti Hamalainen <ccr@tnsp.org>
parents:
1072
diff
changeset
|
37 } |
01783161eeb2
Fix usr and adm ajax and voting.
Matti Hamalainen <ccr@tnsp.org>
parents:
1072
diff
changeset
|
38 |
01783161eeb2
Fix usr and adm ajax and voting.
Matti Hamalainen <ccr@tnsp.org>
parents:
1072
diff
changeset
|
39 jsSendPOSTRequest("action=set&entry_id="+eid+"&vote="+value, msuccess, mfail); |
01783161eeb2
Fix usr and adm ajax and voting.
Matti Hamalainen <ccr@tnsp.org>
parents:
1072
diff
changeset
|
40 return false; |
01783161eeb2
Fix usr and adm ajax and voting.
Matti Hamalainen <ccr@tnsp.org>
parents:
1072
diff
changeset
|
41 } |