------------------------------------------------------------------------------- CGI script Basics A CGI script can return any data, text or binary, html or images, but must at a minimum return a header of the content type of the data, followed by a blank line. EG: print "Content-type: text/html\n\n" Note a content-type of "text/*" is special in that the client will be allowed to modify the end of lines to match the requirments of the system!!!! Anything else is data specific and is generally left alone. EG: "text/xml" is handled differently to "application/xml" The generic type which can only be saved to disk is "application/octet-stream" And means it is a unknown 8-bit binary file, and is up to the user to handle correctly. ------------------------------------------------------------------------------- Generate a Unique SessionID This creates a Session ID that you can pretty well be sure will be unique even on the busiest web server... my ( $sec, $min, $hour, $mday, $mon, $year) = localtime(time); my @rand = ( int(rand*10000), int(rand*10000), int(rand*10000) ); my $session_id - sprintf("%02d%04d%02d-%02d%02d%04d-%d%d%d", $sec, pop @rand, $min, $hour, $mday, pop @rand, pop @rand, $mon, $year ); the Session ID can then be passed from link to link in CGI scripts, and use to look up the users temporary information until it expires. -- Martin C. Brown -------------------------------------------------------------------------------