From 544d037ba31bee5627b0006781e767508d26bec1 Mon Sep 17 00:00:00 2001 From: Dennis Eriksen Date: Wed, 17 Aug 2022 07:09:56 +0200 Subject: keep generating new short if we get a match --- form.cgi | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/form.cgi b/form.cgi index 05bfbd6..1cb91e4 100755 --- a/form.cgi +++ b/form.cgi @@ -1,5 +1,5 @@ #!/bin/perl -wT -# (c) 2019 Dennis Eriksen +# (c) 2019-2022 Dennis Eriksen use strict; use warnings; @@ -34,13 +34,12 @@ if ($q->param('url')) { while (my $url = $dbh->selectrow_array($query, undef, $short)) { $results .= "Your short exists. Generating new.
\n"; $short = genshort(); - last; } # Insert short and url into database $query = qq(INSERT INTO shorts (url, short, created_by) VALUES (?, ?, ?);); my $sth = $dbh->prepare( $query ); - my $rv = $sth->execute($url, $short, $user) or die $sth->errstr; + $sth->execute($url, $short, $user) or die $sth->errstr; $dbh->disconnect(); -- cgit v1.2.3