#!/usr/bin/perl require 'dr-lib.pl'; require 'ctime.pl'; my $now = &ctime(time); srand unpack("%32L*", $ENV{'SERVER_NAME'}); open (FILE, '> /tmp/links.'.$ENV{'UNIQUE_ID'}); print FILE "Content-type: text/html\n\n"; open (LINKS, '/home/dr/links.txt'); my @rawlinks = ; close (LINKS); my @links = (); foreach $link (&random_list(@rawlinks)) { $link =~ s/^\s+//; $link =~ s/\s+$//; next unless $link; next if $link=~ /$ENV{'HTTP_HOST'}/; push @links, $link; } my $mode = int(rand 6) + 1; my $data; if (rand() < 0.5) { my $links1 = ''; my $links2 = ''; my $flipflop = 1; foreach $link (@links) { ($url, $title, $desc) = split("\t", $link); if ($mode == 1) { $link = "
  • $title:
       $url"; } elsif ($mode == 2) { $link = "
  • $url
       $desc"; } elsif ($mode == 3) { $link = "
  • $title
       $desc"; } elsif ($mode == 4) { $link = "
  • $title
       $url"; } elsif ($mode == 5) { $link = "
  • $title:
       $desc"; } else { $link = "
  • $desc
       $url"; } if ($flipflop) { $links1 .= $link; } else { $links2 .= $link; } $flipflop = !$flipflop; } $data =<
      $links1
      $links2
    END } else { my $flipflopflap = 1; foreach $link (@links) { ($url, $title, $desc) = split("\t", $link); if ($mode == 1) { $link = "$title:
       $url"; } elsif ($mode == 2) { $link = "$url
       $desc"; } elsif ($mode == 3) { $link = "$title
       $desc"; } elsif ($mode == 4) { $link = "$title
       $url"; } elsif ($mode == 5) { $link = "$title:
       $desc"; } else { $link = "$desc
       $url"; } if ($flipflopflap == 1) { $data .= "$link"; $flipflopflap = 2; } elsif ($flipflopflap == 2) { $data .= "$link"; $flipflopflap = 3; } else { $data .= "$link\n \n"; $flipflopflap = 1; } } $data .= "\n" if ($flipflopflap == 2); $data .= "\n" if ($flipflopflap == 3); $data =<
    $data

    END } my @titles = ('Digital Routes Website Directory', 'Digital Routes Websites', 'Digital Routes Network', 'Digital Routes Clients', 'Digital Routes Customers', 'Digital Routes Scotland', 'Digital Routes Hosting', 'Digital Routes'); my $title1 = $titles[rand(@titles)]; my $title2 = $titles[rand(@titles)]; if (rand() < 0.33) { $line1 = "Digital Routes is a Scottish web design, programming and hosting company with a large portfolio.\n"; } elsif (rand() < 0.5) { $line1 = "Digital Routes has created a large number of websites for clients in Scotland and beyond.\n"; } else { $line1 = "Digital Routes has built and hosts many websites for clients in Scotland and around the world.\n"; } if (rand() < 0.33) { $line2 = "If you liked $ENV{'SERVER_NAME'}, you will probably find our other website of interest.\n"; } elsif (rand() < 0.5) { $line2 = "In addition to $ENV{'SERVER_NAME'}, we invite you to browse the websites listed below which are also hosted on our network.\n"; } else { $line2 = "$ENV{'SERVER_NAME'} is just one of these sites, please take look at some of the others.\n"; } if (rand() < 0.33) { $line3 = "Or take a look at what we can offer you.\n"; } elsif (rand() < 0.5) { $line3 = "Or find out more about us.\n"; } else { $line3 = "Or visit our website for more information.\n"; } print FILE < $title1 ($ENV{'SERVER_NAME'})

    [Digital Routes] $line1 $line2 $line3 $data $now END close(FILE); system('/usr/bin/python /home/dr/highlighter/highlighter.py < /tmp/links.'.$ENV{'UNIQUE_ID'}); unlink ('/tmp/links.'.$ENV{'UNIQUE_ID'});