Results 1 to 18 of 18

Thread: edit hosts file

  1. #1

    Thread Starter
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945

    edit hosts file

    I want to be able to apply a "patch" to a users computer to change their hosts file so that they can put in a keyword to access my server on our local intranet.

    Is this possible with Javascript?

    Also, could I tell which version of windows is being used and possibly the Windows directory?
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  2. #2
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    JavaScript can definately not detect what version of windows in running and what folder it is in. but surely in an intranet, it would be the same on every pc.

    JavaScript cannot edit/move/create/delete files either
    Have I helped you? Please Rate my posts.

  3. #3

    Thread Starter
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945
    >>but surely in an intranet, it would be the same on every pc.

    Surely you're joking, right? I'm talking about several hundred PCs all at different levels of upgrades.

    And if I can't edit files using Javascript, what should I use?
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  4. #4
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    PHP, or Java could maybe do it. ActiveX can, I think. I'd think VB would be the best app to run though. I'd ask this question in the VB forum, being more specific with what you want the "patch" to do.
    Have I helped you? Please Rate my posts.

  5. #5

    Thread Starter
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945
    PHP is server side only! How would it get the browser to access the file?
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  6. #6
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    OK, my mistake, maybe PHP won't do it. VB and ActiveX should though.
    Have I helped you? Please Rate my posts.

  7. #7

    Thread Starter
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945
    Do you really think I'd ask this here if I wanted a VB solution? I want to make it so that they can go to a website, click a button and .... "wa la" all is fine and dandy.
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  8. #8
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    try ActiveX then
    Have I helped you? Please Rate my posts.

  9. #9
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    Java and PHP are server-side only. And only a fool would give ActiveX the authority to have file access. This is something that just isn't feasible from a web app, unless it's in an intranet setting where the software can be trusted.
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  10. #10
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    so really it should be VB or C?
    Have I helped you? Please Rate my posts.

  11. #11

    Thread Starter
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945
    Originally posted by crptcblade
    This is something that just isn't feasible from a web app, unless it's in an intranet setting where the software can be trusted.
    Exactly. It is on our intranet. Neither the database or this patch would be accessible to outside users. SOO... the software can be trusted.

    So do you know of a way to get this done?
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  12. #12
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    As was said before, use ActiveX. Read up on File Scripting Objects.
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  13. #13

    Thread Starter
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945
    OK, I have to be honest. I don't know is meant when someone says "use ActiveX". Does that mean create a DLL, or does that mean I have to create some kind of control like in VB?

    And how is that deployed?

    -lost, confused, in need of help.
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  14. #14
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    I've never used ActiveX on a website before, but there should be no need to deploy anything as long as you are not doing anything fancy.

    Just use VBScript to run the FSO...
    VB Code:
    1. Sub UpdateFile
    2. Dim fso
    3.  
    4.     Set fso = CreateObject("Scripting.FileSystemObject")
    5.  
    6.     'run your update code
    7.  
    8.     Set fso = Nothing
    9. End Sub

    And you should be able to call the sub just as you would call a javascript function.
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  15. #15

    Thread Starter
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945
    Do I need to have anything special setup on the server to handle vbscript? (I'm assuming you might not know this if you've never used it in a web arena).
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  16. #16
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    no, VbScript should work straight away, though only in IE. on an intranet I don't think that matters though,
    Have I helped you? Please Rate my posts.

  17. #17

    Thread Starter
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945
    I'm getting errors that it cannot create the FSO
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  18. #18
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    sorry, but I don't know how to use ActiveX in web pages, try google.
    Have I helped you? Please Rate my posts.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width