Jump to content

php execute a vbscript on the server


scrappy1855

Recommended Posts

I have a Php file that processes my form data into a csv file after that is complete i need to execute a vbscript file that will loop through all of the form submissions and processes them along with an access vba process. But i'm having issues executing the vbs file from my php file. Here is my code posted below. The vbscript resides on my webserver folder but really i'd like to if able launch it from a network drive.  Any assistance woudl be greatly appreciated.

 

<?php 
if (!empty($_SERVER['HTTPS']) && ('on' == $_SERVER['HTTPS'])) { 
$uri = 'https://'; 
} else { 
$uri = 'http://'; 
} 
$uri .= $_SERVER['HTTP_HOST']; 


$customernumber = $_POST["customernumber"]; 
$yearwkstart = $_POST["yearwkstart"]; 
$yearwkend = $_POST["yearwkend"]; 
$email = $_POST["email"]; 


$num=''; 
do{ 
  $file = 'c:\asys_reports\baddebtfiles\baddebt'.$num.'.csv';   
}while(file_exists($file) && $num-->intval(PHP_INT_MAX+1)); 

$values = "$customernumber\r\n$yearwkstart\r\n$yearwkend\r\n$email\r\n"; 


IF (!isset($_POST["customernumber"])) {


header('Location: '.$uri.'/index_files/baddebtquery.htm');

} 


elseif (empty($customernumber) || empty($yearwkstart) || empty($yearwkend) || empty($email)) { 

header('Location: '.$uri.'/index_files/error.htm');
} 

else { 
$values = "$customernumber,$yearwkstart,$yearwkend,$email,"; 
$fp = fopen($file, "w") or die("Couldn't open $file for writing!"); 
$numBytes = fwrite($fp, $values) or die("Couldn't write values to file!"); 

fclose($fp);

Echo Exec('baddebtfiles.vbs')



header('Location: '.$uri.'/index_files/complete.htm'); 

}

?> 

 

Link to comment
https://forums.phpfreaks.com/topic/187736-php-execute-a-vbscript-on-the-server/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.