From 9f428482a4ed20f36512f8255e8e80075c239af5 Mon Sep 17 00:00:00 2001 From: Dennis Eriksen Date: Fri, 15 May 2020 10:34:47 +0200 Subject: I'm adding a + in front of the short URL, because I want to use another domain for this. It should probably be optional, but what the heck. I'm probably the only one using this. --- form.cgi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'form.cgi') diff --git a/form.cgi b/form.cgi index 4e3f9d3..d9db8ba 100755 --- a/form.cgi +++ b/form.cgi @@ -26,10 +26,10 @@ if ($q->param('url')) { # create database handler my $dbh = DBI->connect("dbi:Pg:dbname=purl") or die $DBI::errstr; - + # SQL Query my $query = qq(SELECT shorts.url FROM shorts WHERE shorts.short = ?;); - + # Check if short exists. If it does, generate a new one. while (my $url = $dbh->selectrow_array($query, undef, $short)) { $results .= "Your short exists. Generating new.
\n"; @@ -45,7 +45,7 @@ if ($q->param('url')) { my $proto = $ENV{'HTTPS'} eq "on" ? 'https://' : 'http://'; # http/https - my $shortURL = $proto . $ENV{'SERVER_NAME'} . '/' . $short; + my $shortURL = $proto . $ENV{'SERVER_NAME'} . '/+' . $short; $results .= "URL: $url
\n"; $results .= "Shortened to: $shortURL
\n"; $results .= "
\n"; -- cgit v1.2.3