#!/usr/bin/perl -w
#############################################################################
#############################################################################
## ##
## ________ __ _ __ __ ##
## / _______| | | |_| \ \ / / ##
## | | | | _ \ \ / / ##
## | | | | | | \ \/ / ##
## | | | | | | / /\ \ ##
## | |______ | |_____ | | / / \ \ ##
## \________| \_______| |_| /_/ \_\ ##
## ##
## Script by CLiX ##
#############################################################################
#############################################################################
## Home Xchange Version 1.0 ##
## Created 7/16/01 Created by CLiX ##
## CopyRight © 2001 CLiX clix@theclixnetwork.com ##
## Get other scripts at: theclixnetwork.com ##
#############################################################################
#############################################################################
$num = "45";
$activemin = "50";
## PERCENT CHANCE OF REG RANDOM SELECTION
srand;
require "clix-cgi.pl";
$username = $ENV{'QUERY_STRING'};
open(FILE, "config.dat"

; $a = @config = <FILE>; close FILE; for ($i=0; $i<$a; $i++) { chomp($config[$i]); }
@USER = getfile("$config[7]/$username"

;
&printhead;
$frm2 = int(rand(100)) . "f";
$frm3 = int(rand(100)) . "f";
$checkedreg = "0";
$checkedpriority = "0";
$checkedtop = "0";
srand;
$thecat = $USER[24];
$user = "KDK";
$vx = int(rand(100));
if ($vx <= $num) { ®user; } elsif ($vx > 55) { &priorityuser; } else { &topactive; }
sub topactive {
debug("TA user"

;
$checkedtop = "1";
srand;
$tot = @DB = getfile("./categories/$thecat"

;
debug("The Cat:$thecat"

;
$numba = int(rand($tot));
for ($iii=0; $iii<$tot; $iii++) {
$jjj = $iii + $numba;
if ($jjj >= $tot){
$jjj = $jjj - $tot;
}
chomp($DB[$jjj]);
if ($DB[$jjj] =~ /[^a-z]/) { next; }
debug("Checking: $DB[$jjj]"

;
if (-e "$config[7]/$DB[$jjj]"

{
@DBE = getfile("$config[7]/$DB[$jjj]"

;
}
else { next; }
if ($DBE[18] eq "yes"

{ debug("Paused.. Next"

; next; }
if ($DBE[29] >= $DBE[30]) { debug("overmax...next"

; next; }
if ($DBE[0] eq $username) { debug("Its me... Next"

; next; }
if ($DBE[3] - $DBE[4] < 12) { debug("Not enough credits.. Next"

; next; }
if ($DBE[23] < 250) { debug("Not top active.. Next"

; next; }
$urlcnt = @URLZ = getfile("$config[7]/$DB[$jjj].list"

;
debug("Got urls"

;
$viv=0;
for ($qqq=0; $qqq<$urlcnt; $qqq++) {
@tmp = split(/\|/, $URLZ[$qqq]);
if ($tmp[1] eq $thecat) {
$newURLZ[$viv] = $tmp[0];
$viv++;
}
}
$newcnt = @newURLZ;
if ($newcnt < 1) { debug("No URLs this category"

; next; }
$url = $newURLZ[int(rand($newcnt))];
$user = $DB[$jjj];
debug("FOUND--$user $url"

;
last;
}
if ($user eq "KDK"

{ &toplasttry; }
}
sub toplasttry {
debug("TA last Try"

;
srand;
opendir(DATA, "$config[7]"

;
$tot = @DB = readdir(DATA);
closedir (DATA);
$numba = int(rand($tot));
for ($iii=0; $iii<$tot; $iii++) {
$jjj = $iii + $numba;
if ($jjj >= $tot){
$jjj = $jjj - $tot;
}
chomp($DB[$jjj]);
if ($DB[$jjj] =~ /[^a-z]/) { next; }
debug("Checking: $DB[$jjj]"

;
if (-e "$config[7]/$DB[$jjj]"

{
@DBE = getfile("$config[7]/$DB[$jjj]"

;
}
else { next; }
if ($DBE[18] eq "yes"

{ debug("Paused.. Next"

; next; }
if ($DBE[29] >= $DBE[30]) { debug("overmax...next"

; next; }
if ($DBE[0] eq $username) { debug("Its me.. next"

; next; }
if ($DBE[3] - $DBE[4] < 12) { debug("Not enough credits.. Next"

; next; }
if ($DBE[23] < 250) { debug("Not top active.. Next"

; next; }
$urlcnt = @URLZ = getfile("$config[7]/$DB[$jjj].list"

;
$url = $URLZ[int(rand($urlcnt))];
@tmp = split(/\|/, $url);
$url = $tmp[0];
$user = $DB[$jjj];
debug("FOUND--$user $url"

;
last;
}
if (($user eq "KDK"

&& ($checkedpriority eq "0"

) { &priorityuser; }
}
sub reguser {
debug("Reg User"

;
$checkedreg = "1";
srand;
$tot = @DB = getfile("./categories/$thecat"

;
debug("The Cat:$thecat"

;
$numba = int(rand($tot));
for ($iii=0; $iii<$tot; $iii++) {
$jjj = $iii + $numba;
if ($jjj >= $tot){
$jjj = $jjj - $tot;
}
chomp($DB[$jjj]);
if ($DB[$jjj] =~ /[^a-z]/) { next; }
debug("Checking: $DB[$jjj]"

;
if (-e "$config[7]/$DB[$jjj]"

{
@DBE = getfile("$config[7]/$DB[$jjj]"

;
}
else { next; }
if ($DBE[18] eq "yes"

{ debug("Paused.. Next"

; next; }
if ($DBE[29] >= $DBE[30]) { debug("overmax...next"

; next; }
if ($DBE[0] eq $username) { debug("Its me... Next"

; next; }
if ($DBE[3] - $DBE[4] < 12) { debug("Not enough credits.. Next"

; next; }
if ($DBE[23] < $activemin) { debug("Not active.. Next"

; next; }
$urlcnt = @URLZ = getfile("$config[7]/$DB[$jjj].list"

;
debug("Got urls"

;
$viv=0;
for ($qqq=0; $qqq<$urlcnt; $qqq++) {
@tmp = split(/\|/, $URLZ[$qqq]);
if ($tmp[1] eq $thecat) {
$newURLZ[$viv] = $tmp[0];
$viv++;
}
}
$newcnt = @newURLZ;
if ($newcnt < 1) { debug("No URLs this category"

; next; }
$url = $newURLZ[int(rand($newcnt))];
$user = $DB[$jjj];
debug("FOUND--$user $url"

;
last;
}
if ($user eq "KDK"

{ &lasttry; }
}
sub lasttry {
debug("Last Try"

;
srand;
opendir(DATA, "$config[7]"

;
$tot = @DB = readdir(DATA);
closedir (DATA);
$numba = int(rand($tot));
for ($iii=0; $iii<$tot; $iii++) {
$jjj = $iii + $numba;
if ($jjj >= $tot){
$jjj = $jjj - $tot;
}
chomp($DB[$jjj]);
if ($DB[$jjj] =~ /[^a-z]/) { next; }
debug("Checking: $DB[$jjj]"

;
if (-e "$config[7]/$DB[$jjj]"

{
@DBE = getfile("$config[7]/$DB[$jjj]"

;
}
else { next; }
if ($DBE[18] eq "yes"

{ debug("Paused.. Next"

; next; }
if ($DBE[29] >= $DBE[30]) { debug("overmax...next"

; next; }
if ($DBE[0] eq $username) { debug("Its me.. next"

; next; }
if ($DBE[3] - $DBE[4] < 12) { debug("Not enough credits.. Next"

; next; }
if ($DBE[23] < $activemin) { debug("Not active.. Next"

; next; }
$urlcnt = @URLZ = getfile("$config[7]/$DB[$jjj].list"

;
$url = $URLZ[int(rand($urlcnt))];
@tmp = split(/\|/, $url);
$url = $tmp[0];
$user = $DB[$jjj];
debug("FOUND--$user $url"

;
last;
}
if (($user eq "KDK"

&& ($checkedpriority eq "0"

) { &priorityuser; }
}
sub priorityuser {
debug("Priority User"

;
srand;
$tot = @DB = getfile("highpriority.txt"

;
$numba = int(rand($tot));
debug("Total: $tot Numba: $numba"

;
for ($iii=0; $iii<$tot; $iii++) {
$jjj = $iii + $numba;
if ($jjj >= $tot){
$jjj = $jjj - $tot;
}
chomp($DB[$jjj]);
if ($DB[$jjj] =~ /[^a-z]/) { next; }
debug("Checking: $DB[$jjj]"

;
@DBE = getfile("$config[7]/$DB[$jjj]"

;
if ($DBE[18] eq "yes"

{ debug("Paused.. Next"

; next; }
if ($DBE[29] >= $DBE[30]) { debug("overmax...next"

; next; }
if ($DBE[0] eq $username) { debug("Its me.. next"

; next; }
if ($DBE[3] - $DBE[4] < 12) { debug("Not enough credits.. Next"

; next; }
$urlcnt = @URLZ = getfile("$config[7]/$DB[$jjj].list"

;
$viv=0;
for ($qqq=0; $qqq<$urlcnt; $qqq++) {
@tmp = split(/\|/, $URLZ[$qqq]);
if ($tmp[1] eq $thecat) {
$newURLZ[$viv] = $tmp[0];
$viv++;
}
}
$newcnt = @newURLZ;
if ($newcnt < 1) { debug("No urls in cat"

; next; }
$url = $newURLZ[int(rand($newcnt))];
$user = $DB[$jjj];
debug("FOUND--$user $url"

;
last;
}
if ($user eq "KDK"

{ &prioritylasttry; }
}
sub prioritylasttry {
debug("Priority Last Try"

;
srand;
$tot = @DB = getfile("highpriority.txt"

;
$numba = int(rand($tot));
for ($iii=0; $iii<$tot; $iii++) {
$jjj = $iii + $numba;
if ($jjj >= $tot){
$jjj = $jjj - $tot;
}
chomp($DB[$jjj]);
if ($DB[$jjj] =~ /[^a-z]/) { next; }
debug("Checking: $DB[$jjj]"

;
if (-e "$config[7]/$DB[$jjj]"

{
@DBE = getfile("$config[7]/$DB[$jjj]"

;
}
else { next; }
if ($DBE[18] eq "yes"

{ debug("Paused.. Next"

; next; }
if ($DBE[0] eq $username) { debug("Its me.. next"

; next; }
if ($DBE[3] - $DBE[4] < 12) { debug("Not enough credits.. next"

; next; }
$urlcnt = @URLZ = getfile("$config[7]/$DB[$jjj].list"

;
debug("Getting URLs"

;
$url = $URLZ[int(rand($urlcnt))];
@tmp = split(/\|/, $url);
$url = $tmp[0];
$user = $DB[$jjj];
debug("FOUND--$user $url"

;
last;
}
if (($user eq "KDK"

&& ($checkedreg eq "0"

) { ®user; }
}
sub debug {
local($message) = @_;
if ($username eq "robertbug"

{ print "$message<BR>"; }
}
if ($user eq "KDK"

{ $url = $config[2]; }
print<<d00der;
<HTML>
<HEAD>
<SCRIPT type="text/javascript">
<!--
if (top.location != self.location) {
top.location = self.location
}
var r=Math.random()
if (r>0.98)
{
alert("ROBOSTOPPER BOX"

}
</SCRIPT>
<TITLE>$config[0]</TITLE>
</HEAD>
<FRAMESET ROWS="$config[5],100%" FRAMESPACING="0" BORDER="0">
<FRAME MARGINWIDTH="0" MARGINHEIGHT="0" NAME="$frm3" NORESIZE SCROLLING=NO SRC="count.cgi?u=$username&o=$user&a=bot" FRAMEBORDER="0">
<FRAME MARGINWIDTH="0" MARGINHEIGHT="0" NAME="$frm2" SCROLLING=AUTO SRC="$url" FRAMEBORDER="0">
<NOFRAMES>
<BODY>
<P>
This page is designed for use with a browser that supports frames.
</BODY>
</NOFRAMES>
</FRAMESET>
</HTML>
d00der
exit;
#############################################################################
#############################################################################
## ##
## ________ __ _ __ __ ##
## / _______| | | |_| \ \ / / ##
## | | | | _ \ \ / / ##
## | | | | | | \ \/ / ##
## | | | | | | / /\ \ ##
## | |______ | |_____ | | / / \ \ ##
## \________| \_______| |_| /_/ \_\ ##
## ##
## Script by CLiX ##
#############################################################################
#############################################################################
## CLiX CGI Library Version CSBX2.0 ##
## Created 7/12/01 Created by CLiX ##
## CopyRight © 2001 CLiX clix@clixscripts.cjb.net ##
## Get other scripts at: theclixnetwork.com ##
#############################################################################
#############################################################################
## CLiX CGI Library can be used for personal and commercial use ONLY if ##
## this header is left in here. Also please email me ( or use the form ##
## on my site ) telling me your address. This is so I can see how my ##
## scripts are used. Use these scripts at your own risk. Im not ##
## responsible for anything this script does. ##
#############################################################################
#############################################################################
## Variables ##
## Set this to a banner code (if on a free host site)
$Freead = "<!--VirtualAvenueBanner-->";
## This is wether or not to use flock (1-yes,0-no)
$flock = "0";
## Number of days before a cookie expires
$exp = "21";
## Path To Sendmail
$sema = "/usr/sbin/sendmail -t";
## Do Not Edit Below ##
#############################################################################
#############################################################################
## THIS VERSION SPECIALLY MODIFIED FOR CSBX ##
$PH = "no";
sub getinput {
$meth = $ENV{'REQUEST_METHOD'};
if (!defined $meth || $meth eq '') {
$temp = "$ENV{'QUERY_STRING'}";
}
elsif ($meth eq "POST"

{
read(STDIN,$temp,$ENV{'CONTENT_LENGTH'});
}
elsif ($meth eq "GET"

{
$temp = "$ENV{'QUERY_STRING'}";
}
else {
dienice("Unknown method: $meth"

;
}
@pairs=split(/&/,$temp);
$in{ip} = "$ENV{'REMOTE_ADDR'}";
foreach $item(@pairs)
{
($key,$content)=split(/=/,$item,2);
$content=~tr/+/ /;
$content=~s/%(..)/pack("c",hex($1))/ge;
chomp($content);
$in{$key}=$content;
if ($key =~ /URL/) {
$key =~ s/URL-//;
$inurl[$key] = $content;
}
if ($key =~ /SEL-/) {
$key =~ s/SEL-//;
$incat[$key] = $content;
}
}
}
sub sendmail {
local($to,$from,$subject,$message) = @_;
open (MESSAGE,"|$sema"

;
print MESSAGE "To: $to\n";
print MESSAGE "From: $from\n";
print MESSAGE "Subject: $subject\n\n";
print MESSAGE "$message\n\n";
close (MESSAGE);
}
sub dienice {
my($msg) = @_;
&printhead;
print "$Freead<P>\n";
print "<h2>Error</h2><BR><HR><BR>\n";
print $msg;
exit;
}
sub getfile {
local($filename) = @_;
open(FILE, "$filename"

or dienice("Couldnt open $filename: $!"

;
if ($flock eq "1"

{ flock(FILE, 2); }
@data = <FILE>;
close FILE;
$num = @data;
for ($i=0; $i<$num; $i++) {
chomp($data[$i]);
}
return @data;
}
sub appfile {
local($filename, @text) = @_;
open(FILE, ">>$filename"

or dienice("Couldnt append to $filename: $!"

;
if ($flock eq "1"

{ flock(FILE, 2); }
foreach $text(@text) {
print FILE "$text\n";
}
close FILE;
}
sub writefile {
local($filename, @text) = @_;
open(FILE, ">$filename"

or dienice("Couldnt write to $filename: $!"

;
if ($flock eq "1"

{ flock(FILE, 2); }
foreach $text(@text){
print FILE "$text\n";
}
close (FILE);
}
sub printhead {
if ($PH ne "y"

{
print "Content-type: text/html\n\n";
$PH = "y";
}
}
##
## sub getcookies
## Gets cookies and stores in %cookie
##
sub getcookies {
if ($ENV{'HTTP_COOKIE'}) {
foreach (split(/; /,$ENV{'HTTP_COOKIE'})){
($cookie,$value) = split(/=/);
$Cookies{$cookie} = $value;
}
}
}
##
## sub makecookies
## usage:
## makecookies("name1","value1","name2","value2"

## $exp is the number of days untill expiring (set in variables at top)
sub makecookies {
local(@cookies) = @_;
$expdate = mygmttime(time + (86400*$exp));
while( ($cookie,$value) = @cookies ) {
print "Set-Cookie: $cookie=$value; expires=$expdate \n";
shift(@cookies); shift(@cookies);
}
}
sub cryptor {
local ($field, $pw) = @_;
$field = crypt($field,substr($pw,0,2));
return $field;
}
$der = "der";
1;
also when i added the -w to the first line of the start script the premature error went away