diff --git a/index.php b/index.php
index 460f04d8..fe6ce857 100755
--- a/index.php
+++ b/index.php
@@ -17,7 +17,7 @@
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 @@