PDA

View Full Version : help!!!!!!



coolguy23
May 4th, 2001, 17:34
i can't get this to work!!!!! :mad:

i need a cgi or php random image script that can be called through img tags
this is the one i tried but it isn't working!!!

#!/usr/local/bin/perl
#
#
# Random Image - non-ssi
#########################
#AUTHOR: David Powell
#http://www.matrixvault.com/cgi/
# Copyright 1999, David Powell and "The Matrix Vault"
# A Matrix Vault Production.
# Tested and run on a UNIX system with PERL 5
# This script is an original script by David Powell. You may use it free of charge, if you keep this header intact,
# along with any other copyright notices found in the resulting HTML output or text files generated by this script.
#
#########################
# Install:
# Set the 2 variables below.
# Upload to your server.
# CHMOD it to 755
# Call the script in your image tag:
# <img src = "http://www.yoursite.com/cgi-bin/ranimage_nssi.cgi>
# OR call directly from your browser:
# http://www.yourdomain.com/your cig-bin/ranimage_nssi.cgi
#
# All non-image files are weeded out, so you can use this to
# randomize images in any dir.
#
#
########################################
# E D I T V A R I A B L E S

# The UNIX dir of your images.
$IMG_DIR = "/web/sites/121/animex11/www.xanimex.f2s.com/buttons";

# The URL of $IMG_DIR
$VIRTUAL_DIR = "http://www.xanimex.f2s.com/buttons/";

# E N D V A R I A B L E S
#######################################################

opendir(DOT,"$IMG_DIR")|| &error ("Cannot Open $IMG_DIR");
foreach (sort readdir(DOT))
{
$file = $_;
if (($file =~ /.gif/) || ($file =~ /.tif/) || ($file =~ /.jpg/) || ($file =~ /.GIF/) || ($file =~ /.TIF/) || ($file =~ /.JPG/))
{ push (@dir_list, "$file");}
}
closedir(DOT);


srand(time ^ $$);
$IMG_NUM =rand(@dir_list);

print "Location: $VIRTUAL_DIR/$dir_list[$IMG_NUM]\n\n";

################
# ERROR HANDLING
################
sub error
{

print "Content-type: text/html\n\n";
print "<BOLD><FONT size=+1>Error:<FONT COLOR=\"#FF0000\"> <B>$_[0]</B></FONT></FONT><BR>";
exit;
}



i uploaded as images.cgi and chmoded to 755 and put it in img tags on http://www.xanimex.f2s.com but it isn't working!!!

please someone help me!!
here is http://www.xanimex.f2s.com/mygod.cgi
so i know cgi works ;)

meow
May 4th, 2001, 18:36
The great perl expert meow to the rescue! :p (YES it's a joke!)

You don't mention if you have changed the path to perl. I believe it's "#!/usr/bin/perl" at f2s.

coolguy23
May 4th, 2001, 23:19
holy crap!!!

it was the program location, i though i changed it, but oh well

thanks alot!!!!

meow
May 4th, 2001, 23:49
Takes one to know one! :p
I was so close to not post that. Thinking you had changed it but didn't bother to mention it. :D