diff --git a/index.php b/index.php index 460f04d8..fe6ce857 100755 --- a/index.php +++ b/index.php @@ -17,7 +17,7 @@
Zöff
- +
diff --git a/js/list.js b/js/list.js index f75de410..1fcffdde 100755 --- a/js/list.js +++ b/js/list.js @@ -99,18 +99,28 @@ function updateList() function vote(id, vote){ console.log(adminpass); - console.log($.ajax({ + serverAns = ($.ajax({ type: "GET", url: "php/change.php", async: false, data: "vote="+vote+"&id="+id+"&pass="+adminpass, success: function() { console.log("voted "+vote+" on "+id); - if(vote=="pos"){ $("#playlist").addClass("success");} + /*if(vote=="pos"){ $("#playlist").addClass("success");} else{ $("#playlist").addClass("fadeerror");} - updateList(); + updateList();*/ }, }).responseText); + + if(serverAns == "wrong") + { + alert("Wrong adminpassword!"); + }else{ + if(vote=="pos"){ $("#playlist").addClass("success");} + else{ $("#playlist").addClass("fadeerror");} + updateList(); + } + setTimeout(function(){ $("#playlist").removeClass("success"); $("#playlist").removeClass("fadeerror"); diff --git a/js/search.js b/js/search.js index 8cac5bc4..306260f2 100755 --- a/js/search.js +++ b/js/search.js @@ -100,22 +100,30 @@ function submitAndClose(id,title){ function submit(id,title){ - console.log($.ajax({ + serverAns = $.ajax({ type: "GET", url: "php/change.php", async: false, data: "v="+id+"&n="+title+"&pass="+adminpass, success: function() { - console.log("added "+id); - document.getElementById("search").value = ""; - $("#search").addClass("success"); + + //document.getElementById("search").value = ""; + //$("#search").addClass("success"); }, error: function(){ console.log("error in adding"); document.getElementById("search").value = ""; $("#search").addClass("error"); } - }).responseText); + }).responseText; + + if(serverAns == "wrong") + { + alert("Wrong adminpassword"); + $("#search").addClass("error"); + }else{ + $("#search").addClass("success"); + } $("#search").focus(); diff --git a/php/change.php b/php/change.php index 2940dfd0..6af5de47 100755 --- a/php/change.php +++ b/php/change.php @@ -136,6 +136,8 @@ else if(isset($_GET['v'])){ //if it file_put_contents($list, json_encode($data)); print("added"); //Just telling the javascript that it has been added for some reason... } + }else{ + print("wrong"); } } @@ -184,8 +186,10 @@ else if(isset($_GET['vote'])){ //if th { echo array_key_exists($id, $data["songs"]); //not in use..i think.. } + }else{ + print("wrong"); } - echo $pass."\n".$data['conf']['adminpass']; + } } diff --git a/php/panel.php b/php/panel.php index 36acf3b3..26eda843 100755 --- a/php/panel.php +++ b/php/panel.php @@ -43,5 +43,5 @@
- + diff --git a/static/search.png b/static/search.png new file mode 100755 index 00000000..e75848ad Binary files /dev/null and b/static/search.png differ diff --git a/static/style.css b/static/style.css index 460cb01a..86f14fff 100755 --- a/static/style.css +++ b/static/style.css @@ -90,6 +90,9 @@ input[type="radio"]{display: none;} .button:hover{background-color: rgba(255,255,255,0.4); } #loading{display:none;} +#search{background: url(search.png)no-repeat 10px 18px; +background-color: rgba(255,255,255,0.1);} + @-webkit-keyframes fadein{from {opacity:0;}to{opacity:1;}}@keyframes fadein{from{opacity:0;}to{opacity:1;}}@-moz-keyframes fadein{from{opacity:0;}to{opacity:1;}}@-o-keyframes fadein{from{opacity:0;}to{opacity:1;}} @-webkit-keyframes fadecol{from {background-color:rgba(0,255,0,0.4);}to{background-color: rgba(255,255,255,0);}}@keyframes fadecol{background-color: rgba(0,255,0,0.4);}to{background-color: rgba(255,255,255,0);}}@-moz-keyframes fadecol{from{background-color: rgba(0,255,0,0.4);}to{background-color: rgba(255,255,255,0);}}@-o-keyframes fadecol{background-color: rgba(0,255,0,0.4);}to{background-color: rgba(255,255,255,0);}