Oh Jacque, you’ve been so kind to me over Zygodact and other things, and I’ve 
been so slow, that I didn’t dare ask! However, you are of course spot on. 
Thanks.

Graham

> On 19 Sep 2016, at 23:43, J. Landman Gay <jac...@hyperactivesw.com> wrote:
> 
> On 9/19/16 3:15 PM, Graham Samuel wrote:
>> I have a .lc script on the server that invokes Jacque Gay’s Zygodact
>> product to generate license codes, which are then passed on to the
>> payment processor. This works fine. However when a code is generated,
>> it would be prudent to keep it in a file which is on the server. So I
>> want to add a few lines of code to the aforesaid .lc script so that
>> each code goes into a text file.
> 
> That's easy, I do it with all my Zygodact server scripts. The main thing to 
> be aware of is that the text file needs to have read/write permissions. I 
> couldn't generate a file from scratch because of the permission issues (I'm 
> sure there's a way around this, but I didn't know how.) So what I do is 
> create an empty text file on the server and give it read/write permissions 
> (755) manually using Fetch or any other FTP app. I put the file directly in 
> the CGI folder, which is inaccessible to visitors.
> 
> After that, just add this handler to your .lc script:
> 
> on log pData
>  put "myLog.txt" into tFile
>  open file tFile for append
>  write pData &cr & cr to file tFile
>  close file tFile
> end log
> 
> Then in the main body of the script, collect the data you want to store into 
> a variable and add a "log dataVar" line.
> 
> The reason I use open/write/close instead of "put after URL" is because 
> opening a file for append doesn't need to read the whole thing into memory 
> and then write it all back out again. It seems like a better use of resources.
> 
> -- 
> Jacqueline Landman Gay         |     jac...@hyperactivesw.com
> HyperActive Software           |     http://www.hyperactivesw.com
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to