If this is not admin, please let him/her know about this problem.", 0);
flock WHITWORTH, 1;
@jaqueline = ;
close(WHITWORTH);
open(JANUARY, ">$link_file") || ¬ify("500 Data Server Error", "I was not able to write to the \$data file chmod it to 666 and try again
If this is not admin, please let him/her know about this problem.", 0);
flock JANUARY, 2;
foreach (@jaqueline)
{
($name, $url, $date, $description, $click) = split('\|DI\|');
if ($url eq "$1")
{
$click++;
printf(JANUARY "%s|DI|%s|DI|%s|DI|%s|DI|%d|DI|\n",
$name, $url, $date, $description, $click);
}
else
{
printf(JANUARY "%s", $_);
}
}
close(JANUARY);
printf("Content-type: text/html\n");
printf("Location: %s\n\n", $1);
}
#
########## ------------------------------ #####################################################
#
########## - ACTION:REDIRECT [] --------- #####################################################
#
elsif ($ENV{'QUERY_STRING'} =~ /action=random/i)
{
open(WILLIAMS, "$link_file") || ¬ify("500 Data Server Error", "I was not able to find the \$data file upload it to and try again
If this is not admin, please let him/her know about this problem.", 0);
flock WILLIAMS, 1;
@andrew = ;
close(WILLIAMS);
srand(time ^ $$);
$l = sprintf("%s", $andrew[rand($#andrew)]);
($name, $url, $date, $description, $click) = split('\|DI\|', $l);
printf("Content-type: text/html\n");
printf("Location: %s\n\n", $url);
}
#
########## ------------------------------ #####################################################
#
########## - ACTION:SUBMIT_URL [] ------- #####################################################
#
elsif ($ENV{'QUERY_STRING'} eq "action=submit-url")
{
¬ify("500 Internal Server Error", "[BAD HTTP_REFERER !]", 2) if ($ENV{'HTTP_REFERER'} !~ /^http:\/\/$ENV{'HTTP_HOST'}$ENV{'SCRIPT_NAME'}/);
&missing("SITE NAME") unless $INPUT{'name'};
&missing("URL") unless $INPUT{'url'};
&missing("DESCRIPTION") unless $INPUT{'description'};
¬ify("501 Data Server Error", "There is a problem with the URL.", 1) if ($INPUT{'url'} !~ /^\w.*:\/\/[\w\W]+\.[\w\W]+$/);
open (CAR_DOOR, "$link_file") || ¬ify("500 Internal Server Error", "I was not able to find the \$data file upload it to and try again
If this is not admin, please let him/her know about this problem.", 0);
flock CAR_DOOR, 1;
while () {
if (/$INPUT{'url'}/) {
¬ify("Link added.", "That URL has already been added.", 1);
}
} close(CAR_DOOR);
&add();
&top_html("Success !");
&nframe("[Thank you for adding a link]
Please click " .
"h e r e to view the link.");
&bottom(1);
}
#
########## ------------------------------ #####################################################
#
########## - ACTION:ADD-URL [] ---------- #####################################################
#
elsif ($ENV{'QUERY_STRING'} eq "action=add-url")
{
$browser = sprintf("%s", $BGCOLORPG);
$browser = sprintf("%s", $TBCOLOR) if ($ENV{'HTTP_USER_AGENT'} !~ /MSIE/);
&top_html("Submit a URL");
printf("
");
&bottom(1);
}
#
########## ---------------------- #############################################################
#
# S U B R O U T I N E S
#
########## - ADDITIONAL STUFF [] #############################################################
#
sub top_html
{
printf("Content-type: text/html\n\n" .
"\n" .
"\n" .
"\n" .
" Cougalinks - %s\n" .
"\n" .
"\n\n", $_[0], $BODYTEXT, $BGCOLORPG, $LINK, $VLINK, $ALINK, $BGGIF);
printf("
", $ENV{'SCRIPT_NAME'}, $HOME, $ENV{'SCRIPT_NAME'}) if ($_[1]);
}
#
########## ---------------------- #############################################################
#
# S U B A D D
#
########## - ADD [] ------------- #############################################################
#
sub add
{
$INPUT{'name'} =~ s/<([^>]|\n)*>//g;
$INPUT{'name'} =~ s/\&/\&\;/g;
$INPUT{'name'} =~ s/"/\"\;/g;
$INPUT{'name'} =~ s/(.)/sprintf("%s", &uppercase($1))/e;
$INPUT{'description'} =~ s/\s/ /g;
&date();
$init = 0;
$mlog = $mlog - 1;
open(LINK, "$link_file");
flock LINK, 1;
@link = ;
close(LINK);
open(FILE, ">$link_file") || ¬ify("500 Internal Server Error", "I was not able to write to the \$data file chmod it to 666 and try again
If this is not admin, please let him/her know about this problem.", 0);
flock FILE, 2;
printf(FILE "%s|DI|%s|DI|%s|DI|%s|DI|0|DI|\n", $INPUT{'name'}, $INPUT{'url'}, $date, $INPUT{'description'});
while ($init !=$mlog) {
printf(FILE "%s", $link[$init]);
$init++;
}
close(FILE);
}
#
########## ---------------------- #############################################################
#
# S U B U P P E R C A S E
#
########## - UPPERCASE [] ------- #############################################################
#
sub uppercase
{
$tmp = $_[0];
$tmp =~ tr/a-z/A-Z/;
return ($tmp);
}
#
########## ---------------------- #############################################################
#
# S U B D A T E
#
########## - DATE [] ------------ #############################################################
#
sub date
{
@days = ('Sun','Mon','Tues','Wed','Thur','Fri','Sat');
@months = ('Jan','Feb','Mar','Apr','May','Jun','Jul',
'Aug','Sept','Oct','Nov','Dec');
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$hour = "0$hour" if ($hour < 10);
$min = "0$min" if ($min < 10);
$sec = "0$sec" if ($sec < 10);
$year = $year + 1900;
$date = "$months[$mon] $mday $year";
}
#
########## ---------------------- #############################################################
#
# S U B S T A T U S
#
########## - STATUS [] ---------- #############################################################
#
sub status
{
if (!-e "$link_file")
{
&top_html("Problema !", 0);
printf("
\n\n");
&bottom(1);
}
}
#
########## ---------------------- #############################################################
#
# S U B N F R A M E
#
########## - NFRAME [] ---------- #############################################################
#
sub nframe
{
printf("
\n" .
"
\n
\n" .
" %s
\n
\n", $_[0]);
printf("
\n\n");
}
#
########## ---------------------- #############################################################
#
# S U B M I S S I N G
#
########## - MISSING [] --------- #############################################################
#
sub missing
{
&top_html("Missing Field");
&nframe("Missing Field [$_[0]] Return to the " .
" F O R M and try again.");
&bottom(1);
}
#
########## ---------------------- #############################################################
#
# S U B N O T I F Y
#
########## - NOTIFY [] ---------- #############################################################
#
sub notify
{
$xtra = sprintf(" Return to the F O R M and try again.", $ENV{'HTTP_REFERER'}) if ($_[2] ==1);
$xtra = sprintf(" Return to my S I T E and surf on.", $HOME) if ($_[2] == 2);
&top_html("$_[0]");
&nframe("$_[1] $xtra");
&bottom(1);
}
#
########## ---------------------- #############################################################
#
# S U B B O T T O M
#
########## - BOTTOM [] ---------- #############################################################
#
sub bottom
{
printf("\n");
printf("\n");
exit(0) if ($_[0]);
}
#
########## ---------------------- #############################################################
#
########## - EXIT(0) ------------ #############################################################
#