#!/usr/bin/perl -w
#YOUSEF RABAH
use strict; #enforced declerations and quoting
use CGI qw(:standard); # provided some useful
use Fcntl qw(:flock); #provided lock-ex, lock_sh, lock_NB
use LWP; #Library for WWW access in Perl
print "Content-Type: text/html\n\n";
print "\n";
print "
Hello and welcome to my cgi program on the net
";
print " This is the beginning of a new experience ...
";
print "\n";
print "
";
print "Files in this directory:
";
open(DIR, "ls -l |");
while () {
print "\t- $_
\n";
}
#print "
2 + 3 = ";
#printf ( 2 + 3 ); # or 2+3 w/out brakts.
print "\n\n
\n";
my $key; #initializes a local variable.
foreach $key (keys (%ENV)) {
print " --> $key = $ENV{$key}
";
}
sub keefo {
print "Inta shoo akhbarak ? inshallah good
";
}
print "
";
#keefo();
print "
";
my $i=0;
my $where = "who_out.".++$i;
system "(date; who) >$where &"; #Set a script to show who is running on from CS
print "Last time script ran was Click here";
print "
";
#my @result = qw(That is really);
#push @result, qw(nice); #Display's This is really nice
#print "@result
";
#my %favo;
#%favo = (
# trupsh => "Trupsh Asly",
# shater => "Bass Balash",
# r => "R U 4 REAL ? ",
#);
#print " ";
#print start_form();
#print p('whats ur name? ', textfield('name'));
#print p('Pick something? ', popup_menu('nai',[%favo]));
#print p(submit('IB3AT'), reset('Clear'));
my $name;
$name = "q.cgi";
if (-e $name) {
print "So you have $name as a file already\n";
}
else {
print "You do not have this ... \n";
}
print "
";
my $filename = "t.cgi";
if (-r $filename && -w $filename){
print "Great so $filename is readable and rewritable";
}
else {
print "There is only one who can read & write on the filename $filename
";
}
print "
";
my $now = "The time now is ".`date`; #getting the TIME, Day and month
print "Visit my website @ -- www.earlham.edu/~rabahyo
\n";
print "Email me -- yousef
\n";
my $addr;
($addr) = (gethostbyname ("www.earlham.edu"))[4]; #getting IP addresses
print " $now
I P : ",
join(".", unpack("C4", $addr));
print "\n";
close(DIR);
exit;