diff --git a/submit.php b/submit.php index 58ccda9..06d3e95 100644 --- a/submit.php +++ b/submit.php @@ -35,9 +35,16 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') // Normalize Link $link = trim ($_POST['link']); - $link_components = parse_url ($link); - if (!isset ($link_components['scheme'])) - $link = 'http://' . $link; + + // If no link given, keep an empty string + if (strlen ($link) > 0) + { + $link_components = parse_url ($link); + + // Make sure there's a "scheme" + if (!isset ($link_components['scheme'])) + $link = 'http://' . $link; + } // Add the new post $post_hash_id = $db->new_post ($title, $link, $_POST['text'], Session::get_userid());