Web Counter by Oliver16th Feb 2004 6:41
|
---|
Summary This code can be used to count the number of people who have used your program. Description This code can be used to count the number of people who have used your program. Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com remstart Counter This code can be used to count the number of people who have used your program. For this code to work, you must have an FTP account, and the user must be connected to the internet. Depending on the speed of yor sever, this should take less than 10 seconds. Before running this code you need to create a text file (counter.txt) containing the number "1" and upload it to your FTP account. remend rem Connect to your FTP account: ftp connect "url","user","password" ftp connect "","","" rem Only proceed if connected if get ftp status()=1 rem If the file (counter.txt) already exists on your hard drive then delete it if file exist("counter.txt")=1 then delete file "counter.txt" rem Download the new file to your hard drive ftp get file "counter.txt","counter.txt" rem Only proceed if the download was sucessful if file exist("counter.txt")=1 rem Open the file on your hard drive, and store the number inside to counter$ open to read 1,"counter.txt" read string 1,counter$ close file 1 rem Delete the file on your hard drive delete file "counter.txt" rem Create a new file, and save the previous number +1 open to write 1,"counter.txt" write string 1,str$(val(counter$)+1) close file 1 else counter$="Failed" endif rem Delete the file on your FTP account ftp delete file "counter.txt" rem Upload the new file ftp put file "counter.txt" rem Delete the file on your hard drive if file exist("counter.txt")=1 then delete file "counter.txt" ftp disconnect 1 endif rem Print the number do set cursor 0,0 print counter$ sync loop |