system(...) works for restart but not logoff

Alles, was Perl betrifft, kann hier besprochen werden.

system(...) works for restart but not logoff

Postby ashwinkraj » 09. September 2009 15:56

The following code for restarting the computer from a CGI script executed via the browser works:
Code: Select all
 
  #!C:/perl/bin/perl.exe
  system ( "C:/WINDOWS/system32/shutdown.exe", "-r");
 


But the same code altered to logoff the user does not work:
Code: Select all
  #!C:/perl/bin/perl.exe
  system ( "C:/WINDOWS/system32/shutdown.exe", "-l");
 

I get the error - "Incorrect Function". From a DOS console, I can restart or logoff the user using the shutdown command and the-r and-l flags respectively.

I am using XAMPP for hosting the CGI file, and using a separate installation of ActivePerl to execute the scripts.

Can some help me with this?

Thanks.

Ashwin
ashwinkraj
 
Posts: 3
Joined: 09. September 2009 15:30

Re: system(...) works for restart but not logoff

Postby Wiedmann » 09. September 2009 16:02

Code: Select all
system ( "C:/WINDOWS/system32/shutdown.exe", "-r");

Maybe you want read the PHP manual about system()?
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: system(...) works for restart but not logoff

Postby ashwinkraj » 09. September 2009 16:29

I am invoking the shutdown command using Perl, so are you suggesting that I consider a PHP-based alternative?

Thanks.

Ashwin
ashwinkraj
 
Posts: 3
Joined: 09. September 2009 15:30

Re: system(...) works for restart but not logoff

Postby Nobbie » 09. September 2009 16:47

ashwinkraj wrote:I am invoking the shutdown command using Perl, so are you suggesting that I consider a PHP-based alternative?


No. But I suggest to use the right forum, you choose the PHP forum, instead of the Perl forum.
Nobbie
 
Posts: 6578
Joined: 09. March 2008 13:04

Re: system(...) works for restart but not logoff

Postby Wiedmann » 09. September 2009 17:25

I am invoking the shutdown command using Perl,

Sorry, my fault.

How is Apache started?
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: system(...) works for restart but not logoff

Postby ashwinkraj » 09. September 2009 21:14

I use the XAMPP console GUI to start up the Apache service.
ashwinkraj
 
Posts: 3
Joined: 09. September 2009 15:30

Re: system(...) works for restart but not logoff

Postby Wiedmann » 09. September 2009 21:49

to start up the Apache service.

"service" = the checkbox "Svc" is checked?
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: system(...) works for restart but not logoff

Postby Lima » 11. September 2009 19:36

please read in my article 'gelöst: XP abmelden-GUI reagiert nicht' :

the solution is to kill the running 'xampp-control.exe' before logout. But I don't know why.

so long - LB
Lima
 
Posts: 2
Joined: 11. September 2009 19:02


Return to Perl

Who is online

Users browsing this forum: No registered users and 1 guest