-if ($url = $res->fetchOneCell()) {
- $url = preg_replace('@/+$@', '', $url);
- if ($path) {
- http_redirect("http://$url/$path");
- } else {
- http_redirect("http://$url");
+if ($username && !is_null($user = User::getSilent($username))) {
+ $url = XDB::fetchOneCell('SELECT url
+ FROM carvas
+ WHERE uid = {?}', $user->id());
+ if ($url) {
+ $url = preg_replace('@/+$@', '', $url);
+ if ($path) {
+ http_redirect("http://$url/$path");
+ } else {
+ http_redirect("http://$url");
+ }