Added and styled delete button

This commit is contained in:
Nicolas A. Tonne
2014-10-21 14:47:25 +02:00
parent 15c6846fb6
commit d0c5f92ac7
2 changed files with 33 additions and 17 deletions

View File

@@ -103,31 +103,47 @@ else if(isset($_GET['v'])){ //add
} }
} }
else if(isset($_GET['vote'])){ //add vote else if(isset($_GET['vote'])){ //add vote
$vote=$_GET['vote']; $vote=$_GET['vote'];
$id=$_GET['id']; $id=$_GET['id'];
//$i = array_search($id, $data["songs"]); //$i = array_search($id, $data["songs"]);
//$i = array_search($id, array_keys($data["songs"])) //$i = array_search($id, array_keys($data["songs"]))
if($vote == 'neg'){$voteAdd = -1;} if($vote=='del'){
else if($vote == 'pos'){$voteAdd = 1;} $pass=$_GET['pass'];
if(array_key_exists($id, $data["songs"]) && !in_array($guid, $data["songs"][$id]["guids"])) $x = explode("/", htmlspecialchars(strtolower($_SERVER["REQUEST_URI"])));
{ $pass=crypt($pass, '$6$rounds=9001$'.$x[1].'Fuck0ffuSn34kyn!ggerzZ$');
$data["songs"][$id]["votes"] = $data["songs"][$id]["votes"] + $voteAdd; $adminpass='$6$rounds=9001$tritoenFuck0ffuS$si2Hi95ghCxSbVAfgeBN0dVzf5DTn1mQoizOuLEzr0N2q6fclGLrapscJQA0PsA2F0TlG5q0YAYrPHy9dZxpj0'; //$data["conf"]["admin"];
if($data["songs"][$id]["votes"] > -1)
{ if($adminpass == $pass){
$data["songs"][$id]["added"] = time(); unset($data["songs"][$id]);
array_push($data["songs"][$id]["guids"], $guid);
foreach($data["songs"] as $k=>$v) {
$sort['votes'][$k] = $v['votes'];
$sort['added'][$k] = $v['added'];
}
array_multisort($sort['votes'], SORT_DESC, $sort['added'], SORT_ASC, $data["songs"]);
file_put_contents($list, json_encode($data)); file_put_contents($list, json_encode($data));
echo "Vote registrated. I hope"; echo "removed song with ID: ".$id." from list: ".$list;
} }
}else }else
{ {
echo array_key_exists($id, $data["songs"]); if($vote == 'neg'){$voteAdd = -1;}
else if($vote == 'pos'){$voteAdd = 1;}
if(array_key_exists($id, $data["songs"]) && !in_array($guid, $data["songs"][$id]["guids"]))
{
$data["songs"][$id]["votes"] = $data["songs"][$id]["votes"] + $voteAdd;
if($data["songs"][$id]["votes"] > -1)
{
$data["songs"][$id]["added"] = time();
array_push($data["songs"][$id]["guids"], $guid);
foreach($data["songs"] as $k=>$v) {
$sort['votes'][$k] = $v['votes'];
$sort['added'][$k] = $v['added'];
}
array_multisort($sort['votes'], SORT_DESC, $sort['added'], SORT_ASC, $data["songs"]);
file_put_contents($list, json_encode($data));
echo "Vote registrated. I hope";
}
}else
{
echo array_key_exists($id, $data["songs"]);
}
} }
} }
else if(isset($_GET['skip'])){ //skip song request else if(isset($_GET['skip'])){ //skip song request

View File

@@ -72,7 +72,7 @@ body{background:#000; margin:0; }
.votes{position: relative; margin-top: -0-5em; font-size: 18px; color:#fff;} .votes{position: relative; margin-top: -0-5em; font-size: 18px; color:#fff;}
#plus, #minus {text-decoration: none; color:#eee; margin-left: 2px; padding-left: 3px; padding-right: 3px; } #plus, #minus {text-decoration: none; color:#eee; margin-left: 2px; padding-left: 3px; padding-right: 3px; }
#plus:hover,#minus:hover{color:#000;} #plus:hover,#minus:hover{color:#000;}
#del{float: right; font-weight: bold; margin-right: 20px; margin-top:0px; border-radius: 2px;} #del{float: right; font-weight: bold; margin-right: 20px; margin-top:0px; border-radius: 2px; display:none;}
#del:hover{color:red;} #del:hover{color:red;}
#player{height: 68%; height: calc(87% - 183px); width: 60%; border-radius: 3px; box-shadow: 0 8px 11px -4px black;} #player{height: 68%; height: calc(87% - 183px); width: 60%; border-radius: 3px; box-shadow: 0 8px 11px -4px black;}