This is a test, so can everyone run this code while connected to the net. post here when you have done it.
Anyone who helps will be in the list of credits in the program.
'***************************
'** Messenger **
'***************************
'make a dimension array (string) for the usernames.
DIM usernames$(100)
'---------------
'get username (no password either in this example)
INPUT "Please enter a username: "; userName$
'---------------
'connect to ftp server using the info of the ftp site you have.
FTP CONNECT "paradise-workshop.netfirms.com", "paradise-workshop", "yvcbz"
FTP SET DIR "www"
'---------------
'get the DATABASE.txt to copy onto the hard drive
'temporarily.
FTP GET FILE "DATABASE.txt", "DATABASE.txt"
'---------------
'open the file that is now on the hard drive.
OPEN TO READ 1, "DATABASE.txt"
'---------------
'put the usernames in the dim array by reading from the file.
readLoop:
IF FILE END(1)=1 THEN GOTO endReadLoop
READ STRING 1, usernames$(index)
IF FILE END(1)=1 THEN GOTO endReadLoop
index=index+1
GOTO readLoop
endReadLoop:
CLOSE FILE 1
DELETE FILE "DATABASE.txt"
amountOfUsers=index
'---------------
'open file to write the usernames plus your own.
OPEN TO WRITE 1, "DATABASE.txt"
writeLoop:
IF index2=index1 THEN GOTO writeName
WRITE STRING 1, usernames$(index2)
index2=index2+1
GOTO writeLoop
writeName:
WRITE STRING 1, userName$
CLOSE FILE 1
'---------------
'put the updated file on the ftp site
FTP PUT FILE "DATABASE.txt"
'delete the file from your hardrive as it is not needed and will creat errors if kept.
DELETE FILE "DATABASE.txt"
'---------------
'print done and disconnect
FTP DISCONNECT
PRINT "DONE"
PRINT "Press escape"
xxxpetratxxx
B. R. W