summaryrefslogtreecommitdiff
path: root/www/functions/func_puush.php
diff options
context:
space:
mode:
Diffstat (limited to 'www/functions/func_puush.php')
-rw-r--r--www/functions/func_puush.php34
1 files changed, 34 insertions, 0 deletions
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;
+}
+