1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Running batch file on client side

Discussion in 'PHP' started by andytan91, Jul 14, 2010.

  1. #1
    Hi guys, basically my current situation is that the client will need to run the audit services batch file from the web server.

    I would like it to output the service result of the client side because i want to audit the client side and not the web server side.

    I have a method which is using Force Downloading but however, my project requires me to auto run the batch file when the user saves the script....how do i go about doing that?



    <?PHP
     // Define the path to file
     $file = '4.4_File_Permission.bat';
    
     
     if(!file)
     {
         // File doesn't exist, output error
         die('file not found');
     }
     else
     {
    
         // Set headers
         header("Cache-Control: public");
         header("Content-Description: File Transfer");
         header("Content-Disposition: attachment; filename=$file");
         header("Content-Type: application/bat");
         header("Content-Transfer-Encoding: ASCII");
        
         // Read the file from disk
         readfile($file);
    
     }
     ?>
    PHP:
     
    andytan91, Jul 14, 2010 IP
  2. Rainulf

    Rainulf Active Member

    Messages:
    373
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    85
    #2
    I was a little confuse when you mentioned "client side" - I think you got the naming convention wrong because PHP is not client side.

    You seem to want this script to run on your client's server and you want to auto run this script. You need to tell your client that he/she needs to learn CRON jobs because that's what most people usually use to auto-run scripts. What are you trying to accomplish with this script anyway?
     
    Rainulf, Jul 14, 2010 IP
  3. andytan91

    andytan91 Greenhorn

    Messages:
    25
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #3
    Okay basically i am doing a project which is web-based windows auditing. Users/Clients will access the web server in order to download the various audit batch scripts. Right now, users can download the batch scripts but the browser only prompts it to save the script. I need to find a way whereby the batch scripts will be saved and auto-executed in order to provide user-friendliness..
     
    andytan91, Jul 14, 2010 IP
  4. NedBool

    NedBool Guest

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    It is not possible.
     
    NedBool, Jul 14, 2010 IP
  5. ThePHPMaster

    ThePHPMaster Well-Known Member

    Messages:
    737
    Likes Received:
    52
    Best Answers:
    33
    Trophy Points:
    150
    #5
    The only way I see that possible is by using ActiveX.
     
    ThePHPMaster, Jul 14, 2010 IP
  6. andytan91

    andytan91 Greenhorn

    Messages:
    25
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #6
    aww man..thanks alot
     
    andytan91, Jul 14, 2010 IP
  7. themullet

    themullet Member

    Messages:
    110
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    26
    #7
    Agreed on the ActiveX method. If you know the admins at the site they could probably put a run call to your script when user logs in as a back up option
     
    themullet, Jul 14, 2010 IP
  8. andytan91

    andytan91 Greenhorn

    Messages:
    25
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #8
    Hmm if i use Javascript with ActiveX components integrated into it, can the audit batch scipt be called from the web server to the computer client and be executed?
     
    andytan91, Jul 14, 2010 IP