index.cgi 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #!/usr/bin/perl
  2. # This file is part of qorg11 blog
  3. # qorg11 blog is free software: you can redistribute it and/or modify
  4. # it under the terms of the GNU General Public License as published by
  5. # the Free Software Foundation, either version 3 of the License, or
  6. # (at your option) any later version.
  7. # qorg11 blog is distributed in the hope that it will be useful,
  8. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. # GNU General Public License for more details.
  11. # You should have received a copy of the GNU General Public License
  12. # along with qorg11 blog. If not, see <https://www.gnu.org/licenses/>.
  13. use SQLite::DB;
  14. use Data::Dumper;
  15. use CGI;
  16. my $q = CGI->new;
  17. my $db = SQLite::DB->new('articles.sqlite');
  18. $db->connect;
  19. # Get number of entires
  20. my $EntriesMin = $db->select_one_row("select * from blog")->{ID};
  21. my $EntriesMax = $db->select_one_row("select * from blog order by id desc")->{ID};
  22. print "Content-type: text/html\n\n";
  23. print "<!DOCTYPE html>";
  24. print "<html lang=es>";
  25. print "<head>";
  26. print "<meta charset=utf-8>";
  27. print "<title>Blog qorg</title>";
  28. print "<link rel='stylesheet' href='https://qorg.duckdns.org/css/styles.css'>";
  29. print "<style> p{max-width: 800px;} body{background-color:black;} h3,b,i,h1,p{color:white;} .border{border-style:solid; border-color:red;}</style>";
  30. print "</head>";
  31. print " <div class='header'>
  32. <a href='/'>
  33. <img alt='lain' src='/img/favicon.gif' width='100' height='100'>
  34. </a>
  35. <div class='menu'>
  36. <a href='/info.html'>Información</a>
  37. <a href='https://vid.qorg.duckdns.org'>vídeos</a>
  38. <a href='https://underflow.ga'>página de dmg</a>
  39. </div>
  40. </div>
  41. ";
  42. for(my $x = $EntriesMax; $x >= $EntriesMin; $x-- ) {
  43. print "<div class='border'>";
  44. my $entries = $db->select_one_row("select * from blog where id == $x");
  45. print "<h3 id='$entries->{ID}' >$entries->{TITLE}</h3>";
  46. print "<p>$entries->{CONTENT}</p>";
  47. print "<p>publicado $entries->{DATE}</p>";
  48. print "</div>";
  49. }
  50. print "</body>";
  51. print "</html>";