summaryrefslogtreecommitdiff
path: root/www/youtube_functions.php
blob: 15153ec2834f9bdffd41565280567c61d6ae749c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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;
}