'=========================================================================== ' Subject: TIP OF THE DAY CGI FOR PB Date: 11-06-99 (09:48) ' Author: Tarael Code: PB ' Origin: desmarais@home.com Packet: PB.ABC '=========================================================================== ' Tip of the Day CGI program written in PowerBASIC 3.5 ' ' Hi, the code for this was based on Beemer's PB code for doing CGI ' with the Xitami webserver, and the idea for a tip of the day program ' for PowerBASIC came from the cheesy one that was available for Base-C... ' Its really simple. Just opens the CONSole for output, opens tips.txt, ' reads all the lines in, keeping track of how many tips there are, ' then selects a random number based on the number of tips available, ' and prints it in some simple HTML format :) ' Hopefully, I'll be able to do some more submissions to the All Basic ' Code archives, as this is my first. Go ABC! Your the best BASIC ' site anywhere! :) ' ' -- Tarael, November 1999 ' Cut this out and paste it into tips.txt, removing the apostrophes.. 'My cat smells like cat food 'DOH! 'Excellent.... 'Me lose brain? Uh-oh! open "CONS:" for output as #1 ' Needed for CGI output! open "tips.txt" for input as #2 ' Tips of the day! DIM tips(1 to 200) AS STRING ' accept up to 200 tips RANDOMIZE TIMER ' read in all the tips do while not eof(2) numtips = numtips + 1 line input #2, atip$ tips(numtips) = atip$ loop a = 0 ' select a random tip randtip = INT(RND * numtips) + 1 print #1, "Today is:
" print #1, " Your tip of the day is: "; tips(randtip); "
" GOTO done DONE: close #1 close #2