From 9e5495e169ef0cb888a91a1ead62bc81e1b2bdba Mon Sep 17 00:00:00 2001 From: piernov Date: Sun, 21 Oct 2012 21:40:48 +0200 Subject: Correction encodage UTF-8, correction pageur + ajout champ séléction page latest.cgi MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- latest.cgi | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'latest.cgi') diff --git a/latest.cgi b/latest.cgi index 30ee24a..18ba1e5 100755 --- a/latest.cgi +++ b/latest.cgi @@ -14,7 +14,7 @@ require 'header' puts header_bdg() cgi=$cgi -if cgi['page'] =~ /\d*/ +if cgi['page'] =~ /\d+/ current_page = cgi['page'].to_i else current_page = 1 @@ -27,13 +27,27 @@ puts <

Dernières blagues ajoutés

-
+ +
+
+
+ + +
+
+
+
+ HTML_BDG -num_bdg = 0 -db.execute("SELECT count(id) FROM blague").each { |row| num_bdg = row[0].to_i } +num_page = 0 +db.execute("SELECT count(id) FROM blague").each { |row| num_page = row[0].to_s.chop.to_i+1 } + +if current_page > num_page then + current_page = num_page +end + -num_page = ((num_bdg+11)/10+1) i = 0 if current_page > 5 then i = current_page @@ -77,7 +91,7 @@ puts"
" i = 0 -db.execute("SELECT * FROM blague WHERE id < ((SELECT id FROM blague ORDER BY id DESC LIMIT 1)-#{(current_page*10)-11}) ORDER BY id DESC LIMIT 10").each { |row| +db.execute("SELECT * FROM blague WHERE id <= #{current_page-1}9 AND id >= #{current_page-1}0 ORDER BY id DESC LIMIT 10").each { |row| unless row[1] == "" if i.modulo(2) == 1 parity = " impair" -- cgit v1.2.3-54-g00ecf