#!/usr/local/bin/perl -w
require 5.002;
use LWP;
use LWP::UserAgent;
use HTTP::Request::Common qw(POST);
my $errors = 0;
my $error_string = "";
my ($sec,$min,$hr,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
my $y = $year;
$year = $year + 1900;
$mon = $mon + 1;
if ($mday < 10) { $mday = '0' . $mday; }
# if ($mon < 10) { $mon = '0' . $mon; }
#Get MaximumCash
my $ua = LWP::UserAgent->new;
my $url = 'http://stats.maximumcash.com/support/stats.cgi';
my $req = HTTP::Request->new('POST',"$url");
my $content = "";
$req->content_type ('application/x-www-form-urlencoded');
$req->authorization_basic('glamazon', 'romana1');
my $obj = $ua->request($req);
my $maxcash ="";
if ($obj->is_success()) {
$content = $obj->as_string;
$_ = $content;
@monies = m/(\d+\.\d+)/sg;
@monies = reverse @monies; #count from the end
$maxcash = $monies[1];
}
else {
$errors = $errors + 1;
$error_string = $error_string .
"Error getting from MaximumCash: " .
$obj->message ."
";
}
#Get CyberErotica
my $ua = LWP::UserAgent->new;
$url ='http://208.201.208.83/cgi-bin/stats-rrr.cgi/14570/570291106/0';
my $req = HTTP::Request->new('GET',"$url");
$obj = $ua->request($req);
my $cybererotica ="";
if ($obj->is_success()) {
$content = $obj->as_string;
$_ = $content;
@monies = m/(\$\d+\.\d+)/sg;
@monies = reverse @monies; #count from the end
$_ = $monies[0];
s/\$//;
$cybererotica = $_;
}
else {
$errors = $errors + 1;
$error_string = $error_string .
"Error getting from CyberErotica: " .
$obj->message ."
";
}
#Get CashQuest
$ua = LWP::UserAgent->new;
$url = 'http://www.cashquest.net/sys/stats/main';
$req = HTTP::Request->new('POST',"$url");
$content = "";
$req->content_type ('application/x-www-form-urlencoded');
$req->authorization_basic('kurth', 'glamazon');
$obj = $ua->request($req);
my $cashquest ="";
if ($obj->is_success()) {
$content = $obj->as_string;
$_ = $content;
@monies = m/(\d+\.\d+)/sg;
@monies = reverse @monies; #count from the end
$cashquest = $monies[0];
}
else {
$errors = $errors + 1;
$error_string = $error_string .
"Error getting from MaximumCash: " .
$obj->message ."
";
}
#Get Gamma
$ua = LWP::UserAgent->new;
$url ='http://cgi.gammae.com/view.cgi?1100+heoli4';
$req = HTTP::Request->new('GET',"$url");
$obj = $ua->request($req);
my $gamma ="";
if ($obj->is_success()) {
$content = $obj->as_string;
$_ = $content;
@monies = m/(\$\d+\.\d+)/sg;
@monies = reverse @monies; #count from the end
$_ = $monies[0];
s/\$//;
$gamma = $_;
}
else {
$errors = $errors + 1;
$error_string = $error_string .
"Error getting from Gamma: " .
$obj->message ."
";
}
#Get Epoch
$ua = LWP::UserAgent->new;
$url = 'http://reports.epochsystems.com/servlet/reportEngineNew';
$req = HTTP::Request->new('POST',"$url");
my $contentstr = "username=2811&password=musfm007" .
"&rdo_merchant=reseller&rdo_choice=reports" .
"&resellerCode=null&compCode=red&view=previous&reports=netsales" .
"&startMonth=" . $mon . "&startDay=01" . "&startYear=" . $year .
"&startHour=12&startMinute=00&startAMPM=AM" .
"&endMonth=" . $mon . "&endDay=$mday" . "&endYear=" . $year .
"&endHour=12&endMinute=00&endAMPM=AM&groupby=prod";
$req->content_type ('application/x-www-form-urlencoded');
$req->content ($contentstr);
my $obj = $ua->request($req);
my $truecash ="";
if ($obj->is_success()) {
$content = $obj->as_string;
$_ = $content;
@monies = m/(\d+\.\d+)/sg;
@monies = reverse @monies; #count from the end
$truecash = $monies[0];
#print "@monies\n";
#$cents3 = $cents3 * 100;
}
else {
$errors = $errors + 1;
$error_string = $error_string .
"Error getting from Epoch Systems: " .
$obj->message ."
";
}
my $total = $maxcash + $cashquest + $cybererotica + $gamma + $truecash;
my $daily_average = 0;
if ($mday < 16){$daily_average = ($total/$mday)}
else {$daily_average = ($maxcash/$mday) + (($cashquest + $cybererotica + $gamma + $truecash)/($mday - 15))};
#works only for period #1 really!
my $daily_formatted = sprintf("%.2f",$daily_average);
my $total_formatted = sprintf("%.2f",$total);
my $projected = sprintf("%.2f",($daily_average * 30));
print "Content-type: text/html\n\n";
print "