#!/usr/bin/perl ############################################################################## # SellWide Earn-It Manager Script Version 1.3 # # Copyright 2002 SellWide Corporation # # Last modified 05/17/2002 # # Authors: Andrew Kolobikhin and Vadim Rachkowan # # Available at http://www.sellwide.net # ############################################################################## # COPYRIGHT NOTICE # # Copyright 2002 SellWide Corporation. All Rights Reserved. # # # # This script can be used as long as you don't change this # # header or any of the parts that give me credit for writing this. # # # # By using this script you agree to indemnify me from any liability # # that might arise from its use. # # # # Redistributing\selling the code for this program without prior written # # consent is expressly forbidden. # # # # Use for any unauthorized purpose is expressly prohibited by law, # # and may result in severe civil and criminal penalties. # # Violators will be prosecuted to the maximum extent possible. # # # # YOU MAY NOT RESELL OR RELEASE THIS PROGRAM TO OTHERS # # IT IS FOR YOUR PERSONAL USE ONLY. # # # ############################################################################## ################################################################# # CHANGE THESE VARIABLES: # ################################################################# # Type the URL address of the earnit.cgi $host="http://www.marijuanapassion.com/FreeSeeds/earnit.cgi"; # Type the full path to your Mail program. # If you're not sure of this, ask your server administrator $mailprog="/usr/sbin/sendmail"; # Type your email address that you want receiving reports to. # Make sure to place a \ in front of the @ # As an example: admin\@sellwide.net $admin="support\@marijuanapassion.com"; # Type your email that you to be as a "From" address in the # confirmation emails. Make sure to place a \ in front of the @ # As an example: admin\@sellwide.net $fromaddr="support\@marijuanapassion.com"; # Type the subject line of the confirmation email $subject="Thanks For Signing Up"; # Enter the Admin password (case sensetive 8 chars max) $adminpassw="mpassion"; # Number of unique visitors you are asking for $clicksnum=350; # Type the URL that you want to send surfers to after # they click the banner $urlafterclick="http://www.marijuanapassion.com"; ################################################################# ##-------------------------------------------------------------## ##-- !!! DO NOT EDIT ANYTHING BELOW !!! --## ##-------------------------------------------------------------## # Removing or altering the code below will void your # # acceptance of the terms and conditions and consequently # # you will no longer be able to use the program. # #---------------------------------------------------------------# ################################################################# $mailprog=$mailprog." -i -t"; $showsnum=500000; &readparse; $mode = $FORM{'mode'}; $username = $FORM{'username'}; $passw = $FORM{'password'}; $email = $FORM{'email'}; if ($mode eq "register"){ $confirm=$FORM{'confirm'}; $username=registry($username); $passw=registry($passw); $confirm=registry($confirm); $email=~tr/A-Z/a-z/; if ((-e "$username\.udb")||($username eq "admin")) { error("Such user already exists!"); } elsif ($passw eq ""){ error("Password field is empty!"); } elsif ($passw ne $confirm){ error("Not equal values of password and its confirmation"); } elsif ($username eq "") { error("Username field is empty!"); } elsif (1==checkmail()){ &adduser; } else {error("Email is wrong!")}; } elsif ($mode eq "login") { if ($username eq "admin") { if ($passw eq $adminpassw) { print "Content-type: text/html\n\n"; &foradmin } else { error("Password is wrong!") } } elsif (-e "$username\.udb"){ $getpass=getpassword(); if ($passw eq $getpass) { print "Content-type: text/html\n\n"; &showstat; } else {error("Password wrong!")}; } else {error("No such user")}; } elsif (($mode eq "banner")||($mode eq "click")){ if (-e "$username\.udb"){ &addip; }; if ($mode eq "banner"){ &shopic; } else {print "Location: $urlafterclick\n\n"}; } elsif ($mode eq "delete"){ @fkeys=keys(%FORM); foreach(@fkeys) {if ($_ ne "mode" && $_ ne "password") {push (@files,$_)}} ; if ($passw eq $adminpassw){ open(DB,"users.db"); flock(DB,$LOCK_EX); open(DB1,">tmpusers.db"); while(!eof(DB)){ $record=; $record=~/(.*)\|(.*)\|(.*)\|(.*)/; $user=$1; $add=1; foreach(@files) { $filename=$FORM{$_}; $filename=~/(.*)\.udb/; if ($user eq $1) {$add=0}; }; if ($add==1){print DB1 "$record";} } flock(DB,$LOCK_UN); close(DB); close(DB1); foreach(@files) { unlink "$FORM{$_}"; #print "file:$FORM{$_};" }; rename("tmpusers.db","users.db"); $FORM{'password'}="$admin"; &foradmin; } else {error("Wrong password!")}; } elsif($mode eq "show"){ showips($FORM{'user'}); } else { ################################################################# ##-------------------------------------------------------------## ##-- !!! DO NOT EDIT ANYTHING !!! --## ##-------------------------------------------------------------## # Removing or altering the code below will void your # # acceptance of the terms and conditions and consequently # # you will no longer be able to use the program. # #---------------------------------------------------------------# ################################################################# print "Content-type: text/html\n\n"; print< Earn-It Manager

New Users SignUp

Email Address:
Username:
Password:
Verify Password:

 

Existing Participants Can Login Here

Username:
Password:

Powered by Earn-It Manager

html_ } sub ltime{ my($sec,$min,$hour,$mday,$mon,$year) = localtime(); $year+=1900;$mon++; if ($mday<10) {$mday="0$mday"}; if ($mon<10) {$mon="0$mon"}; return ($mday,$mon,$year); } sub adduser{ my($mday,$mon,$year)=ltime(); my($time)="$mon/$mday/$year"; open(NEWONE,">$username\.udb"); close(NEWONE); open(UBASE,">>users.db"); print UBASE "$username\|$passw\|$email\|$time\n"; close (UBASE); $userip=""; for $visitor ($ENV{REMOTE_ADDR}, $ENV{HTTP_VIA}, $ENV{HTTP_X_FORWARDED_FOR}) { if (($visitor=~/^\d+\.\d+\.\d+\.\d+$/) && ($userip eq "")) {$userip=$visitor} }; print "Content-type: text/html\n\n"; $bancode="--- Your HTML code ---\n\n\n--- End of HTML code ---\n"; $logurl="$host"; $uname=$username; $upass=$passw; $logininfo="REMEMBER YOUR USERNAME AND PASSWORD!\n\nUsername : $username\nPassword : $passw\nLogin URL: $logurl\n\n$bancode"; &showstat; if(open(FILE,"letter.txt")){ @letter=; close(FILE) }; foreach(@letter){ $_=~s/\[LOGININFO\]/$logininfo/e; $message=$message."$_"; } &sendmail; $email=$admin; $subject="Earn-It Manager report - you have new user"; $message="Earn-It Manager report - you have new user\n\n------------------------\nUsername: $username\nPassword: $passw\nIP Addr.: $userip\n------------------------"; &sendmail; }; sub getpassword{ if (open(UBASE,"users.db")){ flock(UBASE,$LOCK_EX); while((!eof(UBASE))&&("$uname" ne "$username")){ $str=; $str=~/(.*)\|(.*)\|(.*)\|(.*)/; ($uname,$upass,$email)=($1,$2,$3); }; flock(UBASE,$LOCK_UN); close(UBASE); } else {error("No users")}; return "$upass"; }; sub addip{ $referer=$ENV{'HTTP_REFERER'}; $notgood=0; if (open(IPS,"$username\.udb")){ flock(UBASE,$LOCK_EX); while() { chomp($_); $_=~/(.*\s.*)\s(.*)/; for $visitor ($ENV{REMOTE_ADDR}, $ENV{HTTP_VIA}, $ENV{HTTP_X_FORWARDED_FOR}) { $notgood = 1 if (($1 eq "$visitor $mode") && ($visitor=~/^\d+\.\d+\.\d+\.\d+$/)); } }; flock(UBASE,$LOCK_UN); close(IPS); }; if ($notgood==0) { count("$username\.udb"); $clicks1=$clicks; open(IPS,">>$username\.udb"); flock(IPS,$LOCK_EX); for $visitor ($ENV{REMOTE_ADDR}, $ENV{HTTP_VIA}, $ENV{HTTP_X_FORWARDED_FOR}) { if ($visitor=~/^\d+\.\d+\.\d+\.\d+$/) { if ($referer ne "") { print IPS "$visitor $mode $referer\n" } } }; flock(IPS,$LOCK_UN); close(IPS); count("$username\.udb"); if ($clicks>=$clicksnum && $clicks1<$clicksnum){ $email=$admin; $subject="Earn-It Manager report - the user \"$username\" has sent you $clicks unique clicks"; $message="\nEarn-It Manager report - the user \"$username\" has sent you $clicks unique clicks\n\nUsername: $username\r\nClicks: $clicks\r\nImpressions: $opens\r\nCTR: $ratio"; &sendmail; } } } sub error{ print "Content-type: text/html\n\n"; print < Error
Error

@_

Back

 

html_ exit; } sub shopic{ $size=(-s "sellwide.gif"); print "Content-type: image/gif\n"; print "Content-length: $size\n\n"; open (IMG,"sellwide.gif"); binmode IMG; binmode STDOUT; print ; close (IMG); } sub showstat{ count("$username\.udb"); if($clicks>=$clicksnum){$cong="
Congratulations! Now send us an email
to $admin with your username!"}; print<<_STAT_; Statistics
Click Here How To Receive Free Traffic
Hello $uname! $cong
Account
Username: $uname
Password: $upass
Account
Email: $email
Unique clicks: $clicks
Copy and paste this code into your HTML document:
<a href="$host?mode=click&username=$username"> Marijuana Seedbank Rating </a>
As soon as you have sent us $clicksnum unique clicks you will be notified instantly.
_STAT_ } ################################################################# ##-------------------------------------------------------------## ##-- !!! DO NOT EDIT ANYTHING !!! --## ##-------------------------------------------------------------## # Removing or altering the code below will void your # # acceptance of the terms and conditions and consequently # # you will no longer be able to use the program. # #---------------------------------------------------------------# ################################################################# sub sendmail{ open(SM,"|$mailprog"); print SM "From: $fromaddr\n"; print SM "To: $email\n"; print SM "Subject:$subject\n"; print SM "Content-Type: text/plain\n"; print SM "\n"; print SM "$message\n"; print SM "__________________________________________________\n"; print SM "Powered by Earn-It Manager http://www.sellwide.net\n"; close(SM); } sub checkmail{ if ($email =~/^[a-zA-Z0-9_\.-][a-zA-Z0-9_\.-\d]*\@[a-zA-Z\.-\d]+\.[a-zA-Z]{2,4}/) { return 1 } else { return 0 } } sub readparse { if ($ENV{'REQUEST_METHOD'} eq 'GET') { $input=$ENV{'QUERY_STRING'} } elsif ($ENV{'REQUEST_METHOD'} eq 'POST') { read (STDIN, $input, $ENV{'CONTENT_LENGTH'}); } @pairs = split(/&/, $input); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ s/\n/ /g; $FORM{$name} = $value; } } sub foradmin{ my($subscribers); $subscribers=0; open(FILES,"users.db") || error "Cannot open $userdir!"; flock(FILES,$LOCK_EX); print < Earn-It Manager Admin Control Panel
Earn-It Manager
Admin Control Panel
HTML while (!eof(FILES)) { $subscribers++; $record=; $record=~/(.*)\|(.*)\|(.*)\|(.*)/; $file="$1\.udb"; $password=$2; $usermail=$3; $time=$4; print "\n"; $clicks=0;$opens=0;$ratio=0; count($file); print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; } flock(FILES,$LOCK_UN); close(FILES); print "
. Username Clicks Impressions CTR,% E-mailPassword Signup Date
$1$clicks $opens $ratio $usermail $password $time
\n"; print "

There are $subscribers participants.

Admin Password:
\n"; print "\n"; print "

\n"; } sub registry{ my($str); $str=@_[0]; $str =~s/\W.*//; $str =~tr/A-Z/a-z/; return $str; }; sub count{ $clicks=0; $opens=0; $ratio=0; my($file); $file=@_[0]; if (open(IPS,"$file")){ flock(IPS,$LOCK_EX); while() { $clicks++ if (/.* click.*/); $opens++ if (/.* banner.*/); } flock(IPS,$LOCK_UN); close(IPS); }; if ($opens!=0){ $ratio=100*$clicks/$opens; if ($clicks!=0) { $ratio=int($ratio); }; }; } sub showips{ print "Content-type: text/html\n\n"; print "Data"; print ""; print "

Data for user @_[0]:


"; print ""; if(open(FILE, "@_[0]\.udb")){ flock(FILE,$LOCK_EX); while(){ chomp($_); $_=~/(\S*)\s(\S*)\s(\S*)/; print ""; }; close(FILE); }; count("@_[0]\.udb"); print "
IP-addressModeReferer
$1$2$3

"; print "Clicks:$clicks  Impressions:$opens  CTR:$ratio

"; print "
" }