Tue Oct 30
Sat-Sun Oct 27-28
Task 01: Apache Task 02: Unix/HTML Task 03: Perl/Python Task 04: CGI with Perl and Python Task 05: Keeping state (CGI/hidden fields) Task 06: SQL and MySQL Task 07: PHP Task 08: PHP sessions Task 09: Database access from PHP, Perl and Python Task 10: Implementing CGI sessions with Perl DBI
Fri-Thu Oct 5-11
All links in the material for last week work now.
Thu Oct 4
Materials we might want to briefly visit this week (three links at the top).
Wed Oct 3
The fix we need to apply to two to eliminate accidental reloads: three.
Fri-Tue Sep 28-Oct 2
Sequence of tasks for the semester portfolio now complete.
Thu Sep 27
The test will be 5-7 minutes long. After that you will take turns converting them to PHP.
Wed Sep 26
We spent 25-30 minutes to develop the first, and only 3-4 minutes to get the second from the first.
Tue Sep 25
Or, maybe we should start with the program discussed in the text (pp. 51-66).
Fri-Mon Sep 21-24
Specifics for database connection for this semester (please use your port and password):
#!/usr/bin/perl use DBI; use CGI; $q = new CGI; print "Content-type: text/html\n\n"; $DB = "dbi:mysql:demoOne:silo.cs.indiana.edu:port=14518"; $username = "dgerman"; $password = "sp00n"; # put your own password, you can see mine if you highlight it $dbh = DBI->connect($DB, $username, $password, {PrintError => 0}) || die "Couldn't open database: ", $DBI::errstr; $query = "select * from players"; $sth = $dbh->prepare($query) || die $dbh->errstr; $sth->execute() || die $sth->errstr;
Programs that you might want to test your PHP with:
This is similar to the one above, just uses client-side state:<? session_start(); if ($message) { $balance += $amount; $message = "Balance is currently: " . $balance; } else { // initialize state $message = "Balance is: "; session_register("message"); $balance = 0; $message .= $balance; session_register("balance"); } ?> <form> <?=$message?> <p> Amount to add: <input type="text" name="amount" size=4> <p> Press <input type="submit" value="Proceed"> when ready. </form>
We will explain them both, very thoroughly this coming week.<? if ($message) { $balance += $amount; $message = "Balance is currently: " . $balance; } else { // initialize state $message = "Balance is: "; $balance = 0; $message .= $balance; } ?> <form> <?=$message?> <p> Amount to add: <input type="text" name="amount" size=4> <p> Press <input type="submit" value="Proceed"> when ready. <input type="hidden" name="message" value="$message"> <input type="hidden" name="balance" value="$balance"> </form>
Wed-Thu Sep 19-20
Here's some code you could use directly:
The two lines you need to add to./configure \ --with-mysql=/nobackup/dgerman/mysql \ --with-apxs2=/u/dgerman/apache/bin/apxs \ --with-config-file-path=/u/dgerman/apache/conf \ --with-xml --enable-track-vars \ --prefix=/u/dgerman/apache
httpd.conf
:
AddType application/x-httpd-php .php .phtml AddType application/x-httpd-php-source .phps
The notes on the class notes page will not add much more to what's posted here.
Mon-Tue Sep 17-18
mysql_start
batch file:
--log-error=/nobackup/dgerman/mysqld-error.log \
Steps for installing MySQL: one, two, three, four.
Another set of notes with a shorter sequence of steps.
Sat-Sun Sep 15-16
Wed-Fri Sep 12-14
Steps for installing a protected folder: one, two.
Code we will most certainly develop in class on Thu: one, counter.Program to study: shuffle (see it running here). What's it doing?
Tue Sep 11
Fri-Mon Sep 7-10
Wed Sep 5
Tue Sep 4
Here's the command prompt calculator:
Here's the program that reports the time, as well the contents of hashtable#!/usr/bin/perl $balance = 0; print "Your balance is: $balance\n"; print "Type> "; while ($line = <STDIN>) { chop($line); ($fun, $arg) = split(/ /, $line, 2); print "You want to $fun a value of $arg to the balance of $balance.\n"; if ($fun =~ /^add/i) { $balance += $arg; } elsif ($fun =~ /^sub/i) { $balance -= $arg; } else { print "I am sorry I don't understand $fun."; } print "The balance is now: ", $balance, "\n"; print "Type> "; }
%ENV
:
#!/usr/bin/perl print "Content-type: text/html\n\n"; $time = localtime; print "Hello! The time is now: $time"; foreach $key (keys %ENV) { print $key, " --> ", $ENV{$key}, "<br>"; }
Mon Sep 3
Thu Aug 31
Wed Aug 30
Tue Aug 28
Apache installation notes:
Mon Aug 27
There is also a graduate section for this course (see section 30446).
Brief overview of the class:
The main purpose of this class is to: