summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorroot2014-02-27 00:56:03 +0100
committerroot2014-02-27 00:56:03 +0100
commited80377385f9d1df0f0a31aad3102d1c2a17d755 (patch)
treede0cad3a996f43c82e6692e29e45141b67b69f30
parent71da2f74b621c838f835fd04d6f2d737bfceb6b0 (diff)
downloadrandom-ed80377385f9d1df0f0a31aad3102d1c2a17d755.tar.gz
index
-rwxr-xr-xwww/favicon.icobin0 -> 5242 bytes
-rw-r--r--www/index.php5
-rw-r--r--www/youtube.php16
3 files changed, 13 insertions, 8 deletions
diff --git a/www/favicon.ico b/www/favicon.ico
new file mode 100755
index 0000000..41f6475
--- /dev/null
+++ b/www/favicon.ico
Binary files differ
diff --git a/www/index.php b/www/index.php
new file mode 100644
index 0000000..b43b2dc
--- /dev/null
+++ b/www/index.php
@@ -0,0 +1,5 @@
+<!Doctype html>
+<head>
+<meta http-equiv="refresh" content="0; /youtube">
+</head>
+
diff --git a/www/youtube.php b/www/youtube.php
index 311b2c4..37654e5 100644
--- a/www/youtube.php
+++ b/www/youtube.php
@@ -1,6 +1,7 @@
<!Doctype html>
<head>
<title>Random Youtube Video</title>
+<link rel='shortcut icon' href='/favicon.ico' type='image/x-icon'>
</head>
<body>
<center>
@@ -20,7 +21,6 @@ function searchterm(){
$db = new SQLite3("../database/dict.db");
$table_array = array("english", "german");
- $table_count = count("$table_array");
$table=$table_array[0]; // choose the language
@@ -50,7 +50,7 @@ function printVideoFeed($videoFeed)
$res_quant = count($videoFeed);
- $video = mt_rand(1, $res_quant);
+ $video = mt_rand(0, $res_quant-1);
$videoId = printVideoEntry($videoFeed[$video]);
@@ -69,26 +69,26 @@ function start($yt){
$searchstring = searchterm();
$location = $yt->newVideoQuery();
- $location->setOrderBy('viewCount');
+// $location->setOrderBy('viewCount');
$location->setSafeSearch('none');
$location->setVideoQuery($searchstring);
$videoID = getAndPrintVideoFeed($location, $yt);
- if(file_get_contents("https://gdata.youtube.com/feeds/api/videos/" . $videoID . "")){
-
+ if(fopen("https://gdata.youtube.com/feeds/api/videos/" . $videoID , "r")){
return $videoID;
} else {
start();
}
+
}
$videoID = start($yt);
?>
-A random youtube video! <br>>
-<iframe width="560" height="315" src="//www.youtube.com/embed/<? echo $videoID ?>" frameborder="0" allowfullscreen></iframe> <br><br>
+<h1>A random youtube video!</h1> <br>
+<iframe width="560" height="315" src="https://www.youtube.com/embed/<? echo $videoID ?>" frameborder="0" allowfullscreen></iframe> <br><br>
-<a href="youtube.php">Get another one!</a>
+<a href="youtube">Get another one</a>
</center>