Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- usr/bin/perl
- use strict;
- use Digest::SHA1 qw(sha1 sha1_hex sha1_base64);
- require "webpermit/db.cgi";
- print "Content-Type: text/html\n\n";
- if ($ENV{'REQUEST_METHOD'} eq 'GET')
- {
- print "Enter your moderator id below:
- <form action=\"moderator.cgi\" method=\"post\">
- <input type=\"hidden\" name=\"action\" value=\"login\">
- <input type=\"text\" name=\"id\" size=15>
- <input type=\"submit\" value=\"log in\"></form>";
- }
- else
- {
- my $data;
- read (STDIN, $data, $ENV{'CONTENT_LENGTH'});
- my ($action, $id, $account) = split('&', $data);
- $action =~ s/^action=//;
- $id =~ s/^id=//;
- $account =~ s/^account=//;
- if (validkey($id) != 0)
- {
- if ($action eq 'view')
- {
- my $cx = 0;
- my @labels = ('username', 'password', 'email address', 'first name', 'middle name', 'last name', 'month of birth', 'day of birth', 'year of birth', 'gender', 'marital status', 'country', 'state', 'city', 'address', 'phone number', 'occupation', 'income', 'dependents', 'first interest/hobby', 'second interest/hobby', 'third interest/hobby', 'fourth interest/hobby', 'fifth interest/hobby', 'about');
- my @ret = getuser($account);
- if (defined($ret[1]))
- {
- if (isadmin($ret[0]))
- {
- print "<b>Admin Account</b>";
- }
- while (defined($ret[$cx]))
- {
- if ($cx == 1)
- {
- print "$labels[$cx]: $ret[$cx]\n";
- print "Sha1 hash: ".sha1_hex("xG1lxrKu$ret[$cx]")."\n";
- }
- else
- {
- print "$labels[$cx]: $ret[$cx]\n";
- }
- $cx++;
- }
- }
- else
- {
- print "That user doesn't exist.";
- }
- }
- elsif ($action eq 'email')
- {
- my @ret = getuser($account);
- if (isadmin($account) || !$ret[0])
- {
- print "Couldn\'t load user\'s email records.";
- }
- else
- {
- print getmail($account);
- }
- }
- else
- {
- print "<html><head><title>Moderator Panel</title></head><body>
- <center>
- <h3>Welcome to the moderator panel</h3>
- <form action=\"moderator.cgi\" method=\"post\">
- <input type=\"hidden\" value=\"view\" name=\"action\">
- <input type=\"hidden\" value=\"$id\" name=\"id\">
- View Account Info: <input type=\"text\" name=\"account\" size=20 value=\"\">
- <input type=\"submit\" value=\"Submit\">
- </form>
- <form action=\"moderator.cgi\" method=\"post\">
- <b>Email:</b>
- <input type=\"hidden\" value=\"email\" name=\"action\">
- <input type=\"hidden\" value=\"$id\" name=\"id\">
- View Email Traffic: <input type=\"text\" name=\"account\" size=20 value=\"\">
- <input type=\"submit\" value=\"Submit\">
- </form>
- </center>
- </body></html>";
- }
- }
- else
- {
- print "You have entered an invalid id.";
- }
- }
- sub validkey
- {
- if (not($_[0] =~ /[A-Z]|[a-z]|[0-9]/))
- {
- return 0;
- }
- my @idchars = split(//, $_[0]);
- my ($total, $counter, $char) = (0, 0);
- while(defined($idchars[$counter]))
- {
- $char = $idchars[$counter];
- $total += (ascii($char)+($total*$counter));
- $counter++;
- }
- if ($total > 925559 && $total < 927901)
- {
- return $total;
- }
- else
- {
- return 0;
- }
- }
- sub ascii
- {
- my (@str, $pos, $offset);
- if ($_[0] =~ /[0-9]/)
- {
- @str = split(//, '0123456789');
- $offset = 48;
- }
- elsif ($_[0] =~ /[A-Z]/)
- {
- @str = split(//, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ');
- $offset = 65;
- }
- elsif ($_[0] =~ /[a-z]/)
- {
- @str = split(//, 'abcdefghijklmnopqrstuvwxyz');
- $offset = 97;
- }
- else
- {
- return 0;
- }
- $pos = 0;
- while (defined($str[$pos]))
- {
- if ($_[0] eq $str[$pos])
- {
- return ($pos+$offset);
- }
- $pos++;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement