Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
gameauth
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sucssite
gameauth
Commits
97b10b54
Commit
97b10b54
authored
9 years ago
by
Stuart John Watson
Browse files
Options
Downloads
Patches
Plain Diff
Trying to make index work with the new api
parent
237a67d6
No related branches found
Branches containing commit
No related tags found
1 merge request
!1
Major Rebuild: AJAX and working game info
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
index.php
+36
-44
36 additions, 44 deletions
index.php
with
36 additions
and
44 deletions
index.php
+
36
−
44
View file @
97b10b54
...
@@ -143,64 +143,56 @@
...
@@ -143,64 +143,56 @@
$
.
post
(
"
controll.php
"
,{},
onPostResponse
);
$
.
post
(
"
controll.php
"
,{},
onPostResponse
);
}
}
function
onPostResponse
(
response
){
function
onPostResponse
(
response
){
console
.
log
(
response
)
console
.
log
(
response
)
var
type
=
response
[
"
type
"
],
var
level
=
response
[
"
level
"
],
error
=
response
[
"
loginError
"
],
error
=
response
[
"
loginError
"
],
username
=
response
[
"
username
"
],
username
=
response
[
"
username
"
],
onlineUsers
=
response
[
"
onlineUsers
"
];
extraPayload
=
response
[
"
extraPayload
"
]
//Display Username & logout if set
if
(
level
==
"
NO_LOGIN
"
){
if
(
username
){
//User isn't logged in
$
(
"
#username
"
).
show
().
text
(
"
Hello
"
+
username
);
$
(
"
#onlineListWrap
"
).
hide
()
$
(
"
#login
"
).
hide
();
$
(
"
#logout
"
).
show
();
}
else
{
$
(
"
#username
"
).
hide
();
$
(
"
#username
"
).
hide
();
$
(
"
#login
"
).
show
();
$
(
"
#login
"
).
show
();
$
(
"
#logout
"
).
hide
();
$
(
"
#logout
"
).
hide
();
}
$
(
"
#signup
"
).
show
()
}
else
{
//User is logged in ...
$
(
"
#username
"
).
show
().
text
(
"
Hello
"
+
username
);
$
(
"
#login
"
).
hide
();
$
(
"
#logout
"
).
show
();
//Display Error, signup box and/or welcome messages based on error state
setTimeout
(
loginRefresh
,
30
*
1000
);
if
(
error
)
{
if
(
level
==
"
NO_GAMES
"
)
{
$
(
"
#loginErrorWrap
"
).
show
();
//...but cannot access games
$
(
"
#loginError
"
).
text
(
ERR_MAP
[
error
]
);
$
(
"
#loginError
Wrap
"
).
show
(
);
$
(
"
#
onlineListWrap
"
).
hide
()
$
(
"
#
loginError
"
).
text
(
ERR_MAP
[
error
]);
//If the issue is that they are a uni student show join information
if
(
error
==
"
UNI_DISALLOWED
"
){
if
(
error
==
"
UNI_DISALLOWED
"
){
$
(
"
#loginMessage
"
).
show
().
html
(
SIGNUP_INFO
);
$
(
"
#loginMessage
"
).
show
().
html
(
SIGNUP_INFO
);
$
(
"
#signup
"
).
show
()
$
(
"
#signup
"
).
show
()
//If the issue is other than being banned show the sign up button as well
}
else
{
}
else
if
(
error
!=
"
BANNED
"
)
{
$
(
"
#loginMessage
"
).
hide
()
$
(
"
#signup
"
).
show
()
}
$
(
"
#loginMessage
"
).
hide
();
$
(
"
#onlineList
"
).
hide
()
}
else
{
}
else
if
(
level
==
"
GAME_ACCESS
"
)
{
//...and can access games
$
(
"
#loginMessage
"
).
show
().
html
(
SUCCESS
);
$
(
"
#loginErrorWrap
"
).
hide
();
$
(
"
#signup
"
).
hide
()
$
(
"
#signup
"
).
hide
()
$
(
"
#loginMessage
"
).
hide
();
$
(
"
#onlineListWrap
"
).
show
()
}
}
else
{
$
(
"
#loginMessage
"
).
show
().
html
(
SUCCESS
);
$
(
"
#loginErrorWrap
"
).
hide
();
$
(
"
#signup
"
).
hide
()
$
(
"
#onlineListWrap
"
).
show
()
}
if
(
type
==
"
loggedOut
"
){
var
onlineUsers
=
response
[
"
extraPayload
"
][
"
onlineUsers
"
]
$
(
"
#loginMessage
"
).
hide
();
$
(
"
#onlineList
"
).
empty
();
$
(
"
#onlineListWrap
"
).
hide
()
for
(
var
i
=
0
;
i
<
onlineUsers
.
length
;
i
++
){
$
(
"
#signup
"
).
show
()
$
(
"
<li>
"
).
text
(
onlineUsers
[
i
]).
appendTo
(
"
#onlineList
"
);
}
}
}
//Schedule a ping if its a good login
if
(
type
==
"
sucs
"
|
type
==
"
uni
"
){
setTimeout
(
loginRefresh
,
30
*
1000
);
}
$
(
"
#onlineList
"
).
empty
();
for
(
var
i
=
0
;
i
<
onlineUsers
.
length
;
i
++
){
$
(
"
<li>
"
).
text
(
onlineUsers
[
i
]).
appendTo
(
"
#onlineList
"
);
}
}
}
}
onPostResponse
({
type
:
"
loggedOut
"
,
onlineUsers
:[]
});
onPostResponse
({
level
:
"
NO_LOGIN
"
});
$
(
"
form
"
).
submit
(
function
(
event
){
$
(
"
form
"
).
submit
(
function
(
event
){
var
data
=
{}
var
data
=
{}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment