Initial commit
commit
d453d84a74
|
@ -0,0 +1,10 @@
|
||||||
|
* SURAGU.NET GUESTBOOK
|
||||||
|
Heredado del sitio web anterior, va como el puto culo y los cambios en
|
||||||
|
el código han sido /*MÍNIMOS*/
|
||||||
|
|
||||||
|
Inherited from the former website. It sucks ass and balls and the
|
||||||
|
changes in the code have been */MINIMAL/*
|
||||||
|
|
||||||
|
** TODO
|
||||||
|
Añadir un archivo con blacklists de palabras que estaba muy bien en su
|
||||||
|
dia para que los spammers no tocasen los huevos
|
|
@ -0,0 +1,113 @@
|
||||||
|
#!/bin/perl
|
||||||
|
|
||||||
|
use Cwd;
|
||||||
|
use CGI;
|
||||||
|
do {
|
||||||
|
my $q = CGI->new;
|
||||||
|
use DBD::Pg;
|
||||||
|
use utf8;
|
||||||
|
use utf8::all;
|
||||||
|
use Encode;
|
||||||
|
use Data::Dumper;
|
||||||
|
use HTML::Entities;
|
||||||
|
use feature "say";
|
||||||
|
my $username = "CHANGEME";
|
||||||
|
my $password = "CHANGEME";
|
||||||
|
my $host = "CHANGEME";
|
||||||
|
my $dbh = DBI->connect("dbi:Pg:dbname=guestbook;host=$host;port=5432",
|
||||||
|
$username,
|
||||||
|
$password,
|
||||||
|
{AutoCommit => 1, RaiseError => 1, PrintError => 1}
|
||||||
|
);
|
||||||
|
|
||||||
|
print $q->header(-charset => "utf-8");
|
||||||
|
|
||||||
|
my $sth = $dbh->prepare("select * from guestbook");
|
||||||
|
$sth->execute();
|
||||||
|
my $results = $sth->fetchrow_hashref;
|
||||||
|
|
||||||
|
my $EntriesMin = $results->{id};
|
||||||
|
|
||||||
|
$sth = $dbh->prepare("select * from guestbook order by ID desc");
|
||||||
|
$sth->execute();
|
||||||
|
$results = $sth->fetchrow_hashref;
|
||||||
|
my $EntriesMax = $results->{id};
|
||||||
|
|
||||||
|
open(my $fh, "<header.html");
|
||||||
|
print while <$fh>;
|
||||||
|
print "<div class='container'>";
|
||||||
|
print $q->h2("Libro de visitas de SURAGU.NET");
|
||||||
|
print $q->p("No compréis nada que se anuncie aquí, te timarían y yo me reiría de ti.");
|
||||||
|
print $q->p("Al igual que la version original, este libro de visitas tambien va como el puto culo");
|
||||||
|
print $q->p("<b>Negros de lainchan cometer suicidio</b>");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
print "<table id='entries' style='width:50%'>\n";
|
||||||
|
print "<tr>\n";
|
||||||
|
print "<th>ID</th>\n";
|
||||||
|
print "<th>Nombre</th>\n";
|
||||||
|
print "<th>Email</th>\n";
|
||||||
|
print "<th>Comentario</th>\n";
|
||||||
|
print "<th>País</th>\n";
|
||||||
|
print "<th>Fecha</th>\n";
|
||||||
|
|
||||||
|
print "</tr>\n";
|
||||||
|
# No se en que cojones estaba pensando mi yo de hace 3 años, pero
|
||||||
|
# vaya genio en verdad
|
||||||
|
|
||||||
|
for (my $x = $EntriesMax; $x >= $EntriesMin; $x--) {
|
||||||
|
$sth = $dbh->prepare("select * from guestbook where ID = $x");
|
||||||
|
$sth->execute();
|
||||||
|
my $data = $sth->fetchrow_hashref;
|
||||||
|
print "<tr>\n";
|
||||||
|
# Hay otakus que ponen cosas en japonés, codear todo en
|
||||||
|
# UTF-8 para que el navegador no se cague encima
|
||||||
|
my $Name = decode("utf8",$data->{name});
|
||||||
|
my $Website = $data->{website};
|
||||||
|
my $Email = $data->{email};
|
||||||
|
my $Comment = decode("utf8",$data->{comment});
|
||||||
|
my $Date = $data->{date};
|
||||||
|
my $Country = decode("utf8",$data->{country});
|
||||||
|
my $referenced_post_id;
|
||||||
|
$Name =~ s/<[^>]*>//g;
|
||||||
|
$Email =~ s/@/[at)/g;
|
||||||
|
$Email =~ s/<[^>]*>//g;
|
||||||
|
$Country =~ s/<[^>]*>//g;
|
||||||
|
$Website =~ s/<[^>]*>//g;
|
||||||
|
$Country =~ s/Israel/Palestine/g;
|
||||||
|
$Comment =~ s/<[^>]*>//g;
|
||||||
|
|
||||||
|
if ($Comment =~ /(\d+)/) {
|
||||||
|
$referenced_post_id = $1;
|
||||||
|
$Comment =~ s/^>>$referenced_post_id/<a href="#$referenced_post_id">>>$referenced_post_id<\/a>/;
|
||||||
|
}
|
||||||
|
|
||||||
|
print "<td id=\"$x\">$x</td>";
|
||||||
|
if ($Website eq "" ) {
|
||||||
|
print "<td>$Name</td>";
|
||||||
|
} else {
|
||||||
|
print "<td><a href='$Website'>$Name</a></td>";
|
||||||
|
}
|
||||||
|
print "<td>$Email</td>\n";
|
||||||
|
print "<td class='comment'>$Comment</td>\n";
|
||||||
|
print "<td>$Country</td>\n";
|
||||||
|
print "<td>$Date</td>\n";
|
||||||
|
|
||||||
|
print "</tr>\n";
|
||||||
|
}
|
||||||
|
print "</table>\n";
|
||||||
|
print "<h3>Firma el libro</h3>";
|
||||||
|
print "<form method='post' action='post.cgi'>\n";
|
||||||
|
print "<input name='name' placeholder='Nombre' type='text' required>\n";
|
||||||
|
print "<input name='website' placeholder='Sitio web (opcional)' type='text'>";
|
||||||
|
print "<input name='email' placeholder='email (opcional)' type='email'>\n";
|
||||||
|
print "<input name='comment' placeholder='comment' type='text' required>\n";
|
||||||
|
print "<input name='captcha' placeholder='Quinta de Do' required>\n";
|
||||||
|
print "<input id='country' placeholder='Pais' name='country' required>";
|
||||||
|
print "<input type='submit'>\n";
|
||||||
|
print "</form>\n";
|
||||||
|
print "</div>";
|
||||||
|
print "</body>\n";
|
||||||
|
print "</html>\n";
|
||||||
|
}
|
|
@ -0,0 +1,68 @@
|
||||||
|
#!/usr/bin/perl
|
||||||
|
|
||||||
|
use POSIX qw(strftime);
|
||||||
|
use CGI;
|
||||||
|
use DBD::Pg;
|
||||||
|
my $q = CGI->new;
|
||||||
|
|
||||||
|
my $username = "CHANGEME";
|
||||||
|
my $password = "CHANGEME";
|
||||||
|
my $host = "CHANGEME";
|
||||||
|
my $dbh = DBI->connect("dbi:Pg:dbname=guestbook;host=$host;port=5432",
|
||||||
|
$username,
|
||||||
|
$password,
|
||||||
|
{AutoCommit => 1, RaiseError => 1, PrintError => 1}
|
||||||
|
);
|
||||||
|
|
||||||
|
my $now = time();
|
||||||
|
my $Date = strftime('%Y-%m-%d', localtime($now));
|
||||||
|
|
||||||
|
print $q->header;
|
||||||
|
my $Name = $q->param("name");
|
||||||
|
my $Website = $q->param("website");
|
||||||
|
my $Email = $q->param("email");
|
||||||
|
my $Comment = $q->param("comment");
|
||||||
|
my $Country = $q->param("country");
|
||||||
|
my $Captcha = $q->param("captcha");
|
||||||
|
|
||||||
|
if ($Name eq "") {
|
||||||
|
print "Eres marrón\n";
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
if ($Comment eq "") {
|
||||||
|
print "Pero di algo desgraciado\n";
|
||||||
|
die;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$Website eq "") {
|
||||||
|
unless ($Website =~ /^(http|https):\/\//) {
|
||||||
|
print "El sitio web introducido no es valido (no empieza por http:// o https://)";
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!$Email eq "") {
|
||||||
|
unless ($Email =~ /.*@.*.\..*/ || $Email eq "sage") {
|
||||||
|
print "Pon un correo maricon";
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (length($Comment) > 200 ||length($Email) > 25 ||length($Name) > 25) {
|
||||||
|
print "Enhorabuena has superado el límite de caracteres";
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
unless ($Captcha eq "Sol" || $Captcha eq "sol") {
|
||||||
|
print "El filtro funciona bien :)";
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $req = $dbh->prepare('INSERT INTO guestbook(NAME, EMAIL, COMMENT, DATE, COUNTRY, website) VALUES (?, ?, ?, ?, ?, ?)');
|
||||||
|
$req->execute($Name, $Email, $Comment, $Date, $Country, $Website);
|
||||||
|
|
||||||
|
print "<head>";
|
||||||
|
print "<meta http-equiv=\"refresh\" content=\"0; url=/guestbook/guestbook.cgi\" />";
|
||||||
|
print "</head>";
|
||||||
|
print "<p>Añadido satisfactoriamente</p>";
|
Loading…
Reference in New Issue