|
-
Oct 25th, 2005, 11:45 AM
#1
Thread Starter
Junior Member
[RESOLVED] WScript.Shell suddenly stopped working (Win32)
This is more of a Windows OS problem than a PHP, even if I'm using PHP for it lol.
I don't know why this error is suddenly happening, as it was working fine.
 Originally Posted by error
Warning: (null)(): Invoke() failed: Exception occurred. Source: Unavailable Description: Unavailable in c:\webserver\htdocs\includes\functions.php on line 47
This is the offending lines (PHP of course):
// Make a new instance of the COM object
$WshShell = new COM("WScript.Shell");
// Make the command window but don't show it.
$oExec = $WshShell->Run($cmdline, 0, true); << line 47
This is really annoying me.... Any Ideas?
Or advise me another way to execute external programs in PHP, that returns either a false or true........
TIA
-
Oct 25th, 2005, 12:34 PM
#2
Thread Starter
Junior Member
Re: WScript.Shell suddenly stopped working (Win32)
ok, I think I found out why.... a CMD.EXE was stuck in the process list, it wouldn't break/end, so I had to reboot PC..... Will get back after further tests........
Ha! Technology....don't you just love it?
-
Nov 1st, 2005, 10:06 AM
#3
Thread Starter
Junior Member
Re: WScript.Shell suddenly stopped working (Win32)
Ok, this didnt sove it....... So, has anyone any exampl,es of another way of using CMD or executing an .exe with args.........oh on a Win2000 machine before I forget....... 
TIA
-
Nov 1st, 2005, 11:22 AM
#4
Junior Member
Re: WScript.Shell suddenly stopped working (Win32)
I need to see more of that functions.php file. Specifically the Run() function.
Also, if you can, post the shell script. I'll see if i can find out the problem from there.
-
Nov 1st, 2005, 01:06 PM
#5
Thread Starter
Junior Member
Re: WScript.Shell suddenly stopped working (Win32)
 Originally Posted by Triumph
I need to see more of that functions.php file. Specifically the Run() function.
Also, if you can, post the shell script. I'll see if i can find out the problem from there.
Ok, heres a snippet....... It was working before I originally posted my query.. Maybe MS disabled the COM object in an update?
Code:
<?
require_once("c:/webserver/htdocs/includes/dbasefunctions.php");
function AddUser($account_type) {
global $account_type,$firstname,$lastname,$sex,$country,$accountname,$email,$password,$password1,$password2,$secretquestion,$secretanswer,$date_day,$date_month,$date_year,$post_code,$alt_email,$paid,$ip;
//
// Get a good ol' timestamp. Unique and it works.
$unixtime = time();
// Sets up your exe or other path.
$cmd = 'C:\\Program Files\\Merak\\users.exe';
// Setup an array of arguments to be sent.
$arg[] = "-a";
$arg[] = "-u".$email."@<hidden>.co.uk";
$arg[] = "-n".$firstname."_".$lastname;
$arg[] = "-p".$password1;
$arg[] = "-m".$email;
//
if ($account_type == "free") {
$arg[] = "-i+20000";
$arg[] = "-k10000";
$arg[] = "-4-";
$arg[] = "-z-";
$arg[] = "-s-";
$arg[] = "-x-";
$arg[] = "-j-";
$query = "update users set U_ServicesAccess=206 where U_Mailbox=\"$email\"";
} elseif ($account_type == "premium") {
$arg[] = "-i+250000";
$arg[] = "-k0";
$arg[] = "-4-";
$arg[] = "-z-";
$arg[] = "-s-";
$arg[] = "-x-";
$arg[] = "-j-";
$query = "update users set U_ServicesAccess=200 where U_Mailbox=\"$email\"";
}
//$arg[] = "-cfg\"C:\Program Files\Merak\\"";
// Pick a place for the temp_file to be placed.
$outputfile = 'C:\\unixtime.txt';
// Setup the command to run from "run"
$cmdline = "cmd /C \"$cmd\" " . implode(' ', $arg) . " >$outputfile";
//$cmdline2 = "\"$cmd\" > $outputfile";
// Make a new instance of the COM object
$WshShell = new COM("WScript.Shell");
// Make the command window but don't show it.
$oExec = $WshShell->Run($cmdline,0,true);
// Read the file file.
$output = file($outputfile);
// Delete the temp_file.
//unlink($outputfile);
if($oExec=="0") {
blah bl.ah
?>
Thanks
-
Nov 3rd, 2005, 09:10 AM
#6
Thread Starter
Junior Member
Re: [RESOLVED] WScript.Shell suddenly stopped working (Win32)
-
Nov 3rd, 2005, 10:11 PM
#7
Junior Member
Re: [RESOLVED] WScript.Shell suddenly stopped working (Win32)
Just out of curiosity, what was the problem?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|