diff --git a/change.php b/change.php new file mode 100644 index 00000000..9ea81167 --- /dev/null +++ b/change.php @@ -0,0 +1,123 @@ += 0){ + + //print_r($i); + // echo "IIII: ",$i; + unset($data[3][$i]); + unset($data[0][$i]); + unset($data[2][$i]); + $underVote = array_search($votes-1, $data[2]); + if($underVote == 0)$underVote=1; + else if($underVote == false)$underVote=count($data[2]); + array_splice($data[3], $underVote, 0, array($name)); + array_splice($data[2], $underVote, 0, array($votes)); + array_splice($data[0], $underVote, 0, array($id)); + file_put_contents($list, json_encode($data)); + echo "Vote registrated. I hope"; + } +} +else if(isset($_GET['skip'])){ //skip song request + $viewers=$data[4][0]; + $skips=count($data[5]); + if(!in_array($guid, $data[5])){ + array_push($data[5], $guid); + $skips+=1; + $data[5][0]=$skips; + if($skips>=$viewers/2){ + nextSong(); + echo("skipped!"); + } + file_put_contents($list, json_encode($data)); + } + echo($skips."/".$viewers); + +} +else{ print($file); } + +function nextSong(){ + global $data; + array_push($data[0], $data[0][0]); + array_shift($data[0]); + + array_push($data[2], 0); //reset votes + array_shift($data[2]); + + array_push($data[3], $data[3][0]); + array_shift($data[3]); + + array_shift($data[4]); + array_push($data[4], 1); + + $data[5]=array(); + $data[1][0] = time(); +} +?> \ No newline at end of file diff --git a/channel.php b/channel.php new file mode 100644 index 00000000..64afe2d7 --- /dev/null +++ b/channel.php @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/delete.php b/delete.php deleted file mode 100644 index 1423bdce..00000000 --- a/delete.php +++ /dev/null @@ -1,20 +0,0 @@ - \ No newline at end of file diff --git a/favicon.ico b/favicon.ico new file mode 100644 index 00000000..9d09876d Binary files /dev/null and b/favicon.ico differ diff --git a/index.php b/index.php index b92346e5..50661cb6 100644 --- a/index.php +++ b/index.php @@ -1,136 +1,47 @@ - - -
-