permission problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ajaymohank
    New Member
    • Jan 2008
    • 29

    #1

    permission problem

    Hello friends.... i have a problem in php. i am using dream weaver for doing php. in a page i wrote exec("notepad.e xe"); and when i called the page from another system the notepad is executing in my system, not the system from which i called it. why is it so ? is this due to any permission problem of windows..

    thanks.
  • harshmaul
    Recognized Expert Contributor
    • Jul 2007
    • 490

    #2
    Hi,
    PHP is a serverside language, you can't remotely execute programs from the server.

    But there is a way.

    Code:
    header("Content-type: application/bat");
    header("Content-Disposition: attachment; filename=notepad.bat");
    notepad.exe
    this should work. but it's not recomended cos running bat scripts remotely is a very dodgy thing, (think format ;) )

    Comment

    • ajaymohank
      New Member
      • Jan 2008
      • 29

      #3
      Originally posted by harshmaul
      Hi,
      PHP is a serverside language, you can't remotely execute programs from the server.

      But there is a way.

      Code:
      header("Content-type: application/bat");
      header("Content-Disposition: attachment; filename=notepad.bat");
      notepad.exe
      this should work. but it's not recomended cos running bat scripts remotely is a very dodgy thing, (think format ;) )
      hi

      where will i type this code... is it inside the <body> part.

      Comment

      • harshmaul
        Recognized Expert Contributor
        • Jul 2007
        • 490

        #4
        Hi,

        The best thing, is post your whole code (in proper code tags please) and i'll fit it in for you.

        Comment

        • ajaymohank
          New Member
          • Jan 2008
          • 29

          #5
          Hi

          This is my code...


          <html>
          <head>
          <title>Untitl ed Document</title>
          </head>
          <body>
          <?php
          exec("notepad.e xe");
          ?>

          </body>
          </html>


          thanks

          Comment

          • harshmaul
            Recognized Expert Contributor
            • Jul 2007
            • 490

            #6
            hi,
            basically clear all of your code and write only the code i gave you..


            so the contents of the page will be

            Code:
            <?php
            header("Content-type: application/bat");
            header("Content-Disposition: attachment; filename=notepad.bat");
            notepad.exe
            ?>

            Comment

            Working...