Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Other Scripting Languages (http://www.programmingforums.org/forum39.html)
-   -   Simple Program Required.. (http://www.programmingforums.org/showthread.php?t=1594)

Tomos Dec 20th, 2004 7:00 AM

I am not a programmer and have only experienced dos batch files before. I have constructed a private website for my friends and somebody of that group is going travelling and would like to keep an online diary on my page.
The page runs on a simple unattended server in my garage that automatically accepts uploads through an MSN messenger running on it.

I would like a simple program that checks for the existance of a certain named file 'traveller.txt' for example. Then if it exists, move it into a directory where it can be appended to previous traveller.txt files and then displayed on the website.

So, the traveller uploads her daily diary, it gets moved out of the 'uploads' directory and her previous uploaded text get ammended to it then put into a directory where the website can see it and display it as text on the page.

I don't think thats too hard to write as a batch file that waits 60 seconds before checking and running in a loop..

Can anybody help me with this please?!
Apologies if this isn't in the right sections, but this is a sort of simple script required.

Ooble Dec 20th, 2004 10:05 AM

I suggest learning PHP - if you do it right, you can have it automatically update it as it goes.

big_k105 Dec 20th, 2004 10:25 AM

i think it would be alot easier to find a php blogging script that you can install and would do this but you wouldnt have to upload anything via msn anymore you could just have them log in and post there diary kind of like this forum software even :) but sorry i cant help with your actually problem as i dont know how i would go about doing it sorry

Infinite Recursion Dec 20th, 2004 6:19 PM

That's fairly easy to do in C++... you can also run it in a scheduled task or a service.

If file exists in X... move file to Y, appending to originial file...

sounds like something i may need eventually, i'll look into it, if i have sufficient time.

david Mar 31st, 2005 7:52 PM

ONE ip one Message submit
 
Dear I have website it also have a feedback form.
I am using cgiemail form v1.6

The user mostly submit the feedback form more than one time.
Some times a form submitted more that 10 times with the same Ip address.

I want to restrict submit with one IP Address for atleast 24 hours.

My site hosted at linux \ unix based server
I do not know JSP or PHP.


Please help me to solve this problem
email me at davidjohny@yahoo.com
Thankyou in advance
David

peace_of_mind Mar 31st, 2005 8:10 PM

Hey David, double posting is not necessary. And hijacking threads is very annoying. By the way, could you use a larger font, please, I'm having trouble reading that from the next room. Thanks

tempest Mar 31st, 2005 11:02 PM

That's insecure.

thechristelegacy Mar 31st, 2005 11:31 PM

Just because I was bored ;)

:

from time import sleep
from os import chdir

# Keep this script in the same directory as the file you're wanting to copy
# to another location.

PATH_1 = "C:\home" #Change this to were where the first file is
PATH_2 = "C:\Anthonysstuff"  # Change this to whereever you're hosting the files to the internet
FILE_NAME = "traveller.txt" # Name of file


def update(sec):
    while 1:

        chdir(PATH_1)
        first = open(FILE_NAME,"r")
        x = first.read()
        first.close()
        # print len(x)

        chdir(PATH_2)
        second = open(FILE_NAME,"r")
        y = second.read()
        second.close()
        # print len(y)

       

        if len(x) > len(y):
            update = open(FILE_NAME,"w")
            update.write(x)
            update.close()
        else:
          sleep(sec)

update(60) # The number is parentesies is how many seconds you want it to check


You'll need the Python runtime. Comments pretty much explain it, but if you have any questions, let me know.


All times are GMT -5. The time now is 4:16 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC