diff options
| author | root | 2014-03-23 00:04:34 +0100 |
|---|---|---|
| committer | root | 2014-03-23 00:04:34 +0100 |
| commit | 293e2d3203d4f473f3239571b5d0237cea26a46b (patch) | |
| tree | 00d4d35d4f69fb127649f07d8b000bd10fec5191 | |
| parent | dc083d0685fa36e48f6d9e1ba2895f730a167194 (diff) | |
| download | random-293e2d3203d4f473f3239571b5d0237cea26a46b.tar.gz | |
Completed youtube history for the browser.
| -rw-r--r-- | www/.index.php.swp | bin | 0 -> 12288 bytes | |||
| -rw-r--r-- | www/functions/func_puush.php | 34 | ||||
| -rw-r--r-- | www/functions/func_youtube.php (renamed from www/func_youtube.php) | 0 | ||||
| -rw-r--r-- | www/header.php | 6 | ||||
| -rw-r--r-- | www/include.php | 6 | ||||
| -rw-r--r-- | www/index.php | 5 | ||||
| -rw-r--r-- | www/print_index.php | 62 | ||||
| -rw-r--r-- | www/puush.php | 41 | ||||
| -rw-r--r-- | www/youtube.php | 6 |
9 files changed, 122 insertions, 38 deletions
diff --git a/www/.index.php.swp b/www/.index.php.swp Binary files differnew file mode 100644 index 0000000..61c46e1 --- /dev/null +++ b/www/.index.php.swp diff --git a/www/functions/func_puush.php b/www/functions/func_puush.php new file mode 100644 index 0000000..472bd7b --- /dev/null +++ b/www/functions/func_puush.php @@ -0,0 +1,34 @@ +<?php +function get_image($count){ + + $puush_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($puush_array); + + $id = ""; + $string = ""; + + for ($i=0;$i<4;$i++){ + $index = mt_rand(0,$length-1); + $id = "$id".$puush_array[$index]; + } + + if(fopen("https://puu.sh/" . $id, "r")){ + echo "<a href='https://puu.sh/" . $id . "'><img src='https://puu.sh/" .$id . "' alt='" . $id ."' ></a>"; + return $count; + } else { + $count = $count + 1; + if($count < 100){ + $count = get_image($count); + } else { + echo "We tried for " . $count . " times. Now is enough. <br><br>"; + echo "<a href='/puush'>Try again</a>"; + exit; + } + } + return $count; +} + diff --git a/www/func_youtube.php b/www/functions/func_youtube.php index 74aa679..74aa679 100644 --- a/www/func_youtube.php +++ b/www/functions/func_youtube.php diff --git a/www/header.php b/www/header.php index 4df6d9e..dff4355 100644 --- a/www/header.php +++ b/www/header.php @@ -7,7 +7,11 @@ if(isset($new_id)){ echo "<td><a href='/youtube?id=".$new_id."'>Youtube</a></td>"; } else { - echo "<td><a href='/youtube'>Youtube</a></td>"; + if(isset($videoID)){ + echo "<td><a href='/youtube?id=".$videoID."'>Youtube</a></td>"; + } else { + echo "<td><a href='/youtube'>Youtube</a></td>"; + } } ?> <td>|</td> diff --git a/www/include.php b/www/include.php new file mode 100644 index 0000000..ad9562d --- /dev/null +++ b/www/include.php @@ -0,0 +1,6 @@ +<?php + +$functiondir = "functions/"; + +require_once($functiondir . "func_youtube.php"); +require_once($functiondir . "func_puush.php"); diff --git a/www/index.php b/www/index.php index f793c10..cf851e8 100644 --- a/www/index.php +++ b/www/index.php @@ -1,7 +1,10 @@ <? +include("include.php"); + if(empty($_GET["task"])){ - include("failure.php"); + $videoID = start($yt); + include("print_index.php"); } else { switch($_GET["task"]){ case("youtube"): diff --git a/www/print_index.php b/www/print_index.php new file mode 100644 index 0000000..81e52a6 --- /dev/null +++ b/www/print_index.php @@ -0,0 +1,62 @@ +<?php +include("include.php"); +?> +<!Doctype html> +<head> +<title>Welcome</title> +<meta http-equiv='Content-type' content='text/html; charset=utf-8' /> +<link rel='shortcut icon' href='/favicon.ico' type='image/x-icon' /> +<link rel='stylesheet' type='text/css' href='style.css'/> +<style type='text/css'> +a2 { + color: blue; +} +tt { + text-align: center; +} +</style> +</head> + +<body vlink='#000000' link='#000000' alink='#9a9696'> +<center> +<? include("header.php"); ?> +<table align="center"><tr><td> +<h1> Welcome! </h1> +<? //<img src="404.jpg" alt="404 - not found"> ?> + +</td></tr><tr><td> +On this website, you can get a random +</td></tr><tr><td> +</td></tr><tr><td> +</td></tr><tr><td> +<ul> +<li> +<table><tr><td> +<a href="/youtube?id=<?php echo $videoID; ?>">YouTube video</a> +</td></tr></table> +</li> +<li> +<table><tr><td> +<a href="/puush">puush file</a> +</td></tr></table> +</li> +<li> +<table><tr><td> +<a href="/random">random subsite</a> +</td></tr></table> +</li> +</ul> +</td></tr> +<tr><td> +</td></tr><tr><td> +completely free and as often as you like. +</td></tr> +</table> + +<br><br> +For comments, questions or suggestions drop a <br> <a href="/about"><font color='blue'>mail</font></a>. + +<? include("piwik.php");?> + +</body> +</html> diff --git a/www/puush.php b/www/puush.php index 58b4ee6..5757360 100644 --- a/www/puush.php +++ b/www/puush.php @@ -1,3 +1,6 @@ +<?php +include("include.php"); +?> <!Doctype html> <head> <title>Random Youtube Video</title> @@ -8,47 +11,17 @@ <body vlnk='#5b5b5b' vlink='#000000' link='#000000' alink='#9a9696'> <center> <?php - include("header.php"); include("piwik.php"); ?> <h1>A random "puu.sh" file!</h1> <br> -<? -$count = 0; - -function get_image($count){ - - $puush_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($puush_array); - - $id = ""; - $string = ""; - - for ($i=0;$i<4;$i++){ - $index = mt_rand(0,$length-1); - $id = "$id".$puush_array[$index]; - } +<?php +$count = 0; +$count = 0; - if(fopen("https://puu.sh/" . $id, "r")){ - echo "<a href='https://puu.sh/" . $id . "'><img src='https://puu.sh/" .$id . "' alt='" . $id ."' ></a>"; - return $count; - } else { - $count = $count + 1; - if($count < 100){ - $count = get_image($count); - } else { - echo "We tried for " . $count . " times. Now is enough. <br><br>"; - echo "<a href='/puush'>Try again</a>"; - exit; - } - } - return $count; -} +$count = get_image($count); $count = get_image($count); diff --git a/www/youtube.php b/www/youtube.php index 866ffea..abf0a53 100644 --- a/www/youtube.php +++ b/www/youtube.php @@ -1,9 +1,11 @@ <?php -include("func_youtube.php"); +include("include.php"); if(!isset($_GET["id"])){ - $videoID = start($yt); + if(!isset($videoID)){ + $videoID = start($yt); + } } else { $videoID = $_GET["id"]; } |
