Hey There!
Its really weird because this is the first time i have posted in the forums and also i just thought about doing almost the EXACT thing that ur doing. I was/am going to make a messenger program and also use my own FTP site aswell!.
By the way, I think we should keep in touch with eachother because we can help eachother here! - my e-mail address
[email protected]
HERE IS THE HELP
Firstly, you dont need to use the IP of computers if you are going to use your own ftp site to upload and download from.
FOLDER/FILE EXAMPLES ON FTP SITE
You can add any other files you want but you need to at least have these files:
DATABASE.txt - Store the usernames of people who are online
CONVERSATION.txt
Ok, here's what will happen. You can only have one conversation in this example but any amount of people can be in it. You first need to use this code:
REM get username (no password either in this example)
-----
REM connect to ftp server using the info of the ftp site
REM you have.
FTP CONNECT Url$, User$, Password$
-----
[checkLoop]
REM get the DATABASE.txt to copy onto the hard drive
REM temporarily.
FTP GET FILE "DATABASE.txt", "DATABASE.txt"
-----
REM open the file that is now on the hard drive.
OPEN TO READ 1, "DATABASE.txt"
-----
REM make a dimension array (string) for the usernames.
DIM usernames$(100)
-----
REM put the usernames in the dim array by reading from
REM the file.
index=0
[readLoop]
READ STRING 1, usernames$(index)
index=index+1
if FILE END(1)=0 then goto [readLoop]
index=index-1
CLOSE FILE 1
DELETE FILE "DATABASE.txt"
-----
REM open file to write the usernames plus your own.
OPEN TO WRITE 1, "DATABASE.txt"
[writeLoop]
WRITE STRING 1, usernames$(index2)
index2=index2+1
if index2=index1 then if namedone$="" then WRITE STRING 1, username$
if index2<index1 then goto [writeLoop]
CLOSE FILE 1
-----
REM put the updated file on the ftp site
FTP PUT FILE "DATABASE.txt"
REM delete the file from your hardrive as it is not needed
REM and will creat errors if kept.
DELETE FILE "DATABASE.txt"
-----
REM other code
namedone$="done"
You can use the usernames$() to tell people who is online.
when you want to check when someone is online again just use:
GOTO [checkLoop]
Please email me back!
[email protected]