#!/usr/bin/env perl unless ($ENV{"HTTP_USER_AGENT"} =~ m/iP(hone|od);/) { print "Status: 302 Moved\nLocation: http://www.mackiev.com/iphone\n\n"; exit; } #look for our cookie $qs= $ENV{"HTTP_COOKIE"}; @b = split(/\;/, $qs); $qs=""; foreach $x ( @b) { if ($x eq "regist=done") { $qs="founs"; last; } } if ($qs eq "") { $file="./reg.cgi"; $typ= 'text/html'; } else { $qs= $ENV{"QUERY_STRING"}; if ($qs ne "") { $typ = 'text/plain'; $file= "days/day$qs"; } else { $file="./tdh.cgi"; $typ= 'text/html'; } } print "Content-Type: " . $typ . "\n\n"; open (FF, $file); while () { print; } close (FF); if ($ENV{"REQUEST_METHOD"} =~ m/POST/i ) { open (FF, ">>./log.cgi"); flock(FF, LOCK_EX); while(<>) { print FF; } print FF "\n"; flock(FF, LOCK_UN); close(FF); }