Newsgroups : Borland : borland.public.delphi.internet.winsock : 2007 Oct : Re: Use Internetwrite to append to a web site file?
| Subject: | Re: Use Internetwrite to append to a web site file? |
| Posted by: | "Eddie Shipman" (mr_delphi_developer@nospamyahoo.com) |
| Date: | 3 Oct 2007 07:21:19 |
Joe H wrote:
> My program is loading a file from our web site and checking to see if
> it contains the code (a 32bit number) for the current user of the
> program. The file is a list of codes of people who have done charge
> backs, bad checks or otherwise are not legal to use my program.
>
> If the current user is on the list, besides making the program no
> longer work, I want to make a log entry into a password protected
> folder that identifies that this user attempted to access our services
> which indicates that he is illegally using our program.
>
> I realize I could download an entire log file, append an entry, then
> upload it back to the web site, but, even though there aren't many
> users in the list, it would certainly be possible for two of them to
> be accessing the site at the same time and cause problems with the log
> file. To resolve this, is there a way to just append a line of coded
> text to a file on the Internet? I've searched and can't see a way to
> do it.
>
> In lieu of that, I guess I could just make a single line file in a
> folder dedicated to this purpose.
>
> Of course the risk in any of this is that the user's machine would be
> sending the password and username to our site and I guess that could
> be intercepted and easily seen by a knowledgeable person with the
> right tools.
>
> Another approach would be to send the information encoded in a ?
> parameter to a web page. When you use InternetFileRead, can you append
> parameters to the filename and would script on the page be executed
> before that page is sent? In other words when you use http to access
> the web site in a program, it is the same as when you select a page in
> Internet explorer -- i.e. does the web site get a normal logable hit
> and is any javascript in the page executed?
>
> If someone can answer these questions or at least point me in the
> right direction I would greatly appreciate it.
I would create a PHP script that does that for me. I would send the
information in a POST request using Either Indy HTTP or even WinInet.
I would have a database on my website with the info in it and use PHP
to query the database and return a validation code to my program for
valid users. If a validation code was not returned, I'd disable my
program.
Very simple to do using PHP/mySQl and most hosts support that
combination.
--