#!/usr/bin/perl require "./config.pl"; require "./isp.pl"; opendir(TIS, "./turing_images/") or die "Could not open ./turingimages/ directory: $!"; my @images = grep { /\.gif$/ } readdir(TIS); closedir TIS; my $pic = $images[rand $#images]; unless (-d "$sessionfiles/turings/") { mkdir "$sessionfiles/turings/", 0777 or die "could not create directory '$sessionfiles/turings/': $!"; } open( CURRWORD, ">$sessionfiles/turings/$pic") or die "could not open : $!"; print CURRWORD "1\n"; close CURRWORD; select((select(STDOUT), $| = 1)[0]); print "Content-length: " . (-s "./turing_images/$pic") . "\n"; print qq|Pragma: no-cache Cache-Control: no-cache Vary: negotiate Content-type: image/gif |; open( IMG, "<./turing_images/$pic") or die "could not open : $!"; binmode IMG; binmode STDOUT; print STDOUT $buffer while (read (IMG,$buffer,1024)); close IMG; $SIG{PIPE} = 'IGNORE'; open STDERR, "dev/null"; open STDOUT, "dev/null"; open STDIN, "dev/null"; unless ($pid = fork) { unless (fork) { &ip2org($ENV{'REMOTE_ADDR'}, 7) if ($uniqorgnames); exit 0; } exit 0; } waitpid($pid,0);