swap567 Posted February 18, 2009 Share Posted February 18, 2009 Hi guys I tryed to search on the internet but I didn't found. I need to do a table with all folder in a certain path and give the last modified file of the folder. My application is on a linux server. If my wanted path is on the same server thats ok everything works fine but The wanted path will be on a windows data server. I can acces it by making a hyperlink to it e.g.: <a href='file:\\\serverName\\folder\\an other folder\\file.txt'>file.txt</a> but if I try to see if the file exist e.g.: if(is_dir("\\serverName\folder")){ echo "exist"; }else{ echo "don't exist"; } I even try this if(file_exists('file:\\\serverName\\folder')){ echo "exist"; }else{ echo "don't exist"; } it said that the directory didn't exist any help?? thanks Quote Link to comment https://forums.phpfreaks.com/topic/145797-file-exist-on-data-server/ Share on other sites More sharing options...
premiso Posted February 18, 2009 Share Posted February 18, 2009 The '\\serverName' (note single quotes) would be correct, but I think you have to actually connect to that network drive. Look into fsockopen and those functions for more information on this. Quote Link to comment https://forums.phpfreaks.com/topic/145797-file-exist-on-data-server/#findComment-765506 Share on other sites More sharing options...
swap567 Posted February 18, 2009 Author Share Posted February 18, 2009 Ok thanks I'll give a try but how can I have the port, errno etc ??? Quote Link to comment https://forums.phpfreaks.com/topic/145797-file-exist-on-data-server/#findComment-765514 Share on other sites More sharing options...
swap567 Posted February 18, 2009 Author Share Posted February 18, 2009 I try $fp = fsockopen('\\servername\folder', 80, $errno, $errstr, 30); if ($fp) { echo "exist"; }else{ echo "dont exist"; } and it didn't work any help?? Quote Link to comment https://forums.phpfreaks.com/topic/145797-file-exist-on-data-server/#findComment-765518 Share on other sites More sharing options...
premiso Posted February 18, 2009 Share Posted February 18, 2009 Like I said, I have never done this. Chances are it is not port 80. You have to find out what port windows file server uses. I have no clue which port that is. PHP Networking may also have some more insight. Port 80 is used by web servers so I bet it does not work cause that file server is probably not running Apache to dish out the files. EDIT: And to be honest, I do not even know if this is possible. You "may" want to setup an FTP server to access those files, but that opens a whole nother can of worms. And the above would only work if the Windows Box is on your local network if it would even work. If they are not on an internal network with each other, FTP would be the only way to go about this. Unless you can figure out how to get this to work on an internal network, then VPN would be an option as well. Quote Link to comment https://forums.phpfreaks.com/topic/145797-file-exist-on-data-server/#findComment-765522 Share on other sites More sharing options...
swap567 Posted February 18, 2009 Author Share Posted February 18, 2009 ok and is it possible to do a little script that my php page will call and that will be running on the pc of the user who's visiting my page. the script will verify if the file exist and will populate my table?? after my hyperlink will work with the file the script found. Quote Link to comment https://forums.phpfreaks.com/topic/145797-file-exist-on-data-server/#findComment-765533 Share on other sites More sharing options...
swap567 Posted February 19, 2009 Author Share Posted February 19, 2009 is there only javascript that php can call?? Quote Link to comment https://forums.phpfreaks.com/topic/145797-file-exist-on-data-server/#findComment-766062 Share on other sites More sharing options...
premiso Posted February 19, 2009 Share Posted February 19, 2009 is there only javascript that php can call?? It would be an ActiveX Control that the end user calling the page would need to allow to install. Look into those if this is what you want to do. Quote Link to comment https://forums.phpfreaks.com/topic/145797-file-exist-on-data-server/#findComment-766138 Share on other sites More sharing options...
allworknoplay Posted February 19, 2009 Share Posted February 19, 2009 ok and is it possible to do a little script that my php page will call and that will be running on the pc of the user who's visiting my page. the script will verify if the file exist and will populate my table?? after my hyperlink will work with the file the script found. Dude, this sounds like border line hacking. IE or FF isn't going to let activex controls or whatever run scripts on someone's PC...what are you trying to do exactly? Your original post was about checking file exists, and now you want to run scripts on someone's PC? Quote Link to comment https://forums.phpfreaks.com/topic/145797-file-exist-on-data-server/#findComment-766143 Share on other sites More sharing options...
premiso Posted February 19, 2009 Share Posted February 19, 2009 Dude, this sounds like border line hacking. IE or FF isn't going to let activex controls or whatever run scripts on someone's PC...what are you trying to do exactly? Your original post was about checking file exists, and now you want to run scripts on someone's PC? They will allow it to run on their pc if the end user let's it. Simple as that, if it really is legit, people will know to allow it and the source is trusted. If not they will just deny the Activex controls. Quote Link to comment https://forums.phpfreaks.com/topic/145797-file-exist-on-data-server/#findComment-766148 Share on other sites More sharing options...
allworknoplay Posted February 19, 2009 Share Posted February 19, 2009 Dude, this sounds like border line hacking. IE or FF isn't going to let activex controls or whatever run scripts on someone's PC...what are you trying to do exactly? Your original post was about checking file exists, and now you want to run scripts on someone's PC? They will allow it to run on their pc if the end user let's it. Simple as that, if it really is legit, people will know to allow it and the source is trusted. If not they will just deny the Activex controls. Oh sure, if it's legit. You know the average mom or dad sitting at a website will get the pop up and probably just hit OK... I just hope this guys question is legit that's all, he's jumping around with what things to do... Quote Link to comment https://forums.phpfreaks.com/topic/145797-file-exist-on-data-server/#findComment-766164 Share on other sites More sharing options...
premiso Posted February 19, 2009 Share Posted February 19, 2009 Oh sure, if it's legit. You know the average mom or dad sitting at a website will get the pop up and probably just hit OK... Anyone can learn ActiveX, sadly enough. As arrogant as it sounds, if person A is dumb enough to install something without knowing what it is, I have no mercy for them. This is why I setup my parents computers and I train them on how to properly use it. Mainly because I hate cleaning up on spyware. Now anytime something pops up to install they call me up and ask me if it is ok. I know not everyone has that, and it is just me being arrogant. But if you do not want to get taken advantage of on the computer/internet you have to put forth some effort and learn how to use it properly. 90% of people are too lazy to take that time to ask someone, hire someone or to even pay attention on how to. As far as this being a "hacking" attempt, could be. It could be legit that he is on an intranet and just wants to allow people access. Either way, if he is dumb enough to try this as a "hacking" attempt, let him try and fail. If he wants to put forth the effort to make an ActiveX control just to try and "hack" people, well more power to him. Just when he gets caught, which chances are pretty high as he seems to not know the first items of how to do any of this, at least then he is fined/behind bars. It is the ultimately the end-user's responsibility to educate themselves and protect themselves. His "hacking ploy" will only work if they explicitly allow it. (end rant). Quote Link to comment https://forums.phpfreaks.com/topic/145797-file-exist-on-data-server/#findComment-766248 Share on other sites More sharing options...
allworknoplay Posted February 19, 2009 Share Posted February 19, 2009 Oh sure, if it's legit. You know the average mom or dad sitting at a website will get the pop up and probably just hit OK... 90% of people are too lazy to take that time to ask someone, hire someone or to even pay attention on how to. That is absolutely DEAD ON. I have used WinXP forever without getting viruses or spyware just because I am not oblivious to websites that I go to. of course I can be tricked too but i am very careful. When people ask me for help because their PC has SLOWED down, I already know that it's NOT the PC but it's the END USERS! Knowledge is power and no one these days want to better themselves and learn how to surf the internet properly, it's too easy to just say OK, and then load spyware on their PC.... I don't even bother to clean out their systems as it's a waste of time. I just copy their important data to an external HDD and just blow out their PC..... Quote Link to comment https://forums.phpfreaks.com/topic/145797-file-exist-on-data-server/#findComment-766260 Share on other sites More sharing options...
swap567 Posted February 19, 2009 Author Share Posted February 19, 2009 wow guys I'm not trying to hack anybody I need this application for my job. My boss ask me to do this. I want to use the user pc just to logging a server if he have the right to. If not a message will show saying that he can have access to those file. So do I. the only reason he's because if my folder path is on the same server that ok my application read them. But if they are on a different server. The application don't make the link. I just want to know if there's a way to make that link. I also try to logging to my own computer file and he don't reconize them. Quote Link to comment https://forums.phpfreaks.com/topic/145797-file-exist-on-data-server/#findComment-766392 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.