#!/usr/local/bin/perl use CGI; $q = new CGI; use CGI::Carp qw(fatalsToBrowser); foreach ($q->param) {${$_} = $q->param($_);} require "/home/sniper/public_html/milyuner.com/cgi-bin/mlounge/config.cgi"; require "/home/sniper/public_html/milyuner.com/cgi-bin/mlounge/common.cgi"; &Create_DB_Connection; if (!$id) {&get_random;} $SQL = "SELECT * FROM users WHERE BINARY Username = '$id'"; &Do_SQL; $row = $sth->fetchrow_hashref; if ($row->{'Status'} =~ /VALIDATED/ig) {&print_default("Member ini belum melakukan proses validasi.");exit;} if ($row->{'Status'} =~ /PENDING/ig) { if ($row->{'Premium'} =~ /PENDING/ig) { &print_default("Member ini belum bisa mereferensikan kepada orang lain.");exit; } } $check_usr = $row->{'Username'}; if (!$check_usr) {&get_random;} ########### # GRAB SOME NECESSARY INFO ########### $referer = $q->referer(); $ip = $q->remote_addr(); if ($referer eq "") {$referer = "(unknown)";} $time = time() + 43200; ########### # PARSE THE QUERY STRING ########### if ($clickthru_as_a_dir) { $id = "$ENV{PATH_INFO}"; $id =~ s/\///; ($id,@page) = split (/\//, $id); foreach $item (@page) { $page .= "$item/"; } chop $page; if ($page !~ /http\:\/\//i && $page) { $page = "http://$page"; } } $num_sites = @extra_sites; if ($num_sites && $use_page && $page) { foreach $item (@extra_sites) { $i++; if ($page eq $i) { $page = $item; } $item =~ s/www\.//ig; if ($page =~ /$item/ig && $item) { $goahead = "OK"; } } } if ($referer eq "") {$referer = "(unknown)";} if ($campaign) { $referer = "$campaign"; } ########### # ESTABLISH WHETHER THE HIT IS UNIQUE OR NOT ########### $getcookie = $q->cookie(-name=>$cookiename); if (!$getcookie || $write_over_cookie) { $setcookie++;} $cookie = $q->cookie(-name=>$cookiename, -value=>$id, -expires=>$cookietime, -path=>'/'); $unique++; if ($getcookie) { $unique = 0; } if (!$getcookie) { $SQL = "SELECT * FROM mln_hits WHERE Ip LIKE \'$ip\' && Id LIKE \'$id\'"; &Do_SQL; if ($sth->fetchrow_hashref) { $unique = 0; } } ########### # PREPARE COOKIES AND VERIFY THAT THE AFFILIATE ID EXISTS ########### $SQL = "SELECT * FROM users WHERE BINARY Username = '$id'"; &Do_SQL; ########### # DO ALL THE MAJOR HIT, CAMPAIGN, AND REFERRER LOGGING ########### if ($sth->fetchrow_hashref && $id) { &date; $temp1 = $day . "day"; $temp2 = $day . "u_day"; $SQL = "UPDATE mln_primary_hits SET $temp1 = ($temp1 + 1), $temp2 = ($temp2 + $unique), Month_Total = (Month_Total + 1), Month_Unique = (Month_Unique + $unique) WHERE Id = '$id' && Month LIKE '$month' && Year LIKE '$year'";&Do_SQL; if(!$sth->rows) { $SQL = "INSERT INTO mln_primary_hits (Id,Year,Month) VALUES ('$id','$year','$month')";&Do_SQL; $SQL = "UPDATE mln_primary_hits SET $temp1 = ($temp1 + 1), $temp2 = ($temp2 + $unique), Month_Total = (Month_Total + 1), Month_Unique = (Month_Unique + $unique) WHERE Id = '$id' && Month LIKE '$month' && Year LIKE '$year'";&Do_SQL; } if ($write_over_cookie) { $SQL = "UPDATE mln_hits SET Id = '$id' WHERE Ip LIKE '$ip'"; &Do_SQL; } if ($hit_time_on) { $SQL = "INSERT INTO mln_hits (Date,Id,Ip) VALUES ('$time','$id','$ip')"; &Do_SQL; if ($hit_time < $sth->{insertid}) { $SQL = "DELETE FROM mln_hits"; &Do_SQL; } } if ($referers_on) { $SQL = "UPDATE mln_referers SET Total = (Total + 1), Unique_hits = (Unique_hits + $unique) WHERE Id = '$id' && Referer = '$referer'"; &Do_SQL; if(!$sth->rows) { $SQL = "INSERT INTO mln_referers (Date,Id,Referer,Total,Unique_hits) VALUES ('$time','$id','$referer','1','$unique')"; &Do_SQL; }} } ########### # SEND OFF AN IMAGE FOR THOSE WITH REPLICATED WEBSITES ########### if ($click_as_image eq 1) { if (!$getcookie || $write_over_cookie) { print $q->header(-type=>"image/gif", -cookie=>$cookie); } else { print $q->header(-type=>"image/gif"); } open (FILE, "$invis_graphic_path"); flock(FILE, 2); print ; flock(FILE, 8); close (FILE); exit; } ########### # REDIRECT THE CLICK TO THE APPROPRIATE SITE AND SET THE COOKIE ########### if ($setcookie) { if ($page =~ /$page_domain/ig && $use_page eq 1 || $goahead eq "OK") { print $q->redirect(-cookie=>$cookie, -url=>$page); } else { print $q->redirect(-cookie=>$cookie, -url=>$home); } exit; } if ($page =~ /$page_domain/ig && $use_page eq 1 || $goahead eq "OK") { print $q->redirect(-url=>$page); } else { print $q->redirect(-url=>$home); } $sth->finish; $dbh->disconnect; exit; sub get_random { $SQL="SELECT * FROM users WHERE Status NOT LIKE '%PENDING%' AND Username NOT LIKE 'VCP' AND Username NOT LIKE 'H0001' AND Username NOT LIKE 'H0002' AND Username NOT LIKE 'H0003' AND Username NOT LIKE 'H0004' AND Username NOT LIKE 'H0005' AND Username NOT LIKE 'H0006' AND Username NOT LIKE 'H0007' AND Username NOT LIKE 'H0008' AND Username NOT LIKE 'H0009' AND Username NOT LIKE 'H0010'"; &Do_SQL; while ($pointer = $sth->fetchrow_hashref){ $Username = $pointer->{'Username'}; push(@usrn, $Username); } $id = $usrn[int(($#usrn+1) * rand)]; } ###################################################################### sub print_default { print $q->header; print<MILYUNER.COM
$_[0]

EOF print< EOF exit; } sub date { $time = time() + 43200; ($sec, $min, $hour, $day, $mon, $year, $dweek, $dyear, $daylight) = localtime($time); $month = $mon + 1; $year = $year + 1900; }