|
CSCI A348/548
|
protected and include answers to all the questions for our review.
These are the questions:
tar? When do you use it and why?
crontab? When do you use it?
.conf files did you have to edit before installing Apache.
httpd.pid file?
httpd.pid file?
How was-rw--w--wx 1 dgerman 422 Oct 14 17:16 gamma.html
chmod used to change the permissions on this file as shown?
#!/usr/bin/perl
&ReadParse;
&header("Lab 5 Circular Script");
&printform($in{count});
&trailer;
sub printform {
local ($arg) = @_;
local $count = $arg + 1;
print qq {
<form method="POST" action="$ENV{SCRIPT_NAME}">
Your call has number: <font size=+5>$count<font>. <p>
Press <input type="submit" value="here"> to call again.
<input type="hidden" name="count" value="$count">
</form>
};
}
sub header {
local ($t) = @_;
print "Content-type: text/html\n\n<html><head>";
print "<title>$t</title></head><body bgcolor=white>\n";
}
sub trailer {
print "\n</body></html>";
}
sub ReadParse {
if ($ENV{'REQUEST_METHOD'} eq 'GET' ) {
$in = $ENV{'QUERY_STRING'};
} elsif ($ENV{'REQUEST_METHOD'} eq 'POST') {
read (STDIN, $in, $ENV{'CONTENT_LENGTH'});
}
@in = split(/&/, $in);
for ($i = 0; $i <= $#in; $i++) {
$in[$i] =~ s/\+/ /g;
($key, $val) = split(/=/, $in[$i]);
$key =~ s/%(..)/chr(hex($1))/ge;
$val =~ s/%(..)/chr(hex($1))/ge;
$in{$key} = $val;
}
}
Note: the form contains a text field and password field inside a 2x2 table. Call the two fields uname and pword respectively. Make the form POST the data to the following script:
http://burrowww.cs.indiana.edu:10000/cgi-bin/simpleCheck
#!/usr/bin/perl
$i = 0; $j = 1;
if ($i = 2) { print $i; }
else { print $j; }
$i = 0 in the condition
for the if statement.
#!/usr/bin/perl
$i = 0; $j = 1;
if ($i = 0) { print $i; }
else { print $j; }
httpd.conf file as:
and a scriptUser nobody
script in your cgi-bin
directory that looks like this: where username is your username. Assume-rwx------ 1 username students 192 Sep 15 01:32 script
script has the following
code: What will happen when you call this script with a web browser? Why?#!/usr/bin/perl print "Content-type: text/html\n\nHello world!";
and a properly configured* 6 * * * /u/username/bin/starthttpd
starthttpd.
Then your server will be checked and if needed restarted exactly how many times a day?
function Globe() {
this.x = 3;
this.y = 3;
}
g = new Globe();
g["x"] += g.x;
document.write(g.x);
What will the browser display when you load this page in it?
Where have we seen it, how do we use it?
ENV? How do we use it?
grep and when do you use it?
A348/A548