#!/usr/bin/perl # # dohit.cgi - v1.0 - 110901 # ##################################################################### # # # Copyright © 1999-2001 CGISCRIPT.NET - All Rights Reserved # # # ##################################################################### # # # THIS COPYRIGHT INFORMATION MUST REMAIN INTACT # # AND MAY NOT BE MODIFIED IN ANY WAY # # # ##################################################################### # # When you downloaded this script you agreed to accept the terms # of this Agreement. This Agreement is a legal contract, which # specifies the terms of the license and warranty limitation between # you and CGISCRIPT.NET. You should carefully read the following # terms and conditions before installing or using this software. # Unless you have a different license agreement obtained from # CGISCRIPT.NET, installation or use of this software indicates # your acceptance of the license and warranty limitation terms # contained in this Agreement. If you do not agree to the terms of this # Agreement, promptly delete and destroy all copies of the Software. # # Versions of the Software # Only one copy of the registered version of CGISCRIPT.NET # may used on one web site. # # License to Redistribute # Distributing the software and/or documentation with other products # (commercial or otherwise) or by other than electronic means without # CGISCRIPT.NET's prior written permission is forbidden. # All rights to the CGISCRIPT.NET software and documentation not expressly # granted under this Agreement are reserved to CGISCRIPT.NET. # # Disclaimer of Warranty # THIS SOFTWARE AND ACCOMPANYING DOCUMENTATION ARE PROVIDED "AS IS" AND # WITHOUT WARRANTIES AS TO PERFORMANCE OF MERCHANTABILITY OR ANY OTHER # WARRANTIES WHETHER EXPRESSED OR IMPLIED. BECAUSE OF THE VARIOUS HARDWARE # AND SOFTWARE ENVIRONMENTS INTO WHICH CGISCRIPT.NET MAY BE USED, NO WARRANTY # OF FITNESS FOR A PARTICULAR PURPOSE IS OFFERED. THE USER MUST ASSUME THE # ENTIRE RISK OF USING THIS PROGRAM. ANY LIABILITY OF CGISCRIPT.NET WILL BE # LIMITED EXCLUSIVELY TO PRODUCT REPLACEMENT OR REFUND OF PURCHASE PRICE. # IN NO CASE SHALL CGISCRIPT.NET BE LIABLE FOR ANY INCIDENTAL, SPECIAL OR # CONSEQUENTIAL DAMAGES OR LOSS, INCLUDING, WITHOUT LIMITATION, LOST PROFITS # OR THE INABILITY TO USE EQUIPMENT OR ACCESS DATA, WHETHER SUCH DAMAGES ARE # BASED UPON A BREACH OF EXPRESS OR IMPLIED WARRANTIES, BREACH OF CONTRACT, # NEGLIGENCE, STRICT TORT, OR ANY OTHER LEGAL THEORY. THIS IS TRUE EVEN IF # CGISCRIPT.NET IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. IN NO CASE WILL # CGISCRIPT.NET' LIABILITY EXCEED THE AMOUNT OF THE LICENSE FEE ACTUALLY PAID # BY LICENSEE TO CGISCRIPT.NET. # # Credits: # Andy Angrick - Programmer - angrick@cgiscript.net # Mike Barone - Design - mbarone@cgiscript.net # # For information about this script or other scripts see # http://www.cgiscript.net # # Thank you for trying out our script. # If you have any suggestions or ideas for a new innovative script # please direct them to suggest@cgiscript.net. Thanks. # ######################################################################## # Config Variables # ######################################################################## require("setup.cgi"); $flock=1; $srand=1; $debug=0; ######################################################################## # End Config Variables # ######################################################################## require("libs.cgi"); $in{'cgiurl'} = $cgiurl.'/dohit.cgi'; (!$htmlpath)&&($htmlpath=$cgipath); (!$htmlurl)&&($htmlurl=$cgiurl); $in{'htmlurl'} = $htmlurl; $| = 1; eval { &main; }; if ($@) { &cgierr("fatal error: $@"); } exit; sub main{ print "Content-type: text/html\n\n"; &getdata; &DoHit; } sub DoHit{ $id = $in{'id'}; dbmopen(%ip,"$cgipath/ip",0644); $t=time; print "$t - $ip{$ENV{'REMOTE_ADDR'}}) < ($defaultminutes * 60)
" if $debug; if(($t - $ip{$ENV{'REMOTE_ADDR'}}) < ($defaultminutes * 60)){ #$myurl = $defaulturl; #&Output; print qq|document.write("\\n")|; exit; } $ip{$ENV{'REMOTE_ADDR'}} = time; dbmclose %ip; &ctime(time); dbmopen(%db,"$cgipath/adunder",0644); #get default per ($db{$id.'-'.$myyear.$mymonth} <= 1000)&&($l=1); ($db{$id.'-'.$myyear.$mymonth} > 1000)&&($db{$id.'-'.$myyear.$mymonth} <= 10000)&&($l=2); ($db{$id.'-'.$myyear.$mymonth} > 10000)&&($db{$id.'-'.$myyear.$mymonth} <= 500000)&&($l=3); ($db{$id.'-'.$myyear.$mymonth} > 500000)&&($l=4); ($l==1)&&($pd = $defaulti1); ($l==2)&&($pd = $defaulti2); ($l==3)&&($pd = $defaulti3); ($l==4)&&($pd = $defaulti4); ($in{$id.'-i'.$l})?($p = $in{$id.'-i'.$l}):($p=$pd); #($a,$b) = split(":",$p); #($b)?($p = $a/$b):($p=1); $p = $p/100; $db{$in{'id'}.'-'.$myyear}++; $db{$in{'id'}.'-'.$myyear.$mymonth}++; $db{$in{'id'}.'-'.$myyear.$mymonth.$myday}++; if($debug){ print "\$db{$in{'id'}.'-'.$myyear}
"; print $myyear . ':'.$db{$in{'id'}.'-'.$myyear}.'
'; print $myyear.$mymonth . ':'.$db{$in{'id'}.'-'.$myyear.$mymonth}.'
'; print $myyear.$mymonth.$myday . ':'.$db{$in{'id'}.'-'.$myyear.$mymonth.$myday}.'
'; print "----
"; } $db{$id.'-m'} += $p; $db{$id.'-vm'} += $p; open(DB,"$cgipath/users.cgi"); while(){ chomp; ($idt,$n,$e,$url,$p,$c,$sc,$d,$s,$rfl) = split(/\|/,$_); if(($id eq $idt)&&($rfl)){ #get default per ($db{$rfl.'-at'} <= 10)&&($l=1); ($db{$rfl.'-at'} > 10)&&($db{$id.'-at'} <= 20)&&($l=2); ($db{$rfl.'-at'} > 20)&&($db{$id.'-at'} <= 30)&&($l=3); ($db{$rfl.'-at'} > 30)&&($l=4); ($l==1)&&($pd = $defaultr1); ($l==2)&&($pd = $defaultr2); ($l==3)&&($pd = $defaultr3); ($l==4)&&($pd = $defaultr4); ($in{$id.'-r'.$l})?($p = $in{$id.'-r'.$l}):($p=$pd); $db{$rfl.'-a'} += ($p/100); $db{$rfl.'-va'} += ($p/100); } next if($id eq $idt); #category specific if($matchcategories){ next if ($db{$id.'-c'} ne $db{$idt.'-c'}); } $points = ($db{$idt.'-m'}+$db{$idt.'-a'}) - $db{$idt.'-o'}; if(($s==1)&&($points>= 1)){ print "POOL: $idt
" if $debug; push(@members, $idt); $url{$idt} = $url; } } close DB; $tn = $#members; print "Total: $tn
" if $debug; ($srand)&&(srand($$|time)); $c = int(rand($tn+1)); print "Random: $c
" if $debug; if($tn > -1){ $mid = $members[$c]; $db{$mid.'-o'}++; $db{$mid.'-vo'}++; $myurl = $url{$members[$c]}; } else{ $myurl = $defaulturl; } (!$myurl)&&($myurl = $defaulturl); print "M: $myurl
" if $debug; dbmclose %db; &Output; exit; } sub Output{ $o = qq| |; $o =~ s/in\((\w+)\)/$in{$1}/g; $o =~ s/\"/\\"/g; $o =~ s/\\n/\\\\n/g; $o =~ s/(scr)(ipt)/$1\"\+\"$2/gsi; @mylines = split(/\r*\n/,$o); foreach $q (@mylines){ print qq|document.write("$q\\n");\n|; } exit; }