Skip to content
Snippets Groups Projects
Commit 42f4d6f6 authored by Stuart John Watson's avatar Stuart John Watson
Browse files

commit to checkout another branch

parent 8b85fe64
No related branches found
No related tags found
1 merge request!1Major Rebuild: AJAX and working game info
No preview for this file type
...@@ -7,6 +7,19 @@ ...@@ -7,6 +7,19 @@
<link href="css/material-wfont.min.css" rel="stylesheet"> <link href="css/material-wfont.min.css" rel="stylesheet">
<title>SUCS Games Server</title> <title>SUCS Games Server</title>
<style>
.if-NO_LOGIN,
.if-NO_GAMES,
.if-GAME_ACCESS {
display:none;
}
.mode-NO_LOGIN .if-NO_LOGIN,
.mode-NO_GAMES .if-NO_ {
}
</style>
</head> </head>
<body> <body>
<nav class="navbar navbar-inverse navbar-warning"> <nav class="navbar navbar-inverse navbar-warning">
...@@ -143,35 +156,36 @@ ...@@ -143,35 +156,36 @@
function loginRefresh(){ function loginRefresh(){
console.log() console.log()
$.post("controll.php",{},onPostResponse); $.post("controll.php",{renew:1},onPostResponse);
} }
function onPostResponse(response){ function onPostResponse(response){
console.log(response) console.log(response)
var level = response["level"],
error = response["loginError"], //Show an error if there is one
username = response["username"], if (response.loginError){
extraPayload = response["extraPayload"] $("#loginErrorWrap").show();
if (level == "NO_LOGIN"){ $("#loginError").text(ERR_MAP[error]);
} else {
$("#loginErrorWrap").hide();
}
var username = response["username"],
extraPayload = response["extraPayload"];
if (response.level == "NO_LOGIN"){
//User isn't logged in //User isn't logged in
$("#onlineListWrap").hide()
$("#username").hide();
$("#login").show();
$("#logout").hide();
$("#signup").show()
} else { } else {
//User is logged in ... //User is logged in ...
setTimeout(loginRefresh,30*1000);
$("#username").show().text("Hello "+username); $("#username").show().text("Hello "+username);
$("#login").hide(); $("#login").hide();
$("#logout").show(); $("#logout").show();
setTimeout(loginRefresh,30*1000);
if (level == "NO_GAMES") { if (level == "NO_GAMES") {
//...but cannot access games //...but cannot access games
$("#loginErrorWrap").show();
$("#loginError").text(ERR_MAP[error]);
if(error == "UNI_DISALLOWED"){ if(error == "UNI_DISALLOWED"){
$("#loginMessage").show().html(SIGNUP_INFO); $("#loginMessage").show().html(SIGNUP_INFO);
$("#signup").show() $("#signup").show()
...@@ -179,7 +193,6 @@ ...@@ -179,7 +193,6 @@
$("#loginMessage").hide() $("#loginMessage").hide()
} }
$("#onlineList").hide() $("#onlineList").hide()
} else if (level == "GAME_ACCESS") { } else if (level == "GAME_ACCESS") {
//...and can access games //...and can access games
$("#loginMessage").show().html(SUCCESS); $("#loginMessage").show().html(SUCCESS);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment