403Webshell
Server IP : 208.122.213.31  /  Your IP : 216.73.216.185
Web Server : Apache
System : Linux msd6191.mjhst.com 4.18.0-553.137.1.el8_10.x86_64 #1 SMP Wed Jun 24 11:40:24 UTC 2026 x86_64
User : WHMCS_MIA_382 ( 1001)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/httpd/html/baberankings.com.bak/cgi-bin/votedata/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/httpd/html/baberankings.com.bak/cgi-bin/votedata/ratem2.cgi
#!/usr/bin/perl
################################################################################
#
#Rate a site version 1
#GB Resources http://cgi-resource.co.uk
#
#Links in success and error page must be left intact
#
################################################################################

getdata(%fields);

################################################################################
#paths to where you want to put the data files and where your graph images are.
#
$dpaths = "votedata";
$ipaths = "http://www.baberankings.com/cgi-bin/votedata";
$cgi_path = "../cgi-bin";
################################################################################
print "Content-type: text/html\n\n";

if ($fields{'rating'}){
  &vote;
}
elsif ($fields{'breakdown'}){
  &breakdown;
}
else {
  &display;
}

sub vote {
################################################################################
my ($data, $id, $votes, $nvotes, $rating, $nrating, $ip, $count, $i, $rateb);
$id = $fields{'id'};
if (open(VOTE,"$dpaths/rate2m$id.txt")) {
   chomp ($data = <VOTE>);
   chomp ($rateb = <VOTE>);
   close(VOTE); 
   ($votes, $rating, $ip) = split(/\|/,$data);
  print "error no rating given, please go back and select a rating" and return unless (($fields{'rating'} > 0) and ($fields{'rating'} < 11));

   &vote_error and return if ($ENV{'REMOTE_ADDR'} eq $ip);
   $nvotes = $votes + 1;
   $nrating = sprintf ("%.2f", ((($rating*$votes) + $fields{'rating'})/$nvotes));
   my @votes = split(/\|/,$rateb);

   open (VOTE, ">$dpaths/rate2m$id.txt") or die("doh, there is the following problem: $! \n");
   print VOTE "$nvotes|$nrating|$ENV{'REMOTE_ADDR'}\n";
   foreach $i (@votes){
     $count++;
     if ($count == $fields{'rating'}){
       $i = $i + 1;
       print VOTE "$i|";
     }
     else {
       print VOTE "$i|";
     }
    }
 close VOTE; 
}
else {
  open (VOTE, ">$dpaths/rate2m$id.txt") or die("doh, there is the following problem: $! \n");
  print VOTE "1|$fields{'rating'}|$ENV{'REMOTE_ADDR'}\n";
  foreach $i (1..10){
    $count++;
    if ($count == $fields{'rating'}){
    print VOTE "1|";
   }
   else {
     print VOTE "0|";
   }
 }
  close VOTE; 
 }
 &vote_success;
}

sub display {
################################################################################
  my ($data, $id, $votes, $nvotes, $rating, $nrating, $ip);
$id = $fields{'id'};
print "error no id number defined" and return if (!$id);
print qq|<form action="$ENV{'SCRIPT_NAME'}" METHOD=POST>
<input type="hidden" name="id" value="$id">
<SELECT name="rating" style="font-size: 8">
<OPTION>---</OPTION>
<OPTION>1</OPTION>
<OPTION>2</OPTION>
<OPTION>3</OPTION>
<OPTION>4</OPTION>
<OPTION>5</OPTION>
<OPTION>6</OPTION>
<OPTION>7</OPTION>
<OPTION>8</OPTION>
<OPTION>9</OPTION>
<OPTION>10</OPTION>
</SELECT>
<input type="submit" value="Vote" style="font-size: 8">
<font FACE="Verdana,Sans-Serif" SIZE="-1">|;

if (open (VOTE,"$dpaths/rate2m$id.txt")){
  chomp ($data = <VOTE>);
close(VOTE);     
($votes, $rating, $ip) = split(/\|/,$data);
$rate = int($rating);
#print out the html

  print qq|
  Votes:<b>$votes</b>   
Rating:
</font>
<a href="javascript:;" onClick="window.open('$cgi_path/ratem2.cgi?id=$id&breakdown=yes','','width=300,height=400,resizable=yes,scrollbars=1')">
<IMG SRC="$ipaths/gbar$rate.gif" ALT="Rating = $rating" border=0>
Ratings Breakdown</a>
</form>
|;    
}
else {
  print qq|
 Not votes yet!</font></form>|;
}

}


sub breakdown {
################################################################################
  my ($count2, $ip, $data, $count, $t, $contents, $i, $total, $id, $id, $lrate, $hrate, $height);
$id = $fields{'id'};
print "error no id number defined" and return if (!$id); 
 $lrate = 11;
  $hrate = $count2 = 0;
  open(VOTE,"$dpaths/rate2m$id.txt") or die("doh!: $! \n");
    chomp ($d = <VOTE>);
    chomp ($data = <VOTE>);
  close(VOTE);     
  my @votes = split(/\|/,$data);
 
  foreach $i (@votes){
    $count++;
    $total = $total + $i;
    if ($i){
      ($hrate = $count) if ($hrate < $count);
      ($lrate = $count) if ($lrate > $count);
     }
    }
  foreach $i (@votes) {
  $count2++;

if ($total > 5){
  $height = int(($i/$total)*400);
}
else{
  $height = int(($i/$total)*200);
}

  if ($i){
if ($i > 1){
    $contents .= qq|<td VALIGN=BOTTOM BGCOLOR="#999999"><img SRC="$ipaths/cbar2.jpg" height=1 width=20 alt="$i people gave a rating of $count2"><br><img SRC="$ipaths/cbar1.jpg" height=$height width=20 alt="$i people gave a rating of $count2"></td>|;
     }
else{
    $contents .= qq|<td VALIGN=BOTTOM BGCOLOR="#999999"><img SRC="$ipaths/cbar2.jpg" height=1 width=20 alt="$i person gave a rating of $count2"><br><img SRC="$ipaths/cbar1.jpg" height=$height width=20 alt="$i person gave a rating of $count2"></td>|;
}

}
  else {
    $contents .= qq|<td VALIGN=BOTTOM BGCOLOR="#999999"><img SRC="$ipaths/cbar2.jpg" height=1 width=20 alt="$i people gave a rating of $count2"><br></td>
  |;
  }
 }
  
print qq|  <center>Breakdown of ratings given
<table BORDER=0 CELLSPACING=0 CELLPADDING=0 COLS=1 WIDTH="105" >
<tr>
<td BGCOLOR="#000000">
<table BORDER=0 CELLPADDING=0 COLS=5 WIDTH="100%" >
<tr>
$contents
</tr>
<tr>
|;

foreach $i (1..10) {
  print qq|
  <td><font color=white>$i</font></td>|;
 }

print qq|
</tr>
</table>
</td>
</tr>
</table><br>
Ratings given $total 
<br>
Highest rating $hrate
<br>
Lowest rating $lrate
<br><br>
<a href="javascript:self.close()">close window</a></center>
|;    
}

sub vote_success {
################################################################################
#print a success page
 print qq|
<html>
  <head>
    <title>
      Vote success
    </title>
  </head>
  <body>
     <b> Vote added:</b>
     <br>
     <br>
     Thanks for the vote.
 <br><br> <br>
  </body>
</html>
|;
}

sub vote_error {
################################################################################
#print an error page
 print qq|
<html>
  <head>
    <title>
      Error voting
    </title>
  </head>
  <body>
      <b>Vote error:</b><br><br>
     You have already voted recently!
      <br><br><br> 
  </body>
</html>
|;
}

sub getdata {
################################################################################
    my ($buffer);

    if ($ENV{'REQUEST_METHOD'} eq 'GET') {
        $buffer = $ENV{'QUERY_STRING'};
    }
    else {
        read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
    }

    foreach (split(/&/, $buffer)) {
        my($key, $value) = split(/=/, $_);
        $value =~ tr/+/ /;
        $value =~ s/%(..)/pack('c', hex($1))/eg;
        $fields{$key} = $value;
    }
}


Youez - 2016 - github.com/yon3zu
LinuXploit