summaryrefslogtreecommitdiff
path: root/www/youtube.php
blob: ee2cc02b9f77a8c7fcda023e41a8be96264079f6 (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
<?php

/*
*This generates a Youtube-ID and checks if available. This is the most stupid way I can think of.
*NO, THIS SHIT DOESN'T WORK!! You will get 404's everytime.
*/

$clientLibraryPath = "../zend/library";
$oldPath = set_include_path(get_include_path() . PATH_SEPARATOR . $clientLibraryPath);

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<11;$i++){
                $index = mt_rand(0,$length-1);
                $string = "$string".$youtube_array[$index];
        }
		return $string;
        }
}

$searchstring = get_video();

echo $searchstring;


// <iframe width="560" height="315" src="//www.youtube.com/embed/" frameborder="0" allowfullscreen></iframe>