summaryrefslogtreecommitdiff
path: root/www/youtube_functions.php
diff options
context:
space:
mode:
authorHorus32014-02-26 16:47:23 +0100
committerHorus32014-02-26 16:47:23 +0100
commit01e3fb742f09593532e5db5f3c780577c1ca2dec (patch)
tree2ba7640594d9bf7d6278f528726784310de33667 /www/youtube_functions.php
parent17dc93eab267a25e0620576f1ce62bf8ffc417ab (diff)
downloadrandom-01e3fb742f09593532e5db5f3c780577c1ca2dec.tar.gz
random search word is generated
Diffstat (limited to 'www/youtube_functions.php')
-rw-r--r--www/youtube_functions.php35
1 files changed, 35 insertions, 0 deletions
diff --git a/www/youtube_functions.php b/www/youtube_functions.php
new file mode 100644
index 0000000..15153ec
--- /dev/null
+++ b/www/youtube_functions.php
@@ -0,0 +1,35 @@
+<?
+
+function get_video(){
+
+ $youtube_array = array("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q",
+ "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K",
+ "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "_", "-", "0", "1", "2", "3", "4",
+ "5", "6", "7", "8", "9" );
+
+ $length = count($youtube_array);
+
+ $string = "";
+
+ for ($i=0;$i<4;$i++){
+ $index = mt_rand(0,$length-1);
+ $string = "$string".$youtube_array[$index];
+ }
+ return $string;
+}
+
+function searchterm(){
+ $db = new SQLite3("../database/dict.db");
+
+ $table_array = array("english", "german");
+ $table_count = count("$table_array");
+
+ $rows = $db->query("SELECT count(*) as count FROM german;");
+ $row = $rows->fetchArray();
+ $numRows = $row["count"];
+
+
+ $search_word = mt_rand(1,$numRows);
+
+ return $search_word;
+}