Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added reverse option to text.pl. It was quicker to do in perl then js

  • Loading branch information...
commit 498d07c753a42b14e7b619dd2b39b6f81c4a4ba9 1 parent 5ebea80
@kthakore kthakore authored
Showing with 10 additions and 2 deletions.
  1. +10 −2 cgi/text.pl
View
12 cgi/text.pl
@@ -21,14 +21,22 @@
my $dbh = get_dbh();
my $channel = $q->param('channel') || $default_channel;
+my $reverse = $q->param('reverse') || 0;
+
my $date = $q->param('date') || gmt_today;
if ($channel !~ m/^\w+(?:-\w+)*\z/sx){
# guard against channel=../../../etc/passwd or so
confess 'Invalid channel name';
}
-my $db = $dbh->prepare('SELECT nick, timestamp, line FROM irclog '
- . 'WHERE day = ? AND channel = ? AND NOT spam ORDER BY id');
+
+#Check for reverse
+my $statement = 'SELECT nick, timestamp, line FROM irclog '
+ . 'WHERE day = ? AND channel = ? AND NOT spam ORDER BY id';
+
+$statement .= ' DESC' if $reverse;
+
+my $db = $dbh->prepare($statement);
$db->execute($date, '#' . $channel);
Please sign in to comment.
Something went wrong with that request. Please try again.