pleek Posted November 16, 2007 Share Posted November 16, 2007 hey everybody ive just got a quick question for u all. Is there any code out there that will alert me (in any way) that the directory the code is in has been changed? Im tryin to set up a part on my server space for a adult friend of mine to put codes, programs, and other stuff in a directory for me when he gets something he thinks id like to have, and have it notify me when something new is added. By e-mail alert on my main page, or really anything. If this is impossible let me know but im quite sure that this can be done. Anybody know? maby a guide or a sample code. Any help would be apreciated. Quote Link to comment https://forums.phpfreaks.com/topic/77637-directory-change-code/ Share on other sites More sharing options...
Daniel0 Posted November 16, 2007 Share Posted November 16, 2007 Sure, just check what is in it and store that information, then if you wish to check if something has been deleted or added then you just check again and compare the old info with the new info. Quote Link to comment https://forums.phpfreaks.com/topic/77637-directory-change-code/#findComment-393211 Share on other sites More sharing options...
TAz69x Posted November 17, 2007 Share Posted November 17, 2007 ya, you can use something like scandir() for something like this, and like daniel said, either store it in something in like a cookie or a file, or even a database!, just anything to check back to later and compare Quote Link to comment https://forums.phpfreaks.com/topic/77637-directory-change-code/#findComment-393346 Share on other sites More sharing options...
pleek Posted November 18, 2007 Author Share Posted November 18, 2007 so can i use scandir() and use it to notify my of any changes? Quote Link to comment https://forums.phpfreaks.com/topic/77637-directory-change-code/#findComment-393687 Share on other sites More sharing options...
Daniel0 Posted November 18, 2007 Share Posted November 18, 2007 scandir() tells you what is in a directory: files, folders, links If you save that information somewhere then when you use scandir() again you can compare the results. Quote Link to comment https://forums.phpfreaks.com/topic/77637-directory-change-code/#findComment-393802 Share on other sites More sharing options...
pleek Posted November 18, 2007 Author Share Posted November 18, 2007 so if i use the code uve given me it will display on screen all files in my dir right? Quote Link to comment https://forums.phpfreaks.com/topic/77637-directory-change-code/#findComment-394080 Share on other sites More sharing options...
Daniel0 Posted November 18, 2007 Share Posted November 18, 2007 Yes, you can read about it here: http://php.net/scandir You'll need PHP5, if you don't have that then you can do the same with a combination of opendir(), readdir() and closedir() though. Quote Link to comment https://forums.phpfreaks.com/topic/77637-directory-change-code/#findComment-394100 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.