#!/usr/local/bin/perl ########################################################################## ## ## ## Smart Search version 4.23 ## ## ---------------------- ## ## By Smarter Scripts ## ## (http://www.smarterscripts.com) ## ## ## ## "Smart Search" is not a free script. If you got this from someplace ## ## other than SmarterScripts.com, please contact us, we do offer ## ## rewards for that type of information. Visit our site for up to date ## ## versions. Most CGIs are over $200, sometimes more than $500, ## ## this script is much less. We can keep this script cheap, ## ## as well as free scripts on our site, if people don't steal it. ## ## Also, no return links are required, but we appreciate it if you ## ## do find a spot for us. ## ## Thanks! ## ## ## ## Special Notice to Resellers ## ## =========================== ## ## You can use this script on any site of yours, but if you sell one ## ## of these sites, you are required to FIRST purchase a reseller ## ## license for the domain. If you don't, it's considered copyright ## ## infringement and we will prosecute any offenders. ## ## WE MONITOR EBAY.COM AUCTIONS, SO BEWARE. ## ## Reseller prices are very low, for more information, go to: ## ## http://www.smarterscripts.com/resellers.shtml ## ## ## ## (c) copyright 2002 SmarterScripts.com and R3N3 Internet Services ## ########################################################################## if ($ENV{'SERVER_SOFTWARE'} =~ /microsoft/i) { $path = $ENV{'PATH_TRANSLATED'}; $path =~ /^(.*)\\[^\\]*$/; $path = $1; chdir $path; } require 'include/functions.cgi'; &loadsettings; if ($settings{'debug'}) { open(DEBUG, "> $data_dir/debug.dat") } use CGI; $cgi = new CGI; $a = $cgi->param('a'); $time = &Decrypt($cgi->param('t'),$encryptkey,'asdfhzxcvnmpoiyk'); $u = &Decrypt($cgi->param('u'),$encryptkey,'asdfhzxcvnmpoiyk'); $url = &Decrypt($cgi->param('url'),$encryptkey,'asdfhzxcvnmpoiyk'); $bid = &Decrypt($cgi->param('b'),$encryptkey,'asdfhzxcvnmpoiyk'); if ($bid eq '') { $bid = '0.00' } $keywords = &Decrypt($cgi->param('k'),$encryptkey,'asdfhzxcvnmpoiyk'); if ($settings{'debug'}) { print DEBUG "Time - $time\n"; print DEBUG "Username - $u\n"; print DEBUG "URL - $url\n"; print DEBUG "Bid - $bid\n"; } $logip = "$ENV{'REMOTE_ADDR'}"; $regbid = ®escape($bid); $regurl = ®escape($url); $bidfound = 0; $bideval = < ) { if ( \$bline =~ /^.+&&$regbid&&.*&&$regurl&&.*/) { \$bidfound = 1; last; } } EOF &readbids($u); if (!$bidfound) { &loadstrings('general'); print $cgi->header; print $string{'link_not_found'}; exit; } $url =~ s/\&/\&/g; print "Location: $url\n\n"; #send user to site $realtime = time(); if (($time < $realtime - 86400) || ( $time > $realtime)) { exit } $file = "$accounts_dir/$u/logs/$year-$realmonth-$dayofmonth.log"; if ($settings{'debug'}) { print DEBUG "File - $file\n" } open(DATA, $file); flock (DATA, $LOCK_SH); while ( ) { if ( ($_ =~ /^$url&&$logip&&/) || ($_ =~ /^$url&&[^&]*&&[^&]*&&[^&]*&&$time/ )) { exit } } flock (DATA, $LOCK_UN); close(DATA); open(DATA, ">>$file"); flock (DATA, $LOCK_EX); print DATA "$url&&$logip&&$keywords&&$bid&&$time\n"; flock (DATA, $LOCK_UN); close(DATA); if( ($settings{'affiliate'} == 1) && ($a ne '') && ($bid > 0) && ($settings{'affiliate_per_click'} > 0)) { require 'include/affiliate.cgi'; $payment = $settings{'affiliate_per_click'}; if ($payment =~ /%/) { $payment =~ s/%//; $payment = &makefloat(($payment / 100) * $bid); } &afflog($a, 2, $payment); } if ($bid > 0) { my($userbalance) = &changebalance($u, -$bid); if ($settings{'lowemail'}) { ¬icemail } if ($userbalance == 0) { require 'include/listings.cgi'; &remove_listings($u) } } exit; sub noticemail { $avgcost = &getavgcost($u); if ($avgcost > 0) { $days = int ($balance/$avgcost); if(($days <= $settings{'lowemail_days'})&&(not(-e "$accounts_dir/$u/lowsent"))&&($days != 0)) { open(DATA,">$accounts_dir/$u/lowsent"); print DATA $string{'low_balance'}; close(DATA); &readuser($u); $info{'EMAIL'} = $user{'email'}; $info{'DAYSLEFT'} = $days; $info{'USERNAME'} = $u; &sendmail('email_low_balance.tpl'); } } }