diff options
Diffstat (limited to 'www/youtube_functions.php')
| -rw-r--r-- | www/youtube_functions.php | 35 |
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; +} |
