+
Welcome to the UnPS-GAMA link shortner
+
All you gotta do is put a link into the box and click submit
+ + + + + + Here's the link: http://unps.us/?l=$short"; // Return link that's already in table + } + }else{ // If no row is returned, it is assumed that the link isn't there + if (strpos(strtolower($dest), 'http://') === false) { // Simple test to see if http:// not part of the link + if (strpos(strtolower($dest), 'https://') === false){ // Simple test to see if https:// not part of the link passing the above check + $ip = gethostbyname($dest); // Get IP address of link + $dest = 'http://'.$dest; // Add http:// to link + } + } + if (strpos(strtolower($dest), 'http://') !== false) { // Simple test to see if http:// is part of the link + if (strpos(strtolower($dest), 'https://') !== false){ // Simple test to see if https:// is part of the link failing the above check + $dest = str_replace("https://", "", $dest); // If https:// exists, remove it + $ip = gethostbyname($dest); // Get IP address of link + $dest = 'https://'.$dest; // Re-add https:// to link + } + $dest = str_replace("http://", "", $dest); // if http:// exists, remove it + $ip = gethostbyname($dest); // Get IP address of link + $dest = 'http://'.$dest; // Re-add http:// to link + } + if(GetServerStatus($ip, 80) != "online") die("Hmmm it seems that your link is dead.\r\nPlease try again"); // Check to see if the host is alive + $short = substr(number_format(time() * rand(),0,'',''),0,10); // Create a random number 10 digits long + $short = base_convert($short, 10, 36); // Convert the 10 digit random number into Base36 + $sql="INSERT INTO $tbl_name (link, shortlink) VALUES ('$dest', '$short')"; // Try to add the link and short link into table + $result=mysql_query($sql); // mysql stuff + if($result){ // If the link is added to the table + echo "It appears that I have succeded in making a short link.You'll find it here: http://unps.us/?l=$short "; + }else { // If the link is not added to the table + echo "There was a problem trying to register your link - Could be a database error"; + } + } } - } - if (strpos($dest, 'http://') !== false) { - if (strpos($dest, 'https://') !== false){ - $dest = str_replace("https://", "", $dest); - $ip = gethostbyname($dest); - $dest = 'https://'.$dest; + if(!$dest){ // If the textbox was empty when loaded + echo ' +
Sorry, you are not able to shorten something without a url
\r\n + Home + '; + } } - $dest = str_replace("http://", "", $dest); - $ip = gethostbyname($dest); - $dest = 'http://'.$dest; - } - if(GetServerStatus($ip, 80) != "ONLINE") die("Hmmm it seems that your link is dead.\r\nPlease try again"); - $short = substr(number_format(time() * rand(),0,'',''),0,10); - $short = base_convert($short, 10, 36); - $sql="INSERT INTO $tbl_name (link, shortlink) VALUES ('$dest', '$short')"; - $result=mysql_query($sql); - if($result){ - echo "It appears that I have succeded in making a short link.
You'll find it here: http://unps.us/?l=$short "; - }else { - echo "There was a problem trying to register your link - Could be a database error"; - } - } - } - if(!$dest){ - echo ' - Sorry, you are not able to shorten something without a url
- Back to index
- Home - '; - } -} -mysql_close(); -?> + mysql_close(); // Close any mysql connections still open + ?> +