This commit is contained in:
Kasper Rynning-Tønnesen
2014-08-08 17:52:43 +02:00
parent a2d7de1a8c
commit b610406d5a
3 changed files with 22 additions and 20 deletions

View File

@@ -1,20 +1,20 @@
<?php <?php
if(isset($_POST['thisUrl'])) if(isset($_POST['thisUrl']))
{
{ $string = $_POST['thisUrl'];
$file = file_get_contents('videos.json');
$string = $_POST['thisUrl']; $data = json_decode($file);
unset($file);//prevent memory leaks for large json.
//insert data here
if($data[0] == $string)
$file = file_get_contents('videos.json'); {
array_shift($data);
$data = json_decode($file); }
file_put_contents("videos.json", json_encode($data));
unset($file);//prevent memory leaks for large json. unset($data);
}else
//insert data here {
echo "You're a bad boy";
if($data[0] == $string) }
?> ?>

View File

@@ -67,6 +67,7 @@
success: function() { success: function() {
console.log("saved"); console.log("saved");
console.log(response);
} }
}); });
@@ -76,6 +77,7 @@
async: false async: false
}).responseText; }).responseText;
var url = $.parseJSON(response); var url = $.parseJSON(response);
console.log(url[0]);
response = url[0]; response = url[0];
ytplayer.loadVideoById(response); ytplayer.loadVideoById(response);

View File

@@ -1 +1 @@
["eTwQ4kACymM","y6DHE_5drbM","A8P01EjBQxY","dMrmfub2TBw","BSAUJIRqAF4","mG6pm1WZ2uc"] ["XU_9yi6xvRs", "mG6pm1WZ2uc"]