shortThisUrl($url, $s); if(is_bool($ret) && !$ret){ echo 'alert("'.ShortURL::STATE_ERROR.'");'; exit; } elseif($ret === ShortURL::STATE_ALREADY_EXIST){ echo 'alert("'.$ret.'");'; exit; } else{ $URI = $_SERVER['REQUEST_URI']; $folders = explode('/', $URI); if(count($folders) > 2){ $folder = '/'.$folders[1].'/'; }else $folder = '/'; echo 'alert("'.ShortURL::STATE_CREATED.' : http://'.$_SERVER['SERVER_NAME'].$folder.rawurlencode($s).'");window.clipboardData.setData("Text", "http://'.$_SERVER['SERVER_NAME'].$folder.rawurlencode($s).'");'; exit; }