shortThisUrl($newURL, $newname); if(is_bool($ret) && !$ret){ $_SESSION['msg'] .= ShortURL::STATE_ERROR; } elseif($ret === ShortURL::STATE_ALREADY_EXIST){ $_SESSION['msg'] .= $ret; } else{ $URI = $_SERVER['REQUEST_URI']; $folders = explode('/', $URI); if(count($folders) > 2){ $folder = '/'.$folders[1].'/'; }else $folder = '/'; $_SESSION['msg'] .= 'Raccourci créé : http://'.$_SERVER['SERVER_NAME'].$folder.rawurlencode($newname).''; } header('Location: '.$folder);